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

Eliot Miranda eliot.miranda at gmail.com
Sat Dec 3 01:48:46 UTC 2011


On Fri, Dec 2, 2011 at 5:13 PM, Eliot Miranda <eliot.miranda at gmail.com>wrote:

>
>
> On Fri, Dec 2, 2011 at 4:01 PM, Juan Vuletich <juan at jvuletich.org> wrote:
>
>> 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.
>
>
> <blush>Damn right :)  I've done zero testing.  It was just an
> example</blush>
>
>
>> 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...
>>
>
> Can you (can I??) write some tests?  What's xx in the above?  Ah! [^nil]
> isn't clean in my code since it should be pc <= end, not pc < end!!  Try
> the attached...
>

having played around with this some it strikes me we might want a method
that checks whether a block refers only to block local variables and
constants, or block locals, globals and constants.  Say
BlockClosure>>isSqueakyClean ;)


>
>>
>> Cheers,
>> Juan Vuletich
>>
>>
>
>
> --
> best,
> Eliot
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20111202/39e1d1da/attachment.htm


More information about the Squeak-dev mailing list