[squeak-dev] Re: [Pharo-project] Prune stack serialization

Juan Vuletich juan at jvuletich.org
Sat Dec 3 00:01:05 UTC 2011


Eliot Miranda wrote:
> Hi Juan,
>
> ...
>
>
>     I can say that it does indeed work. But I'd be really grateful if
>     Eliot took a good look at that code!
>
>
> There is a much better way, using 
> InstructionStream>>interpreetNextInstructionFor: which abstracts away 
> from the bytecode encoding and allows one to simply use messages. 
>  e.g. look at 
>
>
> and (SortedCollection sortBlock: [:a :b| a compare: b caseSensitive: 
> false]) sortBlock abstractBytecodes evaluates to
>
> an OrderedCollection(#pushTemporaryVariable: #pushTemporaryVariable: 
> #pushConstant: #send:super:numArgs:)
>
> So a check for clean blocks would check for a block's 
> abstractBytecodes not including some particular set of banned messages 
> (which I *think* is pushReceiver pushReceiverVariable: 
> popIntoReceiverVariable: storeIntoReceiverVariable: 
> methodReturnConstant: methodReturnReceiver methodReturnTop).
>
> e.g.
>
> isClean
>       ^(self abstractBytecodes intersection: #(pushReceiver 
> pushReceiverVariable: popIntoReceiverVariable: 
> storeIntoReceiverVariable: methodReturnConstant: methodReturnReceiver 
> methodReturnTop)) isEmpty
>
>
>     Cheers,
>     Juan Vuletich
>
>
>
>
> -- 
> best,
> Eliot
>

Thanks Eliot. However, it looks to me that this needs more tweaking. For 
instance, your method answers true for
    [ xx size ] isClean
and
    [ ^ nil ] isClean
while mine answers false for both. Maybe we could serialize non local 
returns using the Compiler (although we won't be able to return 
anywhere), but external variable acess is a problem.

Will keep playing with this for a while...

Cheers,
Juan Vuletich



More information about the Squeak-dev mailing list