[squeak-dev] Re: [Pharo-project] Prune stack serialization
Juan Vuletich
juan at jvuletich.org
Sat Dec 3 01:50:48 UTC 2011
Eliot Miranda wrote:
>
>
> On Fri, Dec 2, 2011 at 5:13 PM, Eliot Miranda <eliot.miranda at gmail.com
> <mailto:eliot.miranda at gmail.com>> wrote:
>
>
>
> On Fri, Dec 2, 2011 at 4:01 PM, Juan Vuletich <juan at jvuletich.org
> <mailto: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 ;)
Right. That's what my version of #isClean wants.
>
>
>
>
> Cheers,
> Juan Vuletich
>
>
>
>
> --
> best,
> Eliot
>
>
>
>
> --
> best,
> Eliot
>
Cheers,
Juan Vuletich
More information about the Squeak-dev
mailing list
|