InterpreterProxy>>signed64BitIntegerFor: badly broken
Andreas Raab
andreas.raab at gmx.de
Thu Jun 8 01:58:00 UTC 2006
Hi Guys -
I don't know if you ever used the above method but it's horribly,
horribly broken. I wrote a little test primitive (see below) that simply
used signed64BitIntegerFor(signed64BitValueOf(oop)) and then a loop like
here:
0 to: 63 do:[:i|
n := 1 bitShift: i.
(self test64BitInt: n) = n ifFalse:[self halt: i].
].
Starting from i = 31 Every. Last. Result. Is Wrong. Can you imagine?
It gets even better, since it's broken in different ways: For i=31 the
result is negated, for everything beyound 31 the resulting large integer
is non-normalized (and therefore not comparing correctly).
Any ideas?
- Andreas
PS. The primitive:
TestPlugin>>testSigned64BitInt
| oop |
self export: true.
interpreterProxy methodArgumentCount = 1
ifFalse:[^interpreterProxy primitiveFail].
oop := interpreterProxy stackValue: 0.
oop := interpreterProxy signed64BitIntegerFor: (interpreterProxy
signed64BitValueOf: oop).
interpreterProxy failed ifFalse:[
interpreterProxy pop: 2 thenPush: oop.
].
More information about the Vm-dev
mailing list