Tue Jan 26 08:59:30 CET 2010
Incrementally fixing VM1
Today I'm hopeful again that VM1 can be fixed incrementally.
- make all the dispatching uniform (if ... return)
- replace VALUE and STATE by using deforestation (connect the
creation and dispatch by a goto)
- write a trivial compiler in C
- move functionality from interpreter to compiler
- _sc_step_value() -> _sc_step_return()
- make STATE() construction uniform: only at tail call (i.e. return
STATE()). currently memory is reserved for a primitive call, so we
don't need to cleanup.
this might be an important step to return simplicity to the VM!
something went wrong.. reverting: found it: forgot to wrap VALUE on
- deforestation: replace STATE(VALUE(),) constructors with a direct
call to _sc_return.
phase 1: replace STATE(VALUE(),) with STATE_RETURN(,)
- eliminte VALUE structure. this might be more difficult. the
problem is that _sc_yield uses this + the state hacks too.
- its simplest to remove yield for now, and put it back when the
transformation is done. OK
- VALUE is removed completely.
- eliminate the STATE structure. all constructors need to be
converted to jumps to the next_state entry point.
wow this seems to work.
- flip STATE and STATE_RETURN / STATE_REDEX: make the latter two fast
and have STATE unpack a redex and call STATE_REDEX.