[squeak-dev] Unexpected (de)compiler behaviour
Aran Lunzer
aranlunzer at gmail.com
Thu May 10 23:17:11 UTC 2012
Hi
I've found a simple message sequence that the decompiler doesn't
handle correctly. It looks as if it might be due to an odd choice of
bytecode by the compiler.
The original method (meaningless, but what the hey):
sqTest
^55 to: 56 do: [ :i | self ]
--
The generated byte codes:
25 <20> pushConstant: 55
26 <81 40> storeIntoTemp: 0
28 <10> pushTemp: 0
29 <21> pushConstant: 56
30 <B4> send: <=
31 <9D> jumpFalse: 38
32 <10> pushTemp: 0
33 <76> pushConstant: 1
34 <B0> send: +
35 <68> popIntoTemp: 0
36 <A3 F6> jumpTo: 28
38 <7C> returnTop
--
The decompilation:
sqTest
| i |
[i <= 56]
whileTrue: [i := i + 1].
^ i := 55
--
...in which the loop-variable initialisation "i := 55" happens,
unhelpfully, after the end of the loop. As far as I can make out,
this behaviour of the decompiler is due to the stack not being empty
at the end of the method. This in turn is because the second
instruction is storeIntoTemp: rather than popIntoTemp:
Looks like this could be straightforward to fix, for someone who knows
the compiler code...
All the best -
Aran
--
Aran Lunzer
Viewpoints Research Institute
More information about the Squeak-dev
mailing list
|