Phases SBCL Compiler

I can not find a single source that describes the individual phases of the SBCL compiler. What resources, such as documents, describe these phases of the SBCL compiler?

+6
source share
1 answer

Phil Khong's article Starting with Hack on SBCL provides a good description of how to get started with the internal components of SBCL. In the compiler section, he writes:

Search where the compiler lives

Working with the compiler itself is a bit more work. I think the best approach is to go to src/compiler/main.lisp and look for compile-component . ir1-phases loops on the component and performs high-level optimization to a fixed point (or we are tired of waiting), and %compile-component processes the conversion to IR2, and then to machine code. The compilation pipeline hasn't really changed since Python paper was written, and sub-phases have their own function (and file). M-. on materials that seem interesting, probably the best approach at the IR2 level.

The Python document mentioned is previously mentioned in the article:

Source study

I often see beginners trying to read the source, like a book, and, realizing that they have a lot of code, try to find a good order for reading the source. I do not think this is the best approach. SBCL is quite large, and I doubt that someone is holding the complete system in their head at the same time. The Python Compiler for CMU Common Lisp RAM is still useful as an overview, and the SBCL internal docs guide is a good addition. As you get closer to boot logic, Christophe Rhodess "SBCL: Sanely-Bootstrappable Common Lisp" helps you understand exclamation points. In the past, I believe that his preferred [sic] prefers to start small, learn enough to complete the current task, and accept that some things just work without asking how (at the moment).

You are probably particularly interested in section 8, “Compilation Phases, ” from “Python Compiler for CMU Common Lisp”.

+10
source

Source: https://habr.com/ru/post/947895/


All Articles