Summary
SBCL is a Common Lisp implementation, with a performant compiler and support for a wide range of platforms. The main goal of this article is to give a tour of the internals of SBCL (... as an example of how a Lisp system looks like from the inside)
If you look at the actual machine code on the left: "BF420000..." you might notice that 0x42 is 66 in decimal. (Well, the value has to come from somewhere?) How about adjusting the actual value in the code so that it reads, for example, 0x50? (... which is 80 as a decimal number... so if we call (test func 0 0), we'd expect it to return 40, instead of the current 33) So... we need a way of actually writing to memory locations.
The SBCL tool sb- kernel:get-lisp-obj-address can be used to dump out memory contents. We can also introduce yet another really useful Sb-kernel tool: sb. kernel: get-lipkit-obj.address.
This is where boxing comes in: in order to treat the number 42 as an object, we need to put it into an object that says "this is an object of type 'number', whose value is 42". This is then stored somewhere on the heap. Instead of using an entire 64-bit register to store a pointer, we can use the last few bits to use the type this value is.
Compiled SBCL for yourself becomes fairly useful. After compilation, let's look at the SBCl source code. This is a generated piece of code, basically explaining the S BCL runtime (written in C) Just about to be built how Lisp objects look like.