[squeak-dev] Bug in BytecodeGenerator>>#jump:if:

André Wendt andre.wendt at hpi.uni-potsdam.de
Sun Jun 22 10:54:32 UTC 2008


Hi all,

apologies if this doesn't belong here. Mantis is a usability-nightmare
and I didn't know where else to report a bug in the NewCompiler. The
corresponding ML on squeakfoundation.org hasn't been posted to in over
six months.

I've noticed that BytecodeGenerator>>#jump:if: has a bug when given a
distance >= 1024.

It states

hi := distance // 256.

and then goes on checking if hi < 8. If that's false, the jump is
assumed to be too big. However, the check should be hi < 4.

Assume the method gets an argument of 1024, and hi is 4. The following

self nextPut: (Bytecodes at: #longJumpIfFalse) first + hi.

generates bytecode 176, which is an arithmetic message send instead of a
conditional jump.

I've attached a changeset that checks both jump conditions for hi < 4.

Regards,
André
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BytecodeGenerator.awe.1.cs
Type: text/x-csharp
Size: 830 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080622/0f001823/BytecodeGenerator.awe.1.bin


More information about the Squeak-dev mailing list