From 35b13a5e2262d9b17cbc39e6cb4df527c55efceb Mon Sep 17 00:00:00 2001 From: Lassi Kortela Date: Wed, 22 Feb 2023 15:58:58 +0200 Subject: [PATCH] Wayback 20090126080843 www.stripedgazelle.org/joey/dream.html --- www/index.html | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/www/index.html b/www/index.html index 15b5232..c437f7a 100644 --- a/www/index.html +++ b/www/index.html @@ -11,13 +11,20 @@ All essential syntax and procedures from the assembler + I have written in Scheme, with a syntax very similar to GAS.
Consequently Dream can compile itself. :-)
Download latest version for Linux on x86: -dream20080228.tar.gz +dream20090101.tar.gz +
+Download latest version for Windows on x86: +nightmare20090122.zip
Check out my DreamOS based on the Dream Scheme Interpreter as a bootable floppy disk: dreamos @@ -65,15 +72,25 @@ The high word of the type field is used to store the length of the vector. This and all other objects which require more than a quad-word of storage simply store the address of a scheme object in the second double-word and set the low bit in the high byte of the low word of their type to indicate to the garbage collector that this address in the second double-word must be followed just as if it were the cdr of a pair.

-Special forms and built-in procedures store an address to branch to in the second double-word. +Procedures store their starting address in the second double-word. +

Number types are distinguished by the high byte of the low word, which increases as the complexity of the type of number ascends the numeric tower. Integers simply store their 32 bit signed value in the second half of the quad-word. Rationals are stored as a pair of integers, thus the low bit in the high byte of the low word of their type is set so that the garbage collector will see the pair. Inexactness of a number is indicated by setting the lowest bit of the high word of the number's type. Note, however, that all internal representations of numbers are exact (no floating point numbers are used), and so inexactness is given only as an auxiliary property of the number.

-

Input ports use the low byte of the high word of the type field to store the last character read by the (peek) procedure. The second half of the quad-word for both input and output ports holds the file descriptor associated with the port. The ports returned by (current-input-port) and (current-output-port) are stored internally for efficiency's sake. They therefore must be treated by the garbage collector as if they were registers. +

+

+Closures are initially stored simply as scheme along with the enclosing environment. +But as soon as the closure is applied, it is compiled to machine code. +This machine code is not relocatable, and hence a different garbage collection strategy is employed for this memory area. +The garbage collector maintains a list of start addresses of machine code of active closures, and at the beginning of each machine code block is stored a pointer to the address immediately following the end of the machine code for that closure. +Using this information, the largest free space is identified, and compilation of new closures occurs sequentially here until this space is filled. +At this point the garbage collector is invoked again, the largest space identified, and the process repeats. +This garbage collection process for machine code may be invoked from scheme with (sys-gc-lambda), which returns #t if a free space was found larger than the one that had been in use immediately prior. +

The Stack

The scheme object stack is maintained as a scheme list (dynamically allocated as pairs).