More fun with VMs
Hans-Martin Mosner
hmm at heeg.de
Thu Mar 23 18:44:26 UTC 2006
stéphane ducasse wrote:
> Hi
>
> I wanted to know how this was relating to the way VW treats blocks:
> clean block [:each | each zork], copy blocks and full blocks.
> Does anybody able to compare?
These are different things. The optimized blocks in VW still require
full context activations, they just avoid issues with references to
their creating context:
A clean block is completely independent of its context, so VW creates
the block at compile time and stores it in the literal frame of the method.
A copying block needs some values from the context which are known not
to be changeable after the block has been created (method receiver and
arguments and variables which are never assigned to after the block's
creation), so these values can be copied into the newly created block,
but the block does not need a reference to its creating context, so that
context does not have to be stabilized when the method returns.
A full block needs a reference to its context, either because it
contains a return or because it reads variables which may change after
its creation, or writes into temporaries outside of its own scope.
In contrast, Dan's scheme does not deal with blocks but activations in
general, and it tries to avoid creating a stack frame if possible. IMO
it is an optimization that should be investigated.
Cheers,
Hans-Martin
More information about the Squeak-dev
mailing list
|