by nxobject · 6mo ago · 0 comments
Absolutely. I think TFA is hooking into the actual code emitter used by SBCL's evaluator-compiler, since it's not actually primitive, but implemented in Lisp and loaded into the image itself.
My guess at context: from the earliest days of Lisp, I think there was an expectation that Lisp systems would expose as much of their internals as possible... including their internal JIT, which is being plugged into here. I think the name for it was the "LISP Assembly Program" (LAP).
The approach is similar to Forth.
You have a few key forms that provide the required integration points with the hardware, those are the few ones written in Assembly.
Including the reader and at least some of the macro capabilities.
Then everything else is built from them.
For a time travel into those days see the recovered Interlisp-D system from Xerox PARC, https://interlisp.org/
I remember stopping with a friend to chat with Dave one day not too long after he joined the team and he was over the moon about how the Lisp exposed not just an assembler, but an interactive assembler: he could write assembly routines, evaluate them, and see them run immediately, and also inspect the in-memory data that they operated on. He seemed so happy.