[Vm-dev] Push/pop considered harmful
David T. Lewis
lewis at mail.msen.com
Tue Mar 3 12:47:58 UTC 2009
On Mon, Mar 02, 2009 at 11:24:07PM -0800, Andreas Raab wrote:
>
> What we are doing right now is along those lines - basically we are
> replacing push/pop in the interpreter proxy by variants that don't
> actually do push and pop. Rather than that, pop is ignored (it only
> remembers how many times you popped so we can track inconsistencies) and
> push remembers the return value.
Excellent idea, especially since this can be done without requiring
modifications to the existing plugins.
> This should definitely be replaced at some point by a proper
> #primitiveReturnValue: call. I was wondering what people think about the
> possibility of automatically rewriting plugins to fix those uses? It
> should be reasonably easy to find all the uses of "interpreterProxy pop:
> foo" and just remove them and replace "interpreterProxy
> push[Float|Int]:" with "interpreterProxy primitiveReturn[Float|Int]:".
This would be helpful, although not essential. It might have problems
with things like this:
interpreterProxy pop: 1; push: foo
But if it does 90% of the conversions automatically, that would still be
a big help.
Dave
More information about the Vm-dev
mailing list