3 a heap is allocated at the start, and the address to the next free
4 space on it is stored in `heap_start`. it needs to be
5 updated/decremented whenever you put anything on the heap
8 - how should allocation be managed?
9 make free blocks a doubly linked list. (how big is a block?)
10 when allocating, use first free block, move up free pointer
17 (let ([s "hello"]) <- s should be a linear string
19 (lambda () (print s)) <- two references to s?
20 (lambda () (print (reverse s)))))
25 * lambda: actual function containing the code
26 * closure: reference to the lambda containing captives
28 closures are stored on the heap. They contain the address to the
29 lambda along with any "captives", i.e. captured variables. They have
34 lambda code 1st 2nd 3rd
35 address captive captive captive ...
40 lambdas use the system v amd64 calling convention.
42 * param 0: the start address of the **1st** captive
43 * param 1...n: the remaining, regular args.
47 (let [(x 42)] (lambda (y) (+ x y)))
50 * param 0: pointer to the value of `x`
51 * param 1: the value of`y`