Sun Apr 2 14:20:10 CEST 2006
core changes epilogue
Lots of things changed last couple of days.
* eliminated need for new (pre-emptible) parser by running parser in a
separate thread. (plugins/reader)
* the above required a different kind of 'accept' semantics (not just
a current input stream, but a current input accepter word), so i
went on eliminating the input/output stacks from the VM and replaced
it with a single deferred 'accept' word.
* i tried to use temp code on the return stack to implement the
current accept semantics: like lisp closures without GC. i tried
this before, but didn't learn: it's too hard to get the memory
management working: too many things can go wrong.
* so i split the closures into an explicit code/data pair: 'accept'
contains the code word, while the top of the input stack contains the
data part of the stream, which in most cases is just a stream packet.
* this allowed a single interpreter for all streams, a good thing. error
message reporting is done in the interpreter's abort handler, using the
'stream-info' and 'error-location!' words. (stream-info is hacked to not
produce errors: can't do that inside an error handler).
* abort stack semantics are clarified: it is for global linear control
flow only. for local control flow only the return stack can be used
(so this control can be frozen by swapping return stacks.) for this
to work 'map' and 'for-each' (former 'consume') had to be changed to
leave the abort stack alone.
* code copying has been clarified: see pf_stackatom_dup in
libpf/list.c : this means 'dup' and '@' have slightly changed
semantics: they will return a copy only if objects are copyable, and
a ghost otherwize. technically it should now be safe to do temp-code
tricks, but i prefer to keep it out of the core functionality.