[squeak-dev] (EventSensor>>#eventTickler) decompile bug

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue Mar 2 22:17:00 UTC 2010


I think I narrowed a bit the offending code:

eventTickler2
	"For debugging Decompiler"
	[| delta |
	[delta := true] yourself.
	delta ] whileTrue.

(EventSensor>>#eventTickler2) decompile
 eventTickler2
	[[_r1 := true] yourself.
	_r1] whileTrue


17 <8A 01> push: (Array new: 1)
19 <68> popIntoTemp: 0
20 <10> pushTemp: 0
21 <8F 10 00 05> closureNumCopied: 1 numArgs: 0 bytes 25 to 29
25 	<71> pushConstant: true
26 	<8D 00 00> storeIntoTemp: 0 inVectorAt: 0
29 	<7D> blockReturn
30 <D0> send: yourself
31 <87> pop
32 <8C 00 00> pushTemp: 0 inVectorAt: 0
35 <99> jumpFalse: 38
36 <A3 EB> jumpTo: 17
38 <78> returnSelf


All is well untill Decompiler tries to interpret instruction 35 <99>
jumpFalse: 38
We enter Decompiler>>#jump:if:
...snip...
	"if jump goes back, then it's a loop"
	thenJump < elseStart
		ifTrue:
			["Must be a while loop...
			  thenJump will jump to the beginning of the while expr.  In the
case of while's
			  with a block in the condition, the while expr should include more than just
			  the last expression: find all the statements needed by re-decompiling."
			stack := saveStack.
			pc := thenJump.
			blockBody := self statementsTo: elsePc.
We go back and reinterpret what we already interpreted... But this
time we already get a RemoteTempVectorNode in the tempVars...
And we are gonna create a RemoteTempVectorNode  on a
RemoteTempVectorNode next time we interpret the closure byte code 17
<8A 01> push: (Array new: 1)...
So the second pass will decompile _r1 instead of t1...

I don't feel like correcting the monster  Decompiler>>#jump:if:
Maybe I will just set a tweak in RemoteTempVectorNode creation...

Nicolas



More information about the Squeak-dev mailing list