blob: c4a7be2d1cecae4700e84e76b8345baad02c47f6 [file] [log] [blame]
#+TITLE: Lisp Notes
#+AUTHOR: swissChili
* Compiler
The compiler will using DynASM to generate code at runtime. It wont
be a JIT (no interpreter), strictly a dynamic compiler.
For now I wont even have a register allocator, all variables and
temporaries will be stored on the stack. This makes more or less
sense considering they will need to be put on the stack anyway when
a function is called.
An example assembly is in =scratch.s=.
Values will be encoded as double words, where the lowest few bits
indicate the type.
** Closures and lambdas
Closures will have to be done in two passes, one pass to find the
free variables and one to generate the code. Free variables will be
accessed as an offset to =edi=, which will point to the location of
the lambda on the heap. =[edi]= will evaluate to the address of the
lambda, =[edi + 1]= for the first free variable, etc.