Sun May 1 19:26:47 EDT 2011
From structured to linear code
Now, with only one continuation type we have a CALL / RETURN structure
that saves/restores closures (code pointer + environment). If the VM
only uses POP to operate on the code, that operation can be made
abstract and the code representation doesn't actually matter, i.e. it
can be CDR-coded.
/* Read a number from the code stream. */
#define NREADC NPOP(c)
/* Read a structured data item from the stream: try to avoid this as
it hinders abstraction. Replace with other typed reads. */
#define READC POP(c) // read code data structure
It seems that READC is only used to create closures. What is really
necessary is a way to represent code addresses in code, and abstract
the representation of code addresses in the continuation stack.
Turning the current cell-based VM code into a proper list seems to be
the way to go. One at a time.
Still, this doesn't seem to lead to very flat code, except for calls.
I'm looking at set!. Hmm make this more specific...