[squeak-dev] inlining repeat and the decompiler (Compiler-nice.186)

Eliot Miranda eliot.miranda at gmail.com
Fri Apr 1 01:48:54 UTC 2011


Hi All,

    just a note that once Compiler-nice.186 is installed, which inlines
#repeat, one needs to recompile all senders of repeat to avoid having the
decompiler crap out on you, e.g. in the debugger.  For example the
compilation of

GeneratorTest methods for generators
fibonacciSequence
"Yields an infinite sequence of fibonacci numbers."
 ^ Generator on: [ :generator |
| a b |
a := 0. b := 1.
[ a := b + (b := a).
  generator yield: a ]
repeat ]

with non-inlined repeat:
pushLit: Generator
closureNumCopied: 0 numArgs: 1 bytes 34 to 72
pushConstant: nil
push: (Array new: 2)
popIntoTemp: 1
pushConstant: 0
popIntoTemp: 0 inVectorAt: 1
pushConstant: 1
popIntoTemp: 1 inVectorAt: 1
pushTemp: 0
pushTemp: 1
closureNumCopied: 2 numArgs: 0 bytes 52 to 70
pushTemp: 1 inVectorAt: 1
pushTemp: 0 inVectorAt: 1
storeIntoTemp: 1 inVectorAt: 1
send: #+ (1 arg)
popIntoTemp: 0 inVectorAt: 1
pushTemp: 0
pushTemp: 0 inVectorAt: 1
send: #yield: (1 arg)
blockReturn
send: #repeat (0 args)
blockReturn
send: #on: (1 arg)
returnTop

with inlined repeat:
pushLit: Generator
closureNumCopied: 0 numArgs: 1 bytes 34 to 53
pushConstant: nil
pushConstant: nil
pushConstant: 0
popIntoTemp: 1
pushConstant: 1
popIntoTemp: 2
L1:
pushTemp: 2
pushTemp: 1
storeIntoTemp: 2
send: #+ (1 arg)
popIntoTemp: 1
pushTemp: 0
pushTemp: 1
send: #yield: (1 arg)
pop
jumpTo: L1
pushConstant: nil
blockReturn
send: #on: (1 arg)
returnTop


will cause the decompiler to fail horribly if the non-inlined result is
decompiled with Compiler-nice.186 installed.  The fix is merely to recompile
it (and other senders of #repeat).  The underlying problem is that if the is
given temp names via a schematicTempNamesString then that string must match
the temps in the method, and in the above if repeat is not inlined a and b
are remote, and hence the schematicTempNamesString is [generator (a b)] but
if repeat is inlined then they are local and the schematicTempNamesString is
[generator a b].

BTW, kudos to Nicholas for the newParser/newCompiler changes!

best
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20110331/2d192e8f/attachment.htm


More information about the Squeak-dev mailing list