[virtmach] bytecodes and stacks

Peter_Murray@allegiance.com.au Peter_Murray@allegiance.com.au
Mon, 29 Nov 1999 09:39:21 +1000

>The questions are:
>Is it possible to just push/pop things off one stack, allowing for things
>like global-variables and locally bound ones (eg. let in scheme)? or would
>several be needed, leading to a towers of hanoi like situation, when you
>needed  to reference a variable form an earlier "stack frame", not a fun

I'm in the early stages of trying something similar (a VM to execute
byte-codes generated from scheme code).  I discovered that I couldn't
simply push and pop things off a frame stack because of the existence of
environment closures.  I suppose some sort of analysis could be done of the
code in order to hoist any variables out of the frame stack if required by
a closure, but I took the easy way out and implemented a small,
highly-specialised garbage-collector.

- Peter.