blob: c4a7be2d1cecae4700e84e76b8345baad02c47f6 [file] [log] [blame]
swissChilica107a02021-04-14 12:07:30 -07001#+TITLE: Lisp Notes
2#+AUTHOR: swissChili
3
4* Compiler
5
6 The compiler will using DynASM to generate code at runtime. It wont
7 be a JIT (no interpreter), strictly a dynamic compiler.
8
9 For now I wont even have a register allocator, all variables and
10 temporaries will be stored on the stack. This makes more or less
11 sense considering they will need to be put on the stack anyway when
12 a function is called.
13
14 An example assembly is in =scratch.s=.
15
swissChili8cfb7c42021-04-18 21:17:58 -070016 Values will be encoded as double words, where the lowest few bits
17 indicate the type.
swissChilica107a02021-04-14 12:07:30 -070018
swissChili8cfb7c42021-04-18 21:17:58 -070019** Closures and lambdas
swissChilica107a02021-04-14 12:07:30 -070020
swissChili8cfb7c42021-04-18 21:17:58 -070021 Closures will have to be done in two passes, one pass to find the
22 free variables and one to generate the code. Free variables will be
23 accessed as an offset to =edi=, which will point to the location of
24 the lambda on the heap. =[edi]= will evaluate to the address of the
25 lambda, =[edi + 1]= for the first free variable, etc.