Nicolas Cellier uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-nice.2550.mcz ==================== Summary ==================== Name: VMMaker.oscog-nice.2550 Author: nice Time: 5 September 2019, 11:32:10.856709 pm UUID: 030a2cfe-8bbc-421e-bf8f-b2e0696d4ff2 Ancestors: VMMaker.oscog-nice.2548 2 things: 1) fix generateCheckLZCNT on X64 because MoveCw:R: causes an assertion failure at startup (maxSize=7 < machineCodeSize=11) - I don't understand MoveCw:R:, use MoveCq:R: instead 2) be Simulator friendly by sending messages to objectMemory/coInterpreter/ or whoever shall understand Note that this commit replace VMMaker.oscog-nice.2540 which should be deleted Indeed, Float comparison are tricky: The operator < (jb jump below) test for the carry flag (CF) like a jc, but this carry flag is also set when comparison is unordered !!! So we must first test the case of unordered, which also set (PF) with a jp. This is not necessary when using operators > (above) we can just ja (whicj is a jnc, case of unordered will set the carry and thus answer false). By transforming < into >, we avoid a JP conditional jump. Clever! =============== Diff against VMMaker.oscog-nice.2548 =============== Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveEqual (in category 'primitive generators') ----- genPrimitiveEqual + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallIntegerComparison: JumpZero orDoubleComparison: #JumpFPEqual: invert: false] ifFalse: [self genSmallIntegerComparison: JumpZero]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatAdd (in category 'primitive generators') ----- genPrimitiveFloatAdd <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleArithmetic: AddRdRd preOpCheck: nil] ifFalse: [self genPureDoubleArithmetic: AddRdRd preOpCheck: nil]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatDivide (in category 'primitive generators') ----- genPrimitiveFloatDivide <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleArithmetic: DivRdRd preOpCheck: #genDoubleFailIfZeroArgRcvr:arg:] ifFalse: [self genPureDoubleArithmetic: DivRdRd preOpCheck: #genDoubleFailIfZeroArgRcvr:arg:]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatEqual (in category 'primitive generators') ----- genPrimitiveFloatEqual <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPEqual: invert: false] ifFalse: [self genPureDoubleComparison: #JumpFPEqual: invert: false]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatGreaterOrEqual (in category 'primitive generators') ----- genPrimitiveFloatGreaterOrEqual <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPGreaterOrEqual: invert: false] ifFalse: [self genPureDoubleComparison: #JumpFPGreaterOrEqual: invert: false]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatGreaterThan (in category 'primitive generators') ----- genPrimitiveFloatGreaterThan <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPGreater: invert: false] ifFalse: [self genPureDoubleComparison: #JumpFPGreater: invert: false]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatLessOrEqual (in category 'primitive generators') ----- genPrimitiveFloatLessOrEqual <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPGreaterOrEqual: invert: true] ifFalse: [self genPureDoubleComparison: #JumpFPGreaterOrEqual: invert: true]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatLessThan (in category 'primitive generators') ----- genPrimitiveFloatLessThan <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPGreater: invert: true] ifFalse: [self genPureDoubleComparison: #JumpFPGreater: invert: true]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatMultiply (in category 'primitive generators') ----- genPrimitiveFloatMultiply <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleArithmetic: MulRdRd preOpCheck: nil] ifFalse: [self genPureDoubleArithmetic: MulRdRd preOpCheck: nil]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatNotEqual (in category 'primitive generators') ----- genPrimitiveFloatNotEqual <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPNotEqual: invert: false] ifFalse: [self genPureDoubleComparison: #JumpFPNotEqual: invert: false]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveFloatSubtract (in category 'primitive generators') ----- genPrimitiveFloatSubtract <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleArithmetic: SubRdRd preOpCheck: nil] ifFalse: [self genPureDoubleArithmetic: SubRdRd preOpCheck: nil]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveGreaterOrEqual (in category 'primitive generators') ----- genPrimitiveGreaterOrEqual + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallIntegerComparison: JumpGreaterOrEqual orDoubleComparison: #JumpFPGreaterOrEqual: invert: false] ifFalse: [self genSmallIntegerComparison: JumpGreaterOrEqual]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveGreaterThan (in category 'primitive generators') ----- genPrimitiveGreaterThan + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallIntegerComparison: JumpGreater orDoubleComparison: #JumpFPGreater: invert: false] ifFalse: [self genSmallIntegerComparison: JumpGreater]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveLessOrEqual (in category 'primitive generators') ----- genPrimitiveLessOrEqual + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallIntegerComparison: JumpLessOrEqual orDoubleComparison: #JumpFPGreaterOrEqual: invert: true] ifFalse: [self genSmallIntegerComparison: JumpLessOrEqual]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveLessThan (in category 'primitive generators') ----- genPrimitiveLessThan + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallIntegerComparison: JumpLess orDoubleComparison: #JumpFPGreater: invert: true] ifFalse: [self genSmallIntegerComparison: JumpLess]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveNotEqual (in category 'primitive generators') ----- genPrimitiveNotEqual + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallIntegerComparison: JumpNonZero orDoubleComparison: #JumpFPNotEqual: invert: false] ifFalse: [self genSmallIntegerComparison: JumpNonZero]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatAdd (in category 'primitive generators') ----- genPrimitiveSmallFloatAdd <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatArithmetic: AddRdRd preOpCheck: nil] ifFalse: [self genPureSmallFloatArithmetic: AddRdRd preOpCheck: nil]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatDivide (in category 'primitive generators') ----- genPrimitiveSmallFloatDivide <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatArithmetic: DivRdRd preOpCheck: #genDoubleFailIfZeroArgRcvr:arg:] ifFalse: [self genPureSmallFloatArithmetic: DivRdRd preOpCheck: #genDoubleFailIfZeroArgRcvr:arg:]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatEqual (in category 'primitive generators') ----- genPrimitiveSmallFloatEqual <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatComparison: #JumpFPEqual: orIntegerComparison: JumpZero invert: false] ifFalse: [self genPureSmallFloatComparison: #JumpFPEqual: invert: false]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatGreaterOrEqual (in category 'primitive generators') ----- genPrimitiveSmallFloatGreaterOrEqual <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatComparison: #JumpFPGreaterOrEqual: orIntegerComparison: JumpGreaterOrEqual invert: false] ifFalse: [self genPureSmallFloatComparison: #JumpFPGreaterOrEqual: invert: false]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatGreaterThan (in category 'primitive generators') ----- genPrimitiveSmallFloatGreaterThan <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatComparison: #JumpFPGreater: orIntegerComparison: JumpGreater invert: false] ifFalse: [self genPureSmallFloatComparison: #JumpFPGreater: invert: false]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatLessOrEqual (in category 'primitive generators') ----- genPrimitiveSmallFloatLessOrEqual <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatComparison: #JumpFPGreaterOrEqual: orIntegerComparison: JumpLessOrEqual invert: true] ifFalse: [self genPureSmallFloatComparison: #JumpFPGreaterOrEqual: invert: true]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatLessThan (in category 'primitive generators') ----- genPrimitiveSmallFloatLessThan <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatComparison: #JumpFPGreater: orIntegerComparison: JumpLess invert: true] ifFalse: [self genPureSmallFloatComparison: #JumpFPGreater: invert: true]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatMultiply (in category 'primitive generators') ----- genPrimitiveSmallFloatMultiply <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatArithmetic: MulRdRd preOpCheck: nil] ifFalse: [self genPureSmallFloatArithmetic: MulRdRd preOpCheck: nil]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatNotEqual (in category 'primitive generators') ----- genPrimitiveSmallFloatNotEqual <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatComparison: #JumpFPNotEqual: orIntegerComparison: JumpNonZero invert: false] ifFalse: [self genPureSmallFloatComparison: #JumpFPNotEqual: invert: false]! Item was changed: ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatSubtract (in category 'primitive generators') ----- genPrimitiveSmallFloatSubtract <option: #Spur64BitMemoryManager> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genSmallFloatArithmetic: SubRdRd preOpCheck: nil] ifFalse: [self genPureSmallFloatArithmetic: SubRdRd preOpCheck: nil]! Item was changed: ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatEqual (in category 'primitive generators') ----- genPrimitiveFloatEqual <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPEqual: orIntegerComparison: JumpZero invert: false] ifFalse: [self genPureDoubleComparison: #JumpFPEqual: invert: false]! Item was changed: ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatGreaterOrEqual (in category 'primitive generators') ----- genPrimitiveFloatGreaterOrEqual <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPGreaterOrEqual: orIntegerComparison: JumpGreaterOrEqual invert: false] ifFalse: [self genPureDoubleComparison: #JumpFPGreaterOrEqual: invert: false]! Item was changed: ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatGreaterThan (in category 'primitive generators') ----- genPrimitiveFloatGreaterThan <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPGreater: orIntegerComparison: JumpGreater invert: false] ifFalse: [self genPureDoubleComparison: #JumpFPGreater: invert: false]! Item was changed: ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatLessOrEqual (in category 'primitive generators') ----- genPrimitiveFloatLessOrEqual <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPGreaterOrEqual: orIntegerComparison: JumpLessOrEqual invert: true] ifFalse: [self genPureDoubleComparison: #JumpFPGreaterOrEqual: invert: true]! Item was changed: ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatLessThan (in category 'primitive generators') ----- genPrimitiveFloatLessThan <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPGreater: orIntegerComparison: JumpLess invert: true] ifFalse: [self genPureDoubleComparison: #JumpFPGreater: invert: true]! Item was changed: ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatNotEqual (in category 'primitive generators') ----- genPrimitiveFloatNotEqual <option: #DPFPReg0> + ^coInterpreter getPrimitiveDoMixedArithmetic - ^self getPrimitiveDoMixedArithmetic ifTrue: [self genDoubleComparison: #JumpFPNotEqual: orIntegerComparison: JumpNonZero invert: false] ifFalse: [self genPureDoubleComparison: #JumpFPNotEqual: invert: false]! Item was changed: ----- Method: CogX64Compiler>>generateCheckLZCNT (in category 'feature detection') ----- generateCheckLZCNT "to check is Leading Zero Count operation is present cf. MSVC builtin __lzcnt documentation The result will be in bit 5 of return value (in RAX)" cogit PushR: RDX; PushR: RCX; PushR: RBX; + MoveCq: 16r80000001 R: RAX; - MoveCw: 16r80000001 R: RAX; gen: CPUID; MoveR: RCX R: RAX; PopR: RBX; PopR: RCX; PopR: RDX; RetN: 0! Item was changed: ----- Method: InterpreterPrimitives>>primitiveSmallFloatEqual (in category 'arithmetic float primitives') ----- primitiveSmallFloatEqual <option: #Spur64BitMemoryManager> | rcvr arg intArg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory smallFloatValueOf: (self stackValue: 1). arg := objectMemory loadFloatOrIntFrom: self stackTop. self successful ifTrue: [self cppIf: objectMemory wordSize > 4 + ifTrue: [((objectMemory isIntegerObject: self stackTop) and: [rcvr = arg]) - ifTrue: [((self isIntegerObject: self stackTop) and: [rcvr = arg]) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + intArg := objectMemory integerValueOf: self stackTop. - intArg := self integerValueOf: self stackTop. self pop: 2 thenPushBool: rcvr asInteger = intArg] ifFalse: [self pop: 2 thenPushBool: rcvr = arg]] ifFalse: [self pop: 2 thenPushBool: rcvr = arg]]! Item was changed: ----- Method: InterpreterPrimitives>>primitiveSmallFloatGreaterOrEqual (in category 'arithmetic float primitives') ----- primitiveSmallFloatGreaterOrEqual <option: #Spur64BitMemoryManager> | rcvr arg intArg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory smallFloatValueOf: (self stackValue: 1). arg := objectMemory loadFloatOrIntFrom: self stackTop. self successful ifTrue: [self cppIf: objectMemory wordSize > 4 + ifTrue: [((objectMemory isIntegerObject: self stackTop) and: [rcvr = arg]) - ifTrue: [((self isIntegerObject: self stackTop) and: [rcvr = arg]) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + intArg := objectMemory integerValueOf: self stackTop. - intArg := self integerValueOf: self stackTop. self pop: 2 thenPushBool: rcvr asInteger >= intArg] ifFalse: [self pop: 2 thenPushBool: rcvr >= arg]] ifFalse: [self pop: 2 thenPushBool: rcvr >= arg]]! Item was changed: ----- Method: InterpreterPrimitives>>primitiveSmallFloatGreaterThan (in category 'arithmetic float primitives') ----- primitiveSmallFloatGreaterThan <option: #Spur64BitMemoryManager> | rcvr arg intArg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory smallFloatValueOf: (self stackValue: 1). arg := objectMemory loadFloatOrIntFrom: self stackTop. self successful ifTrue: [self cppIf: objectMemory wordSize > 4 + ifTrue: [((objectMemory isIntegerObject: self stackTop) and: [rcvr = arg]) - ifTrue: [((self isIntegerObject: self stackTop) and: [rcvr = arg]) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + intArg := objectMemory integerValueOf: self stackTop. - intArg := self integerValueOf: self stackTop. self pop: 2 thenPushBool: rcvr asInteger > intArg] ifFalse: [self pop: 2 thenPushBool: rcvr > arg]] ifFalse: [self pop: 2 thenPushBool: rcvr > arg]]! Item was changed: ----- Method: InterpreterPrimitives>>primitiveSmallFloatLessOrEqual (in category 'arithmetic float primitives') ----- primitiveSmallFloatLessOrEqual <option: #Spur64BitMemoryManager> | rcvr arg intArg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory smallFloatValueOf: (self stackValue: 1). arg := objectMemory loadFloatOrIntFrom: self stackTop. self successful ifTrue: [self cppIf: objectMemory wordSize > 4 + ifTrue: [((objectMemory isIntegerObject: self stackTop) and: [rcvr = arg]) - ifTrue: [((self isIntegerObject: self stackTop) and: [rcvr = arg]) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + intArg := objectMemory integerValueOf: self stackTop. - intArg := self integerValueOf: self stackTop. self pop: 2 thenPushBool: rcvr asInteger <= intArg] ifFalse: [self pop: 2 thenPushBool: rcvr <= arg]] ifFalse: [self pop: 2 thenPushBool: rcvr <= arg]]! Item was changed: ----- Method: InterpreterPrimitives>>primitiveSmallFloatLessThan (in category 'arithmetic float primitives') ----- primitiveSmallFloatLessThan <option: #Spur64BitMemoryManager> | rcvr arg intArg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory smallFloatValueOf: (self stackValue: 1). arg := objectMemory loadFloatOrIntFrom: self stackTop. self successful ifTrue: [self cppIf: objectMemory wordSize > 4 + ifTrue: [((objectMemory isIntegerObject: self stackTop) and: [rcvr = arg]) - ifTrue: [((self isIntegerObject: self stackTop) and: [rcvr = arg]) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + intArg := objectMemory integerValueOf: self stackTop. - intArg := self integerValueOf: self stackTop. self pop: 2 thenPushBool: rcvr asInteger < intArg] ifFalse: [self pop: 2 thenPushBool: rcvr < arg]] ifFalse: [self pop: 2 thenPushBool: rcvr < arg]]! Item was changed: ----- Method: InterpreterPrimitives>>primitiveSmallFloatNotEqual (in category 'arithmetic float primitives') ----- primitiveSmallFloatNotEqual <option: #Spur64BitMemoryManager> | rcvr arg intArg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory smallFloatValueOf: (self stackValue: 1). arg := objectMemory loadFloatOrIntFrom: self stackTop. self successful ifTrue: [self cppIf: objectMemory wordSize > 4 + ifTrue: [((objectMemory isIntegerObject: self stackTop) and: [rcvr = arg]) - ifTrue: [((self isIntegerObject: self stackTop) and: [rcvr = arg]) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + intArg := objectMemory integerValueOf: self stackTop. - intArg := self integerValueOf: self stackTop. self pop: 2 thenPushBool: (rcvr asInteger = intArg) not] ifFalse: [self pop: 2 thenPushBool: (rcvr = arg) not]] ifFalse: [self pop: 2 thenPushBool: (rcvr = arg) not]]! Item was changed: ----- Method: Spur64BitMemoryManager>>loadFloatOrIntFrom: (in category 'interpreter access') ----- loadFloatOrIntFrom: floatOrIntOop "If floatOrInt is an integer and we enable mixed arithmetic in primitives, then convert it to a C double float and return it. If it is a Float, then load its value and return it. Otherwise fail -- ie return with primErrorCode non-zero." <inline: true> <returnTypeC: #double> | result tagBits | <var: #result type: #double> (tagBits := floatOrIntOop bitAnd: self tagMask) ~= 0 ifTrue: [tagBits = self smallFloatTag ifTrue: [^self smallFloatValueOf: floatOrIntOop]. + (coInterpreter primitiveDoMixedArithmetic and: [tagBits = self smallIntegerTag]) ifTrue: - (self primitiveDoMixedArithmetic and: [tagBits = self smallIntegerTag]) ifTrue: [^(self integerValueOf: floatOrIntOop) asFloat]] ifFalse: [(self classIndexOf: floatOrIntOop) = ClassFloatCompactIndex ifTrue: [self cCode: '' inSmalltalk: [result := Float new: 2]. self fetchFloatAt: floatOrIntOop + self baseHeaderSize into: result. ^result]]. coInterpreter primitiveFail. ^0.0! Item was changed: ----- Method: StackInterpreter>>primitiveFloatEqual:toArg: (in category 'comparison float primitives') ----- primitiveFloatEqual: rcvrOop toArg: argOop | rcvr arg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory loadFloatOrIntFrom: rcvrOop. arg := objectMemory loadFloatOrIntFrom: argOop. self cppIf: objectMemory wordSize > 4 ifTrue: [rcvr = arg ifTrue: + [(objectMemory isIntegerObject: argOop) - [(self isIntegerObject: argOop) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + ^ rcvr asInteger = (objectMemory integerValueOf: argOop)] + ifFalse: [(objectMemory isIntegerObject: rcvrOop) - ^ rcvr asInteger = (self integerValueOf: argOop)] - ifFalse: [(self isIntegerObject: rcvrOop) ifTrue: ["Same when used from bytecodePrim... note that rcvr and arg cannot be both integer (case is already handled)" + ^ (objectMemory integerValueOf: rcvrOop) = arg asInteger]]]]. - ^ (self integerValueOf: rcvrOop) = arg asInteger]]]]. ^rcvr = arg! Item was changed: ----- Method: StackInterpreter>>primitiveFloatGreater:thanArg: (in category 'comparison float primitives') ----- primitiveFloatGreater: rcvrOop thanArg: argOop | rcvr arg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory loadFloatOrIntFrom: rcvrOop. arg := objectMemory loadFloatOrIntFrom: argOop. self cppIf: objectMemory wordSize > 4 ifTrue: [rcvr = arg ifTrue: + [(objectMemory isIntegerObject: argOop) - [(self isIntegerObject: argOop) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + ^ rcvr asInteger > (objectMemory integerValueOf: argOop)] + ifFalse: [(objectMemory isIntegerObject: rcvrOop) - ^ rcvr asInteger > (self integerValueOf: argOop)] - ifFalse: [(self isIntegerObject: rcvrOop) ifTrue: ["Same when used from bytecodePrim... note that rcvr and arg cannot be both integer (case is already handled)" + ^ (objectMemory integerValueOf: rcvrOop) > arg asInteger]]]]. - ^ (self integerValueOf: rcvrOop) > arg asInteger]]]]. ^rcvr > arg! Item was changed: ----- Method: StackInterpreter>>primitiveFloatGreaterOrEqual:toArg: (in category 'comparison float primitives') ----- primitiveFloatGreaterOrEqual: rcvrOop toArg: argOop | rcvr arg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory loadFloatOrIntFrom: rcvrOop. arg := objectMemory loadFloatOrIntFrom: argOop. self cppIf: objectMemory wordSize > 4 ifTrue: [rcvr = arg ifTrue: + [(objectMemory isIntegerObject: argOop) - [(self isIntegerObject: argOop) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + ^ rcvr asInteger >= (objectMemory integerValueOf: argOop)] + ifFalse: [(objectMemory isIntegerObject: rcvrOop) - ^ rcvr asInteger >= (self integerValueOf: argOop)] - ifFalse: [(self isIntegerObject: rcvrOop) ifTrue: ["Same when used from bytecodePrim... note that rcvr and arg cannot be both integer (case is already handled)" + ^ (objectMemory integerValueOf: rcvrOop) >= arg asInteger]]]]. - ^ (self integerValueOf: rcvrOop) >= arg asInteger]]]]. ^rcvr >= arg! Item was changed: ----- Method: StackInterpreter>>primitiveFloatLess:thanArg: (in category 'comparison float primitives') ----- primitiveFloatLess: rcvrOop thanArg: argOop | rcvr arg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory loadFloatOrIntFrom: rcvrOop. arg := objectMemory loadFloatOrIntFrom: argOop. self cppIf: objectMemory wordSize > 4 ifTrue: [rcvr = arg ifTrue: + [(objectMemory isIntegerObject: argOop) - [(self isIntegerObject: argOop) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + ^ rcvr asInteger < (objectMemory integerValueOf: argOop)] + ifFalse: [(objectMemory isIntegerObject: rcvrOop) - ^ rcvr asInteger < (self integerValueOf: argOop)] - ifFalse: [(self isIntegerObject: rcvrOop) ifTrue: ["Same when used from bytecodePrim... note that rcvr and arg cannot be both integer (case is already handled)" + ^ (objectMemory integerValueOf: rcvrOop) < arg asInteger]]]]. - ^ (self integerValueOf: rcvrOop) < arg asInteger]]]]. ^rcvr < arg! Item was changed: ----- Method: StackInterpreter>>primitiveFloatLessOrEqual:toArg: (in category 'comparison float primitives') ----- primitiveFloatLessOrEqual: rcvrOop toArg: argOop | rcvr arg | <var: #rcvr type: #double> <var: #arg type: #double> rcvr := objectMemory loadFloatOrIntFrom: rcvrOop. arg := objectMemory loadFloatOrIntFrom: argOop. self cppIf: objectMemory wordSize > 4 ifTrue: [rcvr = arg ifTrue: + [(objectMemory isIntegerObject: argOop) - [(self isIntegerObject: argOop) ifTrue: ["Resolve case of ambiguity so as to have comparison of exact values" + ^ rcvr asInteger <= (objectMemory integerValueOf: argOop)] + ifFalse: [(objectMemory isIntegerObject: rcvrOop) - ^ rcvr asInteger <= (self integerValueOf: argOop)] - ifFalse: [(self isIntegerObject: rcvrOop) ifTrue: ["Same when used from bytecodePrim... note that rcvr and arg cannot be both integer (case is already handled)" + ^ (objectMemory integerValueOf: rcvrOop) <= arg asInteger]]]]. - ^ (self integerValueOf: rcvrOop) <= arg asInteger]]]]. ^rcvr <= arg! |
Free forum by Nabble | Edit this page |