[CS] VmBugDemonstration - an apparent bug in the 3.2 VM!

Bob Arning arning at charm.net
Fri Jun 14 14:35:33 UTC 2002


Chris,

The bug you observed in ...

"Run this code, it will halt just before it values the two-argument block specified here.  Observe, once inside the block, that the variable assignments are 'shifted'."

	| demo |
	demo _ VmBugDemo new 
		req: (1 to: 10) asByteArray;
		res: (1 to: 10) asByteArray.
	^ demo
		test: [:aReq :aRes | 
			| myTemp |
			myTemp _ 5.
			Transcript cr; show: myTemp printString.
			(aRes copyFrom: 1 to: myTemp) reverse ]

is not a VM bug, but is a debugger/decompiler problem. When you run this code as a doit and then see it in a debugger, you are seeing something that has been decompiled. During that decompilation, <myTemp> appears to be a method temp rather than a block temp since the CompiledMethod does not remember the distinction. As a result it assumes <myTemp> is in a different slot than it actually is. You can work around this by either

1 - putting the above code in a method and running that method. This will preserve the source so the decompiler will make the right choice.
2 - making <myTemp> a method temp rather than a block temp.

Cheers,
Bob



More information about the Squeak-dev mailing list