[Vm-dev] Context>>copyTo: doesn't update closure home

Max Leske maxleske at gmail.com
Fri Jun 3 09:02:30 UTC 2016


I see at least one problem: at the point where we make a copy of a context, the closures that reference it are either in callees or not on the stack at all. Therefore we would need to take note of all the closures we meet on the way and update the outer contexts only if we find them on the stack. That makes copying a whole lot harder.

Max

> Hi,
> 
> Is anybody aware of a reason for why Context>>copyTo: should not update the home of closures (which is currently the case)? This behaviour becomes a problem when I want to simulate #stepThrough: on a copied stack, since the home of a closure will never be found on the stack.
> 
> My proposal is to implement
> 
> Context>>postCopy
> 	closureOrNil ifNil: [ ^ self ].
> 
> 	closureOrNil outerContext: self
> 
> and
> 
> BlockClosure>>outerContext: aContext
> 	outerContext := aContext
> 
> 
> Thoughts?
> 
> Cheers,
> Max


More information about the Vm-dev mailing list