Sun Jan 17 11:15:41 CET 2010
Compiler + VM cleanup
- Allow values to appear in applications instead of only variable
First step is to make all variable refs explicit. It might pay to
make a binary tagged type for these, also to suppport displays later.
But where to insert it? Integers, constants, vectors, finalizers.
There's no room, except as part of the integers or constants.
I.e. these could give up one bit of precision to allow for references.
Question: making references explicit, requires also literals and
lambdas to be tagged. So numbers could still be used to encode
I.e. the following byte code:
`(op-let ((op-lit 1) (op-lit 2) (op-lit ,add)) (op-app 0 #(1 2)))
Should become something like
`(op-app (op-lit #<prim>) #((op-lit 1) (op-lit 2)))
I.e. any point in the byte code that expects a value might as well
contain an expression that can be immediately transformed to a value.
But tagging values might not be a good idea.
The problem is there are 2 opaque values that need to be constructed
at run-time - i.e. code needs to run - but the code that runs doesn't
need to create new continuations (no expression evaluation).
- variables: lookup in the environment
- lambda expressions: create a closure grabbing the current environment
Other values (concrete values or literals) do not need any extra
Currently, variables are referenced directly, but lambda forms trigger
the creation and subsequent deletion of a closure (i.e. they are
treated as expressions to be evaluated).
What did we learn: this is not necessary. Lambda expressions are
values, just like variable references and literals.