Compiler code structure
Both the compiler and precompiler are centered around a dispatch mechanism used to call the correct handlers for specific types of code constructs.
Dispatch handlers
When handling LAMBDA, LET, LET* or LOCALLY, a central dispatch mechanism decides which function is called to handle the specific bit of code. It does this by registering handlers on the COMMON-LISP package symbols' property-list. There are:
- precompile-handler
In the precompiler and:
- p1-handler
- p2-handler
in the JVM compiler.
When a specific handler (e.g. PRECOMPILE-LAMBDA) knows about the structure of the code it encloses, it can call specific other handlers. In case it doesn't know it calls the generic driver for that compilation phase, for the precompiler that is PRECOMPILE1.