Work on getting the memory model translated into Scheme.
This commit is contained in:
parent
f9cbc40e0a
commit
69d762645a
4 changed files with 228 additions and 5 deletions
|
|
@ -43,7 +43,7 @@ Tags will be allocated as follows:
|
|||
| 4 | 4 | 0x4 | unassigned (possibly a floating point number, later.) |
|
||||
| 5 | 5 | 0x5 | unassigned |
|
||||
| 6 | 6 | 0x6 | unassigned |
|
||||
| 7 | 7 | 0x7 | a cons cell |
|
||||
| 7 | 7 | 0x7 | **never** used: see [Recognising a cons cell](#Recognising-a-cons-cell), below |
|
||||
| 7 | 15 | 0xf | a symbol cell *(this implies a symbol can have only up to seven, or if compressed to five bits per character, eleven characters)* |
|
||||
| 7 | 23 | 0x17 | a pointer to a compiled function *(there's a problem here; it means we can only allocate a function in the lower 72,057,594,037,927,936 bytes of memory; I *think* that's not going to byte us on the bum, pun intended)*. |
|
||||
| 7 | 31 | 0x1f | a pointer to a compiled special form *(same problem as above)*. |
|
||||
|
|
@ -60,6 +60,12 @@ Tags will be allocated as follows:
|
|||
| 7 | 119 | | unassigned |
|
||||
| 7 | 127 | 0x7f | a free cell |
|
||||
|
||||
### Recognising a cons cell
|
||||
|
||||
My original idea was to have a specific tag to mean a cons cell, and that tag was going to be 7, binary 111, all three lower-most bits set.
|
||||
|
||||
This does not work. If we were to do that, there is nowhere to put the tag of the `car` of the cell. So a cell is a cons cell if the value of the lower three bits of the tag is **less than** 7; all 64 bit objects other than cons cells will have all of the three lower-most bits of the tag set.
|
||||
|
||||
## Problems with building a Ghuloum-style compiler in Lisp 1.5
|
||||
|
||||
Ghuloum's compiler emits strings in the form of assembly language statements into a file which is then run through a separate assembler to produce a binary which is finally integrated with a launcher stub written in C using a linker. This makes it possible to write a Lisp largely in that Lisp itself (provided you have an existing Lisp fostermother image to run the initial compilation); but it does not dirctly enable you to compile a single function into the existing image at runtime, and then immediately use the newly compiled function; and as far as I'm concerned, until you have that you don't have a working Lisp compiler.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue