[Vm-dev] VM Maker: VMMaker.oscog-eem.2658.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Jan 10 05:55:51 UTC 2020
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2658.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2658
Author: eem
Time: 9 January 2020, 9:55:28.591616 pm
UUID: b536e0cb-6717-41f5-886d-9e11b5bb3e19
Ancestors: VMMaker.oscog-eem.2657
Cogit: Fix a few Slang complaints.
=============== Diff against VMMaker.oscog-eem.2657 ===============
Item was changed:
----- Method: CogObjectRepresentation>>genSmallIntegerComparison:orDoubleComparison:invert: (in category 'primitive generators') -----
genSmallIntegerComparison: jumpOpcode orDoubleComparison: jumpFPOpcodeGenerator invert: invertComparison
"Stack looks like
return address"
| jumpNonInt jumpFail jumpCond r |
<var: #jumpFPOpcodeGenerator declareC: 'AbstractInstruction * NoDbgRegParms (*jumpFPOpcodeGenerator)(void *)'>
- <var: #jumpNonInt type: #'AbstractInstruction *'>
- <var: #jumpCond type: #'AbstractInstruction *'>
- <var: #jumpFail type: #'AbstractInstruction *'>
r := self genSmallIntegerComparison: jumpOpcode.
r < 0 ifTrue:
[^r].
self cppIf: #DPFPReg0 defined ifTrue:
"Fall through on non-SmallInteger argument. Argument may be a Float : let us check or fail"
[self smallIntegerIsOnlyImmediateType ifFalse:
[jumpNonInt := self genJumpImmediate: Arg0Reg].
self genGetCompactClassIndexNonImmOf: Arg0Reg into: SendNumArgsReg.
self genCmpClassFloatCompactIndexR: SendNumArgsReg.
jumpFail := cogit JumpNonZero: 0.
"It was a Float, so convert the receiver to double and perform the operation"
self genConvertSmallIntegerToIntegerInReg: ReceiverResultReg.
cogit ConvertR: ReceiverResultReg Rd: DPFPReg0.
self genGetDoubleValueOf: Arg0Reg into: DPFPReg1.
invertComparison "May need to invert for NaNs"
ifTrue: [cogit CmpRd: DPFPReg0 Rd: DPFPReg1]
ifFalse: [cogit CmpRd: DPFPReg1 Rd: DPFPReg0].
jumpCond := cogit perform: jumpFPOpcodeGenerator with: 0. "FP jumps are a little weird"
cogit genMoveFalseR: ReceiverResultReg.
cogit genPrimReturn.
jumpCond jmpTarget: (cogit genMoveTrueR: ReceiverResultReg).
cogit genPrimReturn.
self smallIntegerIsOnlyImmediateType
ifTrue: [jumpFail jmpTarget: cogit Label]
ifFalse: [jumpNonInt jmpTarget: (jumpFail jmpTarget: cogit Label)]].
^CompletePrimitive!
Item was changed:
----- Method: CogObjectRepresentationFor64BitSpur>>genSmallIntegerComparison:orDoubleComparison:invert: (in category 'primitive generators') -----
genSmallIntegerComparison: jumpOpcode orDoubleComparison: jumpFPOpcodeGenerator invert: invertComparison
"Stack looks like
return address"
| jumpCond r compareIntFloat jumpAmbiguous jumpNotBoxedFloat jumpNotFloatAtAll jumpNotSmallFloat jumpTrue returnTrue |
<var: #jumpFPOpcodeGenerator declareC: 'AbstractInstruction * NoDbgRegParms (*jumpFPOpcodeGenerator)(void *)'>
- <var: #jumpNonInt type: #'AbstractInstruction *'>
- <var: #jumpCond type: #'AbstractInstruction *'>
- <var: #jumpTrue type: #'AbstractInstruction *'>
- <var: #returnTrue type: #'AbstractInstruction *'>
- <var: #jumpAmbiguous type: #'AbstractInstruction *'>
- <var: #jumpNotBoxedFloat type: #'AbstractInstruction *'>
- <var: #jumpNotSmallFloat type: #'AbstractInstruction *'>
- <var: #jumpNotFloatAtAll type: #'AbstractInstruction *'>
- <var: #compareIntFloat type: #'AbstractInstruction *'>
r := self genSmallIntegerComparison: jumpOpcode.
r < 0 ifTrue:
[^r].
self cppIf: #DPFPReg0 defined ifTrue:
"Fall through on non-SmallInteger argument. Argument may be a Float : let us check or fail"
[
"check for Small Float argument"
jumpNotSmallFloat := self genJumpNotSmallFloat: Arg0Reg.
self genGetSmallFloatValueOf: Arg0Reg scratch: TempReg into: DPFPReg1.
"Case of (int compare: float). Test for ambiguity, that is when (double) intRcvr == floatArg"
compareIntFloat := cogit Label.
self genConvertSmallIntegerToIntegerInReg: ReceiverResultReg.
cogit ConvertR: ReceiverResultReg Rd: DPFPReg0.
cogit CmpRd: DPFPReg0 Rd: DPFPReg1.
jumpAmbiguous := cogit perform: #JumpFPEqual: with: 0.
"Case of non ambiguity, use compareFloat((double) intRcvr,floatArg)"
invertComparison "May need to invert for NaNs"
ifTrue: [cogit CmpRd: DPFPReg0 Rd: DPFPReg1]
ifFalse: [cogit CmpRd: DPFPReg1 Rd: DPFPReg0].
jumpCond := cogit perform: jumpFPOpcodeGenerator with: 0. "FP jumps are a little weird"
cogit genMoveFalseR: ReceiverResultReg.
cogit genPrimReturn.
jumpCond jmpTarget: (returnTrue := cogit genMoveTrueR: ReceiverResultReg).
cogit genPrimReturn.
"Case of ambiguity, use compareInt(intRcvr , (int64) floatArg)"
jumpAmbiguous jmpTarget: (cogit ConvertRd: DPFPReg1 R: Arg0Reg).
cogit CmpR: Arg0Reg R: ReceiverResultReg. "N.B. FLAGS := RRReg - Arg0Reg"
jumpTrue := cogit genConditionalBranch: jumpOpcode operand: 0.
cogit genMoveFalseR: ReceiverResultReg.
cogit genPrimReturn.
jumpTrue jmpTarget: returnTrue.
"not a Small Float, check for Boxed Float argument"
jumpNotSmallFloat jmpTarget:cogit Label.
jumpNotFloatAtAll := self genJumpImmediate: Arg0Reg.
self genGetCompactClassIndexNonImmOf: Arg0Reg into: SendNumArgsReg.
self genCmpClassFloatCompactIndexR: SendNumArgsReg.
jumpNotBoxedFloat := cogit JumpNonZero: 0.
"It was a Boxed Float, so convert the receiver to double and perform the (int compare: float) operation"
self genGetDoubleValueOf: Arg0Reg into: DPFPReg1.
cogit Jump: compareIntFloat.
"not a Float, just let the primitive fall thru failure"
jumpNotBoxedFloat jmpTarget: (jumpNotFloatAtAll jmpTarget: cogit Label)].
^CompletePrimitive!
More information about the Vm-dev
mailing list