[Vm-dev] VM Maker: VMMaker.oscog-eem.1192.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Apr 14 17:30:53 UTC 2015
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1192.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1192
Author: eem
Time: 14 April 2015, 10:28:56.8 am
UUID: ab70bc3e-c6c7-4a3e-9b94-1a6d0c2dcbc9
Ancestors: VMMaker.oscog-eem.1191
Correct the in-line primitive SmallInteger
comparisons; CmpXR is confusing ;-)
=============== Diff against VMMaker.oscog-eem.1191 ===============
Item was changed:
----- Method: StackToRegisterMappingCogit>>genBinaryConstOpVarInlinePrimitive: (in category 'inline primitive generators') -----
genBinaryConstOpVarInlinePrimitive: prim
"Const op var version of binary inline primitives."
"SistaV1: 248 11111000 iiiiiiii mjjjjjjj Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1 means inlined primitive, no hard return after execution.
See EncoderForSistaV1's class comment and StackInterpreter>>#binaryInlinePrimitive:"
| ra val untaggedVal adjust |
ra := self allocateOneRegister.
self ssTop popToReg: ra.
self ssPop: 1.
val := self ssTop constant.
self ssPop: 1.
untaggedVal := val - objectMemory smallIntegerTag.
prim caseOf: {
"0 through 6, +, -, *, /, //, \\, quo:, SmallInteger op SmallInteger => SmallInteger, no overflow"
[0] -> [self AddCq: untaggedVal R: ra].
[1] -> [self MoveCq: val R: TempReg.
self SubR: ra R: TempReg.
objectRepresentation genAddSmallIntegerTagsTo: TempReg.
self MoveR: TempReg R: ra].
[2] -> [objectRepresentation genRemoveSmallIntegerTagsInScratchReg: ra.
self MoveCq: (objectMemory integerValueOf: val) R: TempReg.
self MulR: TempReg R: ra.
objectRepresentation genAddSmallIntegerTagsTo: ra].
"2016 through 2019, bitAnd:, bitOr:, bitXor, bitShift:, SmallInteger op SmallInteger => SmallInteger, no overflow"
"2032 through 2037, >, <, >=, <=. =, ~=, SmallInteger op SmallInteger => Boolean (flags?? then in jump bytecodes if ssTop is a flags value, just generate the instruction!!!!)"
+ "CmpCqR is SubRCq so everything is reversed, but because no CmpRCq things are reversed again and we invert the sense of the jumps."
[32] -> [ self CmpCq: val R: ra.
+ self genBinaryInlineComparison: JumpLessOrEqual opFalse: JumpGreater destReg: ra ].
- self genBinaryInlineComparison: JumpGreater opFalse: JumpLess destReg: ra ].
[33] -> [ self CmpCq: val R: ra.
+ self genBinaryInlineComparison: JumpGreaterOrEqual opFalse: JumpLess destReg: ra ].
- self genBinaryInlineComparison: JumpLess opFalse: JumpGreater destReg: ra ].
[34] -> [ self CmpCq: val R: ra.
+ self genBinaryInlineComparison: JumpLess opFalse: JumpGreaterOrEqual destReg: ra ].
- self genBinaryInlineComparison: JumpGreaterOrEqual opFalse: JumpLessOrEqual destReg: ra ].
[35] -> [ self CmpCq: val R: ra.
+ self genBinaryInlineComparison: JumpGreater opFalse: JumpLessOrEqual destReg: ra ].
- self genBinaryInlineComparison: JumpLessOrEqual opFalse: JumpGreaterOrEqual destReg: ra ].
[36] -> [ self CmpCq: val R: ra.
- self genBinaryInlineComparison: JumpZero opFalse: JumpNonZero destReg: ra ].
- [37] -> [ self CmpCq: val R: ra.
self genBinaryInlineComparison: JumpNonZero opFalse: JumpZero destReg: ra ].
+ [37] -> [ self CmpCq: val R: ra.
+ self genBinaryInlineComparison: JumpZero opFalse: JumpNonZero destReg: ra ].
"2064 through 2068, Pointer Object>>at:, Byte Object>>at:, Short16 Word Object>>at: LongWord32 Object>>at: Quad64Word Object>>at:. obj op 0-rel SmallInteger => oop"
[64] -> [objectRepresentation genConvertSmallIntegerToIntegerInReg: ra.
adjust := (objectMemory baseHeaderSize >> objectMemory shiftForWord) - 1. "shift by baseHeaderSize and then move from 1 relative to zero relative"
adjust ~= 0 ifTrue: [ self AddCq: adjust R: ra. ].
self annotate: (self MoveCw: val R: TempReg) objRef: val.
self MoveXwr: ra R: TempReg R: ra].
[65] -> [objectRepresentation genConvertSmallIntegerToIntegerInReg: ra.
adjust := objectMemory baseHeaderSize - 1. "shift by baseHeaderSize and then move from 1 relative to zero relative"
self AddCq: adjust R: ra.
self annotate: (self MoveCw: val R: TempReg) objRef: val.
self MoveXbr: ra R: TempReg R: ra.
objectRepresentation genConvertIntegerToSmallIntegerInReg: ra]
}
otherwise: [^EncounteredUnknownBytecode].
self ssPushRegister: ra.
^0!
Item was changed:
----- Method: StackToRegisterMappingCogit>>genBinaryVarOpConstInlinePrimitive: (in category 'inline primitive generators') -----
genBinaryVarOpConstInlinePrimitive: prim
"Var op const version of inline binary inline primitives."
"SistaV1: 248 11111000 iiiiiiii mjjjjjjj Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1 means inlined primitive, no hard return after execution.
See EncoderForSistaV1's class comment and StackInterpreter>>#binaryInlinePrimitive:"
| rr val untaggedVal |
val := self ssTop constant.
self ssPop: 1.
rr := self allocateOneRegister.
self ssTop popToReg: rr.
self ssPop: 1.
untaggedVal := val - objectMemory smallIntegerTag.
prim caseOf: {
"0 through 6, +, -, *, /, //, \\, quo:, SmallInteger op SmallInteger => SmallInteger, no overflow"
[0] -> [self AddCq: untaggedVal R: rr].
[1] -> [self SubCq: untaggedVal R: rr ].
[2] -> [self flag: 'could use MulCq:R'.
objectRepresentation genShiftAwaySmallIntegerTagsInScratchReg: rr.
self MoveCq: (objectMemory integerValueOf: val) R: TempReg.
self MulR: TempReg R: rr.
objectRepresentation genAddSmallIntegerTagsTo: rr].
"2016 through 2019, bitAnd:, bitOr:, bitXor, bitShift:, SmallInteger op SmallInteger => SmallInteger, no overflow"
+ "2032 through 2037, >, <, >=, <=. =, ~=, SmallInteger op SmallInteger => Boolean (flags?? then in jump bytecodes if ssTop is a flags value, just generate the instruction!!!!)"
+ "CmpCqR is SubRCq so everything is reversed."
- "2032 through 2037, >, <, >=, <=. =, ~=, SmallInteger op SmallInteger => Boolean (flags?? then in jump bytecodes if ssTop is a flags value, just generate the instruction!!!!)
- Here the comparison is reversed (cst on the left, reg on the right) so I inverted opTrue and opFalse"
[32] -> [ self CmpCq: val R: rr.
+ self genBinaryInlineComparison: JumpGreater opFalse: JumpLessOrEqual destReg: rr ].
- self genBinaryInlineComparison: JumpLess opFalse: JumpGreater destReg: rr ].
[33] -> [ self CmpCq: val R: rr.
+ self genBinaryInlineComparison: JumpLess opFalse: JumpGreaterOrEqual destReg: rr ].
- self genBinaryInlineComparison: JumpGreater opFalse: JumpLess destReg: rr ].
[34] -> [ self CmpCq: val R: rr.
+ self genBinaryInlineComparison: JumpGreaterOrEqual opFalse: JumpLess destReg: rr ].
- self genBinaryInlineComparison: JumpLessOrEqual opFalse: JumpGreaterOrEqual destReg: rr ].
[35] -> [ self CmpCq: val R: rr.
+ self genBinaryInlineComparison: JumpLessOrEqual opFalse: JumpGreater destReg: rr ].
- self genBinaryInlineComparison: JumpGreaterOrEqual opFalse: JumpLessOrEqual destReg: rr ].
[36] -> [ self CmpCq: val R: rr.
- self genBinaryInlineComparison: JumpNonZero opFalse: JumpZero destReg: rr ].
- [37] -> [ self CmpCq: val R: rr.
self genBinaryInlineComparison: JumpZero opFalse: JumpNonZero destReg: rr ].
+ [37] -> [ self CmpCq: val R: rr.
+ self genBinaryInlineComparison: JumpNonZero opFalse: JumpZero destReg: rr ].
"2064 through 2068, Pointer Object>>at:, Byte Object>>at:, Short16 Word Object>>at: LongWord32 Object>>at: Quad64Word Object>>at:. obj op 0-rel SmallInteger => oop"
[64] -> [objectRepresentation genLoadSlot: (objectMemory integerValueOf: val) - 1 sourceReg: rr destReg: rr].
[65] -> [self MoveCq: (objectMemory integerValueOf: val) + objectMemory baseHeaderSize - 1 R: TempReg.
self MoveXbr: TempReg R: rr R: rr.
objectRepresentation genConvertIntegerToSmallIntegerInReg: rr]
}
otherwise: [^EncounteredUnknownBytecode].
self ssPushRegister: rr.
^0!
Item was changed:
----- Method: StackToRegisterMappingCogit>>genBinaryVarOpVarInlinePrimitive: (in category 'inline primitive generators') -----
genBinaryVarOpVarInlinePrimitive: prim
"Var op var version of binary inline primitives."
"SistaV1: 248 11111000 iiiiiiii mjjjjjjj Call Primitive #iiiiiiii + (jjjjjjj * 256) m=1 means inlined primitive, no hard return after execution.
See EncoderForSistaV1's class comment and StackInterpreter>>#binaryInlinePrimitive:"
| ra rr adjust |
self allocateTwoRegistersInto: [:rTop :rNext | ra := rTop. rr := rNext ].
self ssTop popToReg: ra.
self ssPop: 1.
self ssTop popToReg: rr.
self ssPop: 1.
prim caseOf: {
"0 through 6, +, -, *, /, //, \\, quo:, SmallInteger op SmallInteger => SmallInteger, no overflow"
[0] -> [objectRepresentation genRemoveSmallIntegerTagsInScratchReg: ra.
self AddR: ra R: rr].
[1] -> [self SubR: ra R: rr.
objectRepresentation genAddSmallIntegerTagsTo: rr].
[2] -> [objectRepresentation genRemoveSmallIntegerTagsInScratchReg: rr.
objectRepresentation genShiftAwaySmallIntegerTagsInScratchReg: ra.
self MulR: ra R: rr.
objectRepresentation genAddSmallIntegerTagsTo: rr].
"2016 through 2019, bitAnd:, bitOr:, bitXor, bitShift:, SmallInteger op SmallInteger => SmallInteger, no overflow"
"2032 through 2037, >, <, >=, <=. =, ~=, SmallInteger op SmallInteger => Boolean (flags?? then in jump bytecodes if ssTop is a flags value, just generate the instruction!!!!)"
+ "CmpCqR is SubRCq so everything is reversed."
+ [32] -> [ self CmpR: ra R: rr.
+ self genBinaryInlineComparison: JumpGreater opFalse: JumpLessOrEqual destReg: rr ].
+ [33] -> [ self CmpR: ra R: rr.
+ self genBinaryInlineComparison: JumpLess opFalse: JumpGreaterOrEqual destReg: rr ].
+ [34] -> [ self CmpR: ra R: rr.
+ self genBinaryInlineComparison: JumpGreaterOrEqual opFalse: JumpLess destReg: rr ].
+ [35] -> [ self CmpR: ra R: rr.
+ self genBinaryInlineComparison: JumpLessOrEqual opFalse: JumpGreater destReg: rr ].
+ [36] -> [ self CmpR: ra R: rr.
- [32] -> [ self CmpR: rr R: ra.
- self genBinaryInlineComparison: JumpGreater opFalse: JumpLess destReg: rr ].
- [33] -> [ self CmpR: rr R: ra.
- self genBinaryInlineComparison: JumpLess opFalse: JumpGreater destReg: rr ].
- [34] -> [ self CmpR: rr R: ra.
- self genBinaryInlineComparison: JumpGreaterOrEqual opFalse: JumpLessOrEqual destReg: rr ].
- [35] -> [ self CmpR: rr R: ra.
- self genBinaryInlineComparison: JumpLessOrEqual opFalse: JumpGreaterOrEqual destReg: rr ].
- [36] -> [ self CmpR: rr R: ra.
self genBinaryInlineComparison: JumpZero opFalse: JumpNonZero destReg: rr ].
+ [37] -> [ self CmpR: ra R: rr.
- [37] -> [ self CmpR: rr R: ra.
self genBinaryInlineComparison: JumpNonZero opFalse: JumpZero destReg: rr ].
"2064 through 2068, Pointer Object>>at:, Byte Object>>at:, Short16 Word Object>>at: LongWord32 Object>>at: Quad64Word Object>>at:. obj op 0-rel SmallInteger => oop"
[64] -> [objectRepresentation genConvertSmallIntegerToIntegerInReg: ra.
adjust := (objectMemory baseHeaderSize >> objectMemory shiftForWord) - 1. "shift by baseHeaderSize and then move from 1 relative to zero relative"
adjust ~= 0 ifTrue: [ self AddCq: adjust R: ra. ].
self MoveXwr: ra R: rr R: rr ].
[65] -> [objectRepresentation genConvertSmallIntegerToIntegerInReg: ra.
adjust := objectMemory baseHeaderSize - 1. "shift by baseHeaderSize and then move from 1 relative to zero relative"
self AddCq: adjust R: ra.
self MoveXbr: ra R: rr R: rr.
objectRepresentation genConvertIntegerToSmallIntegerInReg: rr]
}
otherwise: [^EncounteredUnknownBytecode].
self ssPushRegister: rr.
^0!
More information about the Vm-dev
mailing list