VM Maker: VMMaker.oscog-nice.2538.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscog-nice.2538.mcz

commits-2
 
Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-nice.2538.mcz

==================== Summary ====================

Name: VMMaker.oscog-nice.2538
Author: nice
Time: 21 August 2019, 3:11:12.709148 am
UUID: 17ab23da-439b-4e4d-a5e2-67db83a15cb4
Ancestors: VMMaker.oscog-nice.2537

Partial fix for bug https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/417

it remains to fix SmallInteger op: BoxedFloat64
Note that SmallInteger op: SmallFloat64 is not covered by jitted code, it should.

We should also improve the non jitted primitives with same trick, and generate this kind of comparison:

if ( (double) si == sf ) return si <= (int64) sf;
else return (double) si <= sf;

=============== Diff against VMMaker.oscog-nice.2537 ===============

Item was changed:
  ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatEqual (in category 'primitive generators') -----
  genPrimitiveSmallFloatEqual
  <option: #Spur64BitMemoryManager>
+ ^self genSmallFloatComparison: #JumpFPEqual: orIntegerComparison: JumpZero invert: false!
- ^self genSmallFloatComparison: #JumpFPEqual: invert: false!

Item was changed:
  ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatGreaterOrEqual (in category 'primitive generators') -----
  genPrimitiveSmallFloatGreaterOrEqual
  <option: #Spur64BitMemoryManager>
+ ^self genSmallFloatComparison: #JumpFPGreaterOrEqual: orIntegerComparison: JumpGreaterOrEqual invert: false!
- ^self genSmallFloatComparison: #JumpFPGreaterOrEqual: invert: false!

Item was changed:
  ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatGreaterThan (in category 'primitive generators') -----
  genPrimitiveSmallFloatGreaterThan
  <option: #Spur64BitMemoryManager>
+ ^self genSmallFloatComparison: #JumpFPGreater: orIntegerComparison: JumpGreater invert: false!
- ^self genSmallFloatComparison: #JumpFPGreater: invert: false!

Item was changed:
  ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatLessOrEqual (in category 'primitive generators') -----
  genPrimitiveSmallFloatLessOrEqual
  <option: #Spur64BitMemoryManager>
+ ^self genSmallFloatComparison: #JumpFPGreaterOrEqual: orIntegerComparison: JumpLessOrEqual invert: true!
- ^self genSmallFloatComparison: #JumpFPGreaterOrEqual: invert: true!

Item was changed:
  ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatLessThan (in category 'primitive generators') -----
  genPrimitiveSmallFloatLessThan
  <option: #Spur64BitMemoryManager>
+ ^self genSmallFloatComparison: #JumpFPGreater: orIntegerComparison: JumpLess invert: true!
- ^self genSmallFloatComparison: #JumpFPGreater: invert: true!

Item was changed:
  ----- Method: CogObjectRepresentation>>genPrimitiveSmallFloatNotEqual (in category 'primitive generators') -----
  genPrimitiveSmallFloatNotEqual
  <option: #Spur64BitMemoryManager>
+ ^self genSmallFloatComparison: #JumpFPNotEqual: orIntegerComparison: JumpNonZero invert: false!
- ^self genSmallFloatComparison: #JumpFPNotEqual: invert: false!

Item was removed:
- ----- Method: CogObjectRepresentationFor64BitSpur>>genDoubleComparison:invert: (in category 'primitive generators') -----
- genDoubleComparison: jumpOpcodeGenerator invert: invertComparison
- <inline: true>
- ^self genFloatComparison: jumpOpcodeGenerator invert: invertComparison boxed: true!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>genDoubleComparison:orIntegerComparison:invert: (in category 'primitive generators') -----
+ genDoubleComparison: jumpOpcodeGenerator orIntegerComparison: jumpOpcode invert: invertComparison
+ <inline: true>
+ ^self genFloatComparison: jumpOpcodeGenerator orIntegerComparison: jumpOpcode invert: invertComparison boxed: true!

Item was removed:
- ----- Method: CogObjectRepresentationFor64BitSpur>>genFloatComparison:invert:boxed: (in category 'primitive generators') -----
- genFloatComparison: jumpOpcodeGenerator invert: invertComparison boxed: rcvrBoxed
- <var: #jumpOpcodeGenerator declareC: 'AbstractInstruction *(*jumpOpcodeGenerator)(void *)'>
- <inline: false>
- | jumpImmediate jumpNotSmallFloat jumpNotSmallInteger jumpNotBoxedFloat jumpCond compare |
- <var: #jumpNotSmallInteger type: #'AbstractInstruction *'>
- <var: #jumpNotBoxedFloat type: #'AbstractInstruction *'>
- <var: #jumpNotSmallFloat type: #'AbstractInstruction *'>
- <var: #jumpImmediate type: #'AbstractInstruction *'>
- <var: #jumpCond type: #'AbstractInstruction *'>
- cogit genLoadArgAtDepth: 0 into: Arg0Reg.
- rcvrBoxed
- ifTrue: [self genGetDoubleValueOf: ReceiverResultReg into: DPFPReg0]
- ifFalse: [self genGetSmallFloatValueOf: ReceiverResultReg scratch: TempReg into: DPFPReg0].
- jumpNotSmallFloat := self genJumpNotSmallFloat: Arg0Reg.
- self genGetSmallFloatValueOf: Arg0Reg scratch: TempReg into: DPFPReg1.
- compare := invertComparison "May need to invert for NaNs"
- ifTrue: [cogit CmpRd: DPFPReg0 Rd: DPFPReg1]
- ifFalse: [cogit CmpRd: DPFPReg1 Rd: DPFPReg0].
- jumpCond := cogit perform: jumpOpcodeGenerator with: 0. "FP jumps are a little weird"
- cogit genMoveFalseR: ReceiverResultReg.
- cogit genPrimReturn.
- jumpCond jmpTarget: (cogit genMoveTrueR: ReceiverResultReg).
- cogit genPrimReturn.
- jumpNotSmallFloat jmpTarget: cogit Label.
- jumpNotSmallInteger := self genJumpNotSmallInteger: Arg0Reg.
- self genConvertSmallIntegerToIntegerInReg: Arg0Reg.
- cogit ConvertR: Arg0Reg Rd: DPFPReg1.
- cogit Jump: compare.
- jumpNotSmallInteger jmpTarget: cogit Label.
- jumpImmediate := self genJumpImmediate: Arg0Reg.
- self genGetCompactClassIndexNonImmOf: Arg0Reg into: SendNumArgsReg.
- self genCmpClassFloatCompactIndexR: SendNumArgsReg.
- jumpNotBoxedFloat := cogit JumpNonZero: 0.
- self genGetDoubleValueOf: Arg0Reg into: DPFPReg1.
- cogit Jump: compare.
- jumpImmediate jmpTarget:
- (jumpNotBoxedFloat jmpTarget: cogit Label).
- ^CompletePrimitive!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>genFloatComparison:orIntegerComparison:invert:boxed: (in category 'primitive generators') -----
+ genFloatComparison: jumpOpcodeGenerator orIntegerComparison: jumpOpcode invert: invertComparison boxed: rcvrBoxed
+ <var: #jumpOpcodeGenerator declareC: 'AbstractInstruction *(*jumpOpcodeGenerator)(void *)'>
+ <inline: false>
+ | jumpImmediate jumpNotSmallFloat jumpNotSmallInteger jumpNotBoxedFloat jumpCond compareFloat jumpEqual jumpTrue returnTrue |
+ <var: #jumpNotSmallInteger type: #'AbstractInstruction *'>
+ <var: #jumpNotBoxedFloat type: #'AbstractInstruction *'>
+ <var: #jumpNotSmallFloat type: #'AbstractInstruction *'>
+ <var: #jumpImmediate type: #'AbstractInstruction *'>
+ <var: #jumpCond type: #'AbstractInstruction *'>
+ cogit genLoadArgAtDepth: 0 into: Arg0Reg.
+ rcvrBoxed
+ ifTrue: [self genGetDoubleValueOf: ReceiverResultReg into: DPFPReg0]
+ ifFalse: [self genGetSmallFloatValueOf: ReceiverResultReg scratch: TempReg into: DPFPReg0].
+ jumpNotSmallFloat := self genJumpNotSmallFloat: Arg0Reg.
+ self genGetSmallFloatValueOf: Arg0Reg scratch: TempReg into: DPFPReg1.
+ compareFloat := invertComparison "May need to invert for NaNs"
+ ifTrue: [cogit CmpRd: DPFPReg0 Rd: DPFPReg1]
+ ifFalse: [cogit CmpRd: DPFPReg1 Rd: DPFPReg0].
+ jumpCond := cogit perform: jumpOpcodeGenerator with: 0. "FP jumps are a little weird"
+ cogit genMoveFalseR: ReceiverResultReg.
+ cogit genPrimReturn.
+ jumpCond jmpTarget: (returnTrue := cogit genMoveTrueR: ReceiverResultReg).
+ cogit genPrimReturn.
+
+ jumpNotSmallFloat jmpTarget: cogit Label.
+ jumpNotSmallInteger := self genJumpNotSmallInteger: Arg0Reg.
+ self genConvertSmallIntegerToIntegerInReg: Arg0Reg.
+ cogit ConvertR: Arg0Reg Rd: DPFPReg1.
+ cogit CmpRd: DPFPReg0 Rd: DPFPReg1.
+ "If floatRcvr == (double) intArg then use compareInt(intArg,(int64) floatRcvr)"
+ "else use compareFloat(floatRcvr,(double) intArg)"
+ jumpEqual := cogit perform: #JumpFPEqual: with: 0.
+ cogit Jump: compareFloat.
+ jumpEqual jmpTarget: (cogit ConvertRd: DPFPReg0 R: ReceiverResultReg).
+ cogit CmpR: Arg0Reg R: ReceiverResultReg. "N.B. FLAGS := RRReg - Arg0Reg"
+ jumpTrue := cogit genConditionalBranch: jumpOpcode operand: 0.
+ cogit genMoveFalseR: ReceiverResultReg.
+ cogit genPrimReturn.
+ jumpTrue jmpTarget: returnTrue.
+
+ jumpNotSmallInteger jmpTarget: cogit Label.
+ jumpImmediate := self genJumpImmediate: Arg0Reg.
+ self genGetCompactClassIndexNonImmOf: Arg0Reg into: SendNumArgsReg.
+ self genCmpClassFloatCompactIndexR: SendNumArgsReg.
+ jumpNotBoxedFloat := cogit JumpNonZero: 0.
+ self genGetDoubleValueOf: Arg0Reg into: DPFPReg1.
+ cogit Jump: compareFloat.
+ jumpImmediate jmpTarget:
+ (jumpNotBoxedFloat jmpTarget: cogit Label).
+ ^CompletePrimitive!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatEqual (in category 'primitive generators') -----
+ genPrimitiveFloatEqual
+ <option: #DPFPReg0>
+ ^self genDoubleComparison: #JumpFPEqual: orIntegerComparison: JumpZero invert: false!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatGreaterOrEqual (in category 'primitive generators') -----
+ genPrimitiveFloatGreaterOrEqual
+ <option: #DPFPReg0>
+ ^self genDoubleComparison: #JumpFPGreaterOrEqual: orIntegerComparison: JumpGreaterOrEqual invert: false!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatGreaterThan (in category 'primitive generators') -----
+ genPrimitiveFloatGreaterThan
+ <option: #DPFPReg0>
+ ^self genDoubleComparison: #JumpFPGreater: orIntegerComparison: JumpGreater invert: false!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatLessOrEqual (in category 'primitive generators') -----
+ genPrimitiveFloatLessOrEqual
+ <option: #DPFPReg0>
+ ^self genDoubleComparison: #JumpFPGreaterOrEqual: orIntegerComparison: JumpLessOrEqual invert: true!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatLessThan (in category 'primitive generators') -----
+ genPrimitiveFloatLessThan
+ <option: #DPFPReg0>
+ ^self genDoubleComparison: #JumpFPGreater: orIntegerComparison: JumpLess invert: true!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveFloatNotEqual (in category 'primitive generators') -----
+ genPrimitiveFloatNotEqual
+ <option: #DPFPReg0>
+ ^self genDoubleComparison: #JumpFPNotEqual: orIntegerComparison: JumpNonZero invert: false!

Item was removed:
- ----- Method: CogObjectRepresentationFor64BitSpur>>genSmallFloatComparison:invert: (in category 'primitive generators') -----
- genSmallFloatComparison: jumpOpcodeGenerator invert: invertComparison
- <inline: true>
- ^self genFloatComparison: jumpOpcodeGenerator invert: invertComparison boxed: false!

Item was added:
+ ----- Method: CogObjectRepresentationFor64BitSpur>>genSmallFloatComparison:orIntegerComparison:invert: (in category 'primitive generators') -----
+ genSmallFloatComparison: jumpOpcodeGenerator orIntegerComparison: jumpOpcode invert: invertComparison
+ <inline: true>
+ ^self genFloatComparison: jumpOpcodeGenerator orIntegerComparison: jumpOpcode invert: invertComparison boxed: false!