On 02.05.2011 13:22, Igor Stasenko wrote:
On 2 May 2011 13:06, Henrik Sperre Johansen henrik.s.johansen@veloxit.no wrote:
On 02.05.2011 12:48, Igor Stasenko wrote:
Hmm.. that's really strange, because as far as i can see, the code there are the same:
(primitive: 3)
Interpreter>>primitiveLessThan | integerReceiver integerArgument | integerArgument := self popInteger. integerReceiver := self popInteger. self checkBooleanResult: integerReceiver< integerArgument
InterpreterPrimitives>>primitiveLessThan | integerReceiver integerArgument | integerArgument := self popInteger. integerReceiver := self popInteger. self checkBooleanResult: integerReceiver< integerArgument
and #popInteger also same (it fails if value on stack are not smallinteger). So, in Squeak VM comparison primitive also fails, which should lead to evaluating failure code.
Cog has translation methods for those primitives in cogit.c, see genSmallIntegerComparison.
So , i think the problem is, that #genSmallIntegerComparison: (and friends) generating code for comparing integers only and falls back to normal send when it fails, without attempting to use #primitiveFloatLess:thanArg: .
static sqInt genSmallIntegerComparison(sqInt jumpOpcode) { AbstractInstruction *jumpFail; AbstractInstruction *jumpTrue;
gMoveRR(Arg0Reg, TempReg); jumpFail = genJumpNotSmallIntegerInScratchReg(TempReg);
Assuming genJumpNotSmallIntegerInScratchReg is an accurate name, I'd say yes. :)
Cheers, Henry