I can not find any source that would describe the individual phases SBCL compiler. What resources, e.g., papers, describe these phases of the SBCL compiler?
Phil Khoung's article Starting to Hack on SBCL includes a good description of how to start working on SBCL internals. In a section about the compiler, he writes,
Finding where the compiler lives
Working on the compiler itself is a bit more work. I think the best approach is to go in
src/compiler/main.lisp
and look forcompile-component
.ir1-phases
loops on a component and performs high-level optimisations until fixpoint (or we get tired of waiting), while%compile-component
handles the conversion to IR2 and then to machine code. The compilation pipeline hasn’t really changed since the Python paper was written, and the subphases each have their own function (and file). M-. on stuff that sounds interesting is probably the best approach at the IR2 level.
The Python paper that is mentioned there is linked earlier in the article:
Exploring the source
I often see newcomers try to read the source like a book, and, once they realise there’s a lot of code, try to figure out a good order to read the source. I don’t think that’s the best approach. SBCL is pretty huge, and I doubt anyone ever simultaneously holds the complete system in their head. RAM’s “The Python Compiler for CMU Common Lisp” is still useful as an overview, and SBCL’s internals manual is a good supplement. Once you get close to bootstrapping logic, Christophe Rhodes’s “SBCL: a Sanely-Bootstrappable Common Lisp” helps understand the exclamation marks. Past that, I believe it’s preferrable [sic]preferrable to start out small, learn just enough to get the current task done, and accept that some things just work, without asking how (for now).
You'll probably be particularly interested in Section 8, Compilation Phases from “The Python Compiler for CMU Common Lisp.”
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With