[<<][staapl][>>][..]
Thu May 21 12:53:29 CEST 2009

target stack access

Another thing which has annoyed me for a while is the way target macro
simulation works: it slurps the entire stack.  How can we know how
many elements should be popped?  This really could be done lazily, but
would require some modification to the code representation (allow lazy
stacks).

I already have a mechanism to do this: target-value.

Just adding thunks that will force stack pops should be enough.

This works, but picking out instructions to skip turns out to be more
difficult than expected. (i.e. "dup" and "swap" don't work because
they dont wrap the target words.

This should be done by comparing input and output.

--

This problem isn't nearly as trivial as it seems.  Before evaluation
starts, all pops need to be forced.

Even this isn't enough: we need to find _references_

Ok. the trick is this:

  - first compare in/out to see which operations do not need to be
    executed.
  - dummy eval the rest to trigger the lazy pops
  - use the size of the input stack to determine how many instructions
    of out need to be taken





[Reply][About]
[<<][staapl][>>][..]