[Vm-dev] VM Maker: VMMaker.oscog-eem.2301.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Dec 22 05:36:39 UTC 2017
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2301.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2301
Author: eem
Time: 21 December 2017, 9:36:04.333777 pm
UUID: 1c4c0d30-b050-455d-8bbb-1ddab57d1476
Ancestors: VMMaker.oscog-eem.2300
Fix a slip in CogObjectRepresentationFor64BitSpur>>genPrimitiveAt's 64-bit indexable suypport. The range check must include the sign bit since 64-bit at: answers an unsigned value. The Cogit now correctly passes the DoubleByteArrayTests, WordArrayTests, DoubleWordArrayTests and MemoryTests in simulation and actuality.
=============== Diff against VMMaker.oscog-eem.2300 ===============
Item was changed:
----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveAt (in category 'primitive generators') -----
genPrimitiveAt
| formatReg nSlotsOrElementsReg convertToIntAndReturn methodInBounds
jumpNotIndexable jumpImmediate jumpBadIndex
jumpIsBytes jumpIsShorts jumpIsWords jumpIsLongs jumpIsMethod jumpIsArray jumpIsContext
jumpHasFixedFields jumpArrayOutOfBounds jumpFixedFieldsOutOfBounds
jumpBytesOutOfBounds jumpShortsOutOfBounds jumpWordsOutOfBounds jumpLongsOutOfBounds
jumpFailAlloc jumpNotSmallInteger |
"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
<var: #jumpIsBytes type: #'AbstractInstruction *'>
<var: #jumpIsLongs type: #'AbstractInstruction *'>
<var: #jumpFailAlloc type: #'AbstractInstruction *'>
<var: #jumpIsShorts type: #'AbstractInstruction *'>
<var: #jumpIsMethod type: #'AbstractInstruction *'>
<var: #jumpBadIndex type: #'AbstractInstruction *'>
<var: #jumpIsContext type: #'AbstractInstruction *'>
<var: #jumpImmediate type: #'AbstractInstruction *'>
<var: #methodInBounds type: #'AbstractInstruction *'>
<var: #jumpNotIndexable type: #'AbstractInstruction *'>
<var: #jumpHasFixedFields type: #'AbstractInstruction *'>
<var: #jumpNotSmallInteger type: #'AbstractInstruction *'>
<var: #convertToIntAndReturn type: #'AbstractInstruction *'>
<var: #jumpArrayOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpBytesOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpLongsOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpShortsOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpWordsOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpFixedFieldsOutOfBounds type: #'AbstractInstruction *'>
nSlotsOrElementsReg := ClassReg.
cogit genLoadArgAtDepth: 0 into: Arg0Reg.
jumpImmediate := self genJumpImmediate: ReceiverResultReg.
cogit MoveR: Arg0Reg R: Arg1Reg.
jumpBadIndex := self genJumpNotSmallInteger: Arg0Reg scratchReg: TempReg.
self genConvertSmallIntegerToIntegerInReg: Arg1Reg.
cogit SubCq: 1 R: Arg1Reg. "1-rel => 0-rel"
"formatReg := self formatOf: ReceiverResultReg"
self genGetFormatOf: ReceiverResultReg
into: (formatReg := SendNumArgsReg)
leastSignificantHalfOfBaseHeaderIntoScratch: TempReg.
self genGetNumSlotsOf: ReceiverResultReg into: nSlotsOrElementsReg.
"dispatch on format in a combination of highest dynamic frequency order first and convenience.
0 = 0 sized objects (UndefinedObject True False et al)
1 = non-indexable objects with inst vars (Point et al)
2 = indexable objects with no inst vars (Array et al)
3 = indexable objects with inst vars (MethodContext AdditionalMethodState et al)
4 = weak indexable objects with inst vars (WeakArray et al)
5 = weak non-indexable objects with inst vars (ephemerons) (Ephemeron)
6 unused, reserved for exotic pointer objects?
7 Forwarded Object, 1st field is pointer, rest of fields are ignored
8 unused, reserved for exotic non-pointer objects?
9 64-bit indexable
10 - 11 32-bit indexable
12 - 15 16-bit indexable
16 - 23 byte indexable
24 - 31 compiled method"
cogit CmpCq: objectMemory firstByteFormat R: formatReg.
jumpIsBytes := cogit JumpAboveOrEqual: 0.
cogit CmpCq: objectMemory arrayFormat R: formatReg.
jumpIsArray := cogit JumpZero: 0.
jumpNotIndexable := cogit JumpBelow: 0.
cogit CmpCq: objectMemory weakArrayFormat R: formatReg.
jumpHasFixedFields := cogit JumpBelowOrEqual: 0.
cogit CmpCq: objectMemory firstShortFormat R: formatReg.
jumpIsShorts := cogit JumpAboveOrEqual: 0.
cogit CmpCq: objectMemory firstLongFormat R: formatReg.
jumpIsWords := cogit JumpAboveOrEqual: 0.
cogit CmpCq: objectMemory sixtyFourBitIndexableFormat R: formatReg.
jumpIsLongs := cogit JumpZero: 0.
jumpNotIndexable jmpTarget: cogit Label.
jumpNotIndexable := cogit Jump: 0.
jumpIsArray jmpTarget:
(cogit CmpR: Arg1Reg R: nSlotsOrElementsReg).
jumpArrayOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg1Reg.
cogit MoveXwr: Arg1Reg R: ReceiverResultReg R: ReceiverResultReg.
cogit genPrimReturn.
jumpIsBytes jmpTarget:
(cogit LogicalShiftLeftCq: objectMemory shiftForWord R: nSlotsOrElementsReg).
cogit AndCq: 7 R: formatReg R: TempReg.
cogit SubR: TempReg R: nSlotsOrElementsReg;
CmpR: Arg1Reg R: nSlotsOrElementsReg.
jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit CmpCq: objectMemory firstCompiledMethodFormat R: formatReg.
jumpIsMethod := cogit JumpAboveOrEqual: 0.
methodInBounds :=
(cogit AddCq: objectMemory baseHeaderSize R: Arg1Reg).
cogit backEnd byteReadsZeroExtend
ifTrue:
[cogit MoveXbr: Arg1Reg R: ReceiverResultReg R: ReceiverResultReg]
ifFalse:
[cogit "formatReg already contains a value <= 16r1f, so no need to zero it"
MoveXbr: Arg1Reg R: ReceiverResultReg R: formatReg;
MoveR: formatReg R: ReceiverResultReg].
convertToIntAndReturn := cogit Label.
self genConvertIntegerToSmallIntegerInReg: ReceiverResultReg.
cogit genPrimReturn.
jumpIsShorts jmpTarget:
(cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: nSlotsOrElementsReg).
cogit AndCq: 3 R: formatReg.
cogit SubR: formatReg R: nSlotsOrElementsReg;
CmpR: Arg1Reg R: nSlotsOrElementsReg.
jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit AddR: Arg1Reg R: ReceiverResultReg.
cogit AddR: Arg1Reg R: ReceiverResultReg.
cogit MoveM16: objectMemory baseHeaderSize r: ReceiverResultReg R: ReceiverResultReg.
cogit Jump: convertToIntAndReturn.
jumpIsWords jmpTarget:
(cogit LogicalShiftLeftCq: objectMemory shiftForWord - 2 R: nSlotsOrElementsReg).
cogit AndCq: 1 R: formatReg.
cogit SubR: formatReg R: nSlotsOrElementsReg;
CmpR: Arg1Reg R: nSlotsOrElementsReg.
jumpWordsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit AddCq: objectMemory baseHeaderSize >> (objectMemory shiftForWord - 1) R: Arg1Reg.
cogit MoveX32r: Arg1Reg R: ReceiverResultReg R: TempReg.
cogit MoveR: TempReg R: ReceiverResultReg.
cogit Jump: convertToIntAndReturn.
jumpHasFixedFields jmpTarget:
(cogit AndCq: objectMemory classIndexMask R: TempReg).
cogit MoveR: TempReg R: formatReg.
cogit CmpCq: ClassMethodContextCompactIndex R: TempReg.
jumpIsContext := cogit JumpZero: 0.
self genGetClassObjectOfClassIndex: formatReg into: Extra0Reg scratchReg: TempReg.
self genLoadSlot: InstanceSpecificationIndex sourceReg: Extra0Reg destReg: formatReg.
self genConvertSmallIntegerToIntegerInReg: formatReg.
cogit
AndCq: objectMemory fixedFieldsOfClassFormatMask R: formatReg;
SubR: formatReg R: nSlotsOrElementsReg;
CmpR: Arg1Reg R: nSlotsOrElementsReg.
jumpFixedFieldsOutOfBounds := cogit JumpBelowOrEqual: 0.
"index is (formatReg (fixed fields) + Arg1Reg (0-rel index)) * wordSize + baseHeaderSize"
cogit AddR: formatReg R: Arg1Reg.
cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg1Reg.
cogit MoveXwr: Arg1Reg R: ReceiverResultReg R: ReceiverResultReg.
cogit genPrimReturn.
jumpIsLongs jmpTarget:
(cogit CmpR: Arg1Reg R: nSlotsOrElementsReg).
jumpLongsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg1Reg.
cogit MoveXwr: Arg1Reg R: ReceiverResultReg R: ClassReg.
cogit MoveR: ClassReg R: TempReg.
+ cogit LogicalShiftRightCq: self numSmallIntegerBits - 1 R: TempReg. "If in range this is now 0"
- cogit LogicalShiftRightCq: self numSmallIntegerBits R: TempReg. "If in range this is now 0"
(cogit lastOpcode setsConditionCodesFor: JumpZero) ifFalse:
[cogit CmpCq: 0 R: TempReg]. "N.B. FLAGS := ClassReg - 0"
jumpNotSmallInteger := cogit JumpNonZero: 0.
cogit MoveR: ClassReg R: ReceiverResultReg.
cogit Jump: convertToIntAndReturn.
jumpNotSmallInteger jmpTarget: cogit Label.
jumpFailAlloc := self genAlloc64BitIntegerValue: ClassReg into: SendNumArgsReg scratchReg: Extra0Reg scratchReg: TempReg.
cogit MoveR: SendNumArgsReg R: ReceiverResultReg.
cogit genPrimReturn.
jumpIsMethod jmpTarget: cogit Label.
"Now check that the index is beyond the method's literals..."
self getLiteralCountOf: ReceiverResultReg plusOne: true inBytes: true into: nSlotsOrElementsReg scratch: TempReg.
cogit CmpR: Arg1Reg R: nSlotsOrElementsReg.
cogit JumpBelow: methodInBounds.
jumpFailAlloc jmpTarget:
(jumpLongsOutOfBounds jmpTarget:
(jumpFixedFieldsOutOfBounds jmpTarget:
(jumpArrayOutOfBounds jmpTarget:
(jumpBytesOutOfBounds jmpTarget:
(jumpShortsOutOfBounds jmpTarget:
(jumpWordsOutOfBounds jmpTarget:
(jumpNotIndexable jmpTarget:
(jumpIsContext jmpTarget:
(jumpBadIndex jmpTarget:
(jumpImmediate jmpTarget: cogit Label)))))))))).
^0!
More information about the Vm-dev
mailing list