[Vm-dev] VM Maker: VMMaker.oscog-eem.1639.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Jan 16 04:15:02 UTC 2016
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1639.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1639
Author: eem
Time: 16 January 2016, 8:13:24.044011 pm
UUID: 0607da54-875d-4632-95f3-ce5b0d6d3bf9
Ancestors: VMMaker.oscog-eem.1638
Cogit:
Fix slip in immutability jumps. jumpTarget is not a selector. getJmpTarget is.
64-bit Spur Cogit:
Generate cleaner SmallFloat arithmetic and comparison code by extracting arg tag once.
=============== Diff against VMMaker.oscog-eem.1638 ===============
Item was changed:
----- Method: CogObjectRepresentationFor32BitSpur>>genPrimitiveAtPut (in category 'primitive generators') -----
genPrimitiveAtPut
| formatReg jumpImmediate jumpBadIndex jumpImmutable
jumpNotIndexablePointers jumpNotIndexableBits
jumpIsContext jumpIsCompiledMethod jumpIsBytes jumpIsShorts jumpHasFixedFields
jumpArrayOutOfBounds jumpFixedFieldsOutOfBounds
jumpWordsOutOfBounds jumpShortsOutOfBounds jumpBytesOutOfBounds
jumpShortsOutOfRange jumpWordsOutOfRange jumpBytesOutOfRange
jumpNonSmallIntegerValue jumpNotPointers
|
"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
<var: #jumpIsBytes type: #'AbstractInstruction *'>
<var: #jumpIsShorts type: #'AbstractInstruction *'>
<var: #jumpBadIndex type: #'AbstractInstruction *'>
<var: #jumpIsContext type: #'AbstractInstruction *'>
<var: #jumpImmediate type: #'AbstractInstruction *'>
<var: #jumpHasFixedFields type: #'AbstractInstruction *'>
<var: #jumpNotIndexableBits type: #'AbstractInstruction *'>
<var: #jumpBytesOutOfRange type: #'AbstractInstruction *'>
<var: #jumpWordsOutOfRange type: #'AbstractInstruction *'>
<var: #jumpShortsOutOfRange type: #'AbstractInstruction *'>
<var: #jumpArrayOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpBytesOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpWordsOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpShortsOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpNotIndexablePointers type: #'AbstractInstruction *'>
cogit genLoadArgAtDepth: 1 into: Arg0Reg.
cogit genLoadArgAtDepth: 0 into: Arg1Reg.
jumpImmediate := self genJumpImmediate: ReceiverResultReg.
jumpBadIndex := self genJumpNotSmallInteger: Arg0Reg scratchReg: TempReg.
self genConvertSmallIntegerToIntegerInReg: Arg0Reg.
cogit SubCq: 1 R: Arg0Reg. "1-rel => 0-rel"
"formatReg := self formatOf: ReceiverResultReg"
self cppIf: IMMUTABILITY
ifTrue:
[ self genGetFormatOf: ReceiverResultReg
into: (formatReg := SendNumArgsReg)
leastSignificantHalfOfBaseHeaderIntoScratch: TempReg.
jumpImmutable := self genJumpBaseHeaderImmutable: TempReg ]
ifFalse:
[ self genGetFormatOf: ReceiverResultReg
into: (formatReg := SendNumArgsReg)
leastSignificantHalfOfBaseHeaderIntoScratch: NoReg ].
self genGetNumSlotsOf: ReceiverResultReg into: ClassReg.
"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 weakArrayFormat R: formatReg.
jumpNotPointers := cogit JumpAbove: 0.
"optimistic store check; assume index in range (almost always is)."
self genStoreCheckReceiverReg: ReceiverResultReg
valueReg: Arg1Reg
scratchReg: TempReg
inFrame: false.
cogit CmpCq: objectMemory arrayFormat R: formatReg.
jumpNotIndexablePointers := cogit JumpBelow: 0.
jumpHasFixedFields := cogit JumpNonZero: 0.
cogit CmpR: Arg0Reg R: ClassReg.
jumpArrayOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg0Reg.
cogit MoveR: Arg1Reg Xwr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpHasFixedFields jmpTarget: cogit Label.
self genGetClassIndexOfNonImm: ReceiverResultReg into: formatReg.
cogit CmpCq: ClassMethodContextCompactIndex R: formatReg.
jumpIsContext := cogit JumpZero: 0.
"get # fixed fields in formatReg"
cogit PushR: ClassReg.
self genGetClassObjectOfClassIndex: formatReg into: ClassReg scratchReg: TempReg.
self genLoadSlot: InstanceSpecificationIndex sourceReg: ClassReg destReg: formatReg.
cogit PopR: ClassReg.
self genConvertSmallIntegerToIntegerInReg: formatReg.
cogit AndCq: objectMemory fixedFieldsOfClassFormatMask R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: formatReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpFixedFieldsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit AddR: formatReg R: Arg0Reg.
cogit MoveR: Arg1Reg Xwr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpNotPointers jmpTarget:
(cogit CmpCq: objectMemory firstCompiledMethodFormat R: formatReg).
jumpIsCompiledMethod := cogit JumpAboveOrEqual: 0.
jumpNonSmallIntegerValue := self genJumpNotSmallInteger: Arg1Reg scratchReg: TempReg.
cogit CmpCq: objectMemory firstByteFormat R: formatReg.
jumpIsBytes := cogit JumpAboveOrEqual: 0.
cogit CmpCq: objectMemory firstShortFormat R: formatReg.
jumpIsShorts := cogit JumpAboveOrEqual: 0.
cogit CmpCq: objectMemory firstLongFormat R: formatReg.
"For now ignore 64-bit indexability."
jumpNotIndexableBits := cogit JumpBelow: 0.
cogit CmpR: Arg0Reg R: ClassReg.
jumpWordsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
(cogit lastOpcode setsConditionCodesFor: JumpLess) ifFalse:
[cogit CmpCq: 0 R: TempReg]. "N.B. FLAGS := TempReg - 0"
jumpWordsOutOfRange := cogit JumpLess: 0.
cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg0Reg.
cogit MoveR: TempReg Xwr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpIsBytes jmpTarget:
(cogit CmpCq: (objectMemory integerObjectOf: 255) R: Arg1Reg).
jumpBytesOutOfRange := cogit JumpAbove: 0.
cogit LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
cogit AndCq: objectMemory wordSize - 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
cogit AddCq: objectMemory baseHeaderSize R: Arg0Reg.
cogit MoveR: TempReg Xbr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpIsShorts jmpTarget:
(cogit CmpCq: (objectMemory integerObjectOf: 65535) R: Arg1Reg).
jumpShortsOutOfRange := cogit JumpAbove: 0.
cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
cogit AndCq: objectMemory wordSize / 2 - 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
cogit AddR: Arg0Reg R: ReceiverResultReg.
cogit MoveR: TempReg M16: objectMemory baseHeaderSize r: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpIsContext jmpTarget:
(jumpNotIndexableBits jmpTarget:
(jumpBytesOutOfRange jmpTarget:
(jumpWordsOutOfRange jmpTarget:
(jumpShortsOutOfRange jmpTarget:
(jumpIsCompiledMethod jmpTarget:
(jumpArrayOutOfBounds jmpTarget:
(jumpBytesOutOfBounds jmpTarget:
(jumpShortsOutOfBounds jmpTarget:
(jumpWordsOutOfBounds jmpTarget:
(jumpNotIndexablePointers jmpTarget:
(jumpNonSmallIntegerValue jmpTarget:
(jumpFixedFieldsOutOfBounds jmpTarget: cogit Label)))))))))))).
self cppIf: IMMUTABILITY
+ ifTrue: [jumpImmutable jmpTarget: jumpIsContext getJmpTarget].
- ifTrue: [jumpImmutable jmpTarget: jumpIsContext jumpTarget].
cogit AddCq: 1 R: Arg0Reg. "0-rel => 1-rel"
self genConvertIntegerToSmallIntegerInReg: Arg0Reg.
jumpBadIndex jmpTarget: (jumpImmediate jmpTarget: cogit Label).
^0!
Item was changed:
----- Method: CogObjectRepresentationFor32BitSpur>>genPrimitiveStringAtPut (in category 'primitive generators') -----
genPrimitiveStringAtPut
| formatReg jumpBadIndex jumpBadArg jumpShortsDone jumpWordsDone
jumpBytesOutOfRange jumpShortsOutOfRange jumpWordsOutOfRange
jumpIsBytes jumpIsShorts jumpNotString jumpIsCompiledMethod jumpImmutable
jumpBytesOutOfBounds jumpWordsOutOfBounds jumpShortsOutOfBounds |
"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
<var: #jumpBadArg type: #'AbstractInstruction *'>
<var: #jumpIsBytes type: #'AbstractInstruction *'>
<var: #jumpIsShorts type: #'AbstractInstruction *'>
<var: #jumpBadIndex type: #'AbstractInstruction *'>
<var: #jumpShortsDone type: #'AbstractInstruction *'>
<var: #jumpWordsDone type: #'AbstractInstruction *'>
<var: #jumpBytesOutOfRange type: #'AbstractInstruction *'>
<var: #jumpShortsOutOfRange type: #'AbstractInstruction *'>
<var: #jumpWordsOutOfRange type: #'AbstractInstruction *'>
<var: #jumpBytesOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpShortsOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpWordsOutOfBounds type: #'AbstractInstruction *'>
cogit genLoadArgAtDepth: 1 into: Arg0Reg.
cogit genLoadArgAtDepth: 0 into: Arg1Reg.
jumpBadIndex := self genJumpNotSmallInteger: Arg0Reg.
cogit MoveR: Arg1Reg R: TempReg.
jumpBadArg := self genJumpNotCharacterInScratchReg: TempReg.
self genConvertSmallIntegerToIntegerInReg: Arg0Reg.
cogit SubCq: 1 R: Arg0Reg. "1-rel => 0-rel"
"formatReg := self formatOf: ReceiverResultReg"
self cppIf: IMMUTABILITY
ifTrue:
[ self genGetFormatOf: ReceiverResultReg
into: (formatReg := SendNumArgsReg)
leastSignificantHalfOfBaseHeaderIntoScratch: TempReg.
jumpImmutable := self genJumpBaseHeaderImmutable: TempReg ]
ifFalse:
[ self genGetFormatOf: ReceiverResultReg
into: (formatReg := SendNumArgsReg)
leastSignificantHalfOfBaseHeaderIntoScratch: NoReg ].
self genGetNumSlotsOf: ReceiverResultReg into: ClassReg.
"dispatch on format; words and/or bytes.
0 to 8 = pointer objects, forwarders, reserved.
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 firstLongFormat R: formatReg.
jumpNotString := cogit JumpBelowOrEqual: 0.
cogit CmpCq: objectMemory firstCompiledMethodFormat R: formatReg.
jumpIsCompiledMethod := cogit JumpAboveOrEqual: 0.
cogit CmpCq: objectMemory firstByteFormat R: formatReg.
jumpIsBytes := cogit JumpGreaterOrEqual: 0.
cogit CmpCq: objectMemory firstShortFormat R: formatReg.
jumpIsShorts := cogit JumpGreaterOrEqual: 0.
cogit CmpCq: 0 R: Arg1Reg.
jumpWordsOutOfRange := cogit JumpLess: 0.
cogit CmpR: Arg0Reg R: ClassReg.
jumpWordsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg0Reg.
cogit MoveR: TempReg Xwr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
jumpWordsDone := cogit Jump: 0.
jumpIsShorts jmpTarget:
(cogit CmpCq: (objectMemory characterObjectOf: 65535) R: Arg1Reg).
jumpShortsOutOfRange := cogit JumpAbove: 0.
cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
cogit AndCq: 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
cogit AddR: Arg0Reg R: ReceiverResultReg.
cogit MoveR: TempReg M16: objectMemory baseHeaderSize r: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
jumpShortsDone := cogit Jump: 0.
jumpIsBytes jmpTarget:
(cogit CmpCq: (objectMemory characterObjectOf: 255) R: Arg1Reg).
jumpBytesOutOfRange := cogit JumpAbove: 0.
cogit LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
cogit AndCq: objectMemory wordSize - 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertCharacterToCodeInReg: TempReg.
cogit AddCq: objectMemory baseHeaderSize R: Arg0Reg.
cogit MoveR: TempReg Xbr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
jumpShortsDone jmpTarget:
(jumpWordsDone jmpTarget: cogit genPrimReturn).
jumpNotString jmpTarget:
(jumpBytesOutOfRange jmpTarget:
(jumpShortsOutOfRange jmpTarget:
(jumpWordsOutOfRange jmpTarget:
(jumpIsCompiledMethod jmpTarget:
(jumpBytesOutOfBounds jmpTarget:
(jumpShortsOutOfBounds jmpTarget:
(jumpWordsOutOfBounds jmpTarget: cogit Label))))))).
self cppIf: IMMUTABILITY
+ ifTrue: [jumpImmutable jmpTarget: jumpNotString getJmpTarget].
- ifTrue: [jumpImmutable jmpTarget: jumpNotString jumpTarget].
cogit AddCq: 1 R: Arg0Reg. "0-rel => 1-rel"
self genConvertIntegerToSmallIntegerInReg: Arg0Reg.
jumpBadArg jmpTarget:
(jumpBadIndex jmpTarget: cogit Label).
^CompletePrimitive!
Item was changed:
----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveAtPut (in category 'primitive generators') -----
genPrimitiveAtPut
| formatReg jumpImmediate jumpBadIndex jumpImmutable
jumpNotIndexablePointers jumpNotIndexableBits
jumpIsContext jumpIsCompiledMethod jumpIsBytes jumpIsShorts jumpHasFixedFields
jumpArrayOutOfBounds jumpFixedFieldsOutOfBounds
jumpWordsOutOfBounds jumpShortsOutOfBounds jumpBytesOutOfBounds
jumpShortsOutOfRange jumpWordsOutOfRange jumpBytesOutOfRange
jumpNonSmallIntegerValue jumpNotPointers
|
"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
<var: #jumpIsBytes type: #'AbstractInstruction *'>
<var: #jumpIsShorts type: #'AbstractInstruction *'>
<var: #jumpBadIndex type: #'AbstractInstruction *'>
<var: #jumpIsContext type: #'AbstractInstruction *'>
<var: #jumpImmediate type: #'AbstractInstruction *'>
<var: #jumpHasFixedFields type: #'AbstractInstruction *'>
<var: #jumpNotIndexableBits type: #'AbstractInstruction *'>
<var: #jumpBytesOutOfRange type: #'AbstractInstruction *'>
<var: #jumpWordsOutOfRange type: #'AbstractInstruction *'>
<var: #jumpShortsOutOfRange type: #'AbstractInstruction *'>
<var: #jumpArrayOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpBytesOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpWordsOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpShortsOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpNotIndexablePointers type: #'AbstractInstruction *'>
cogit genLoadArgAtDepth: 1 into: Arg0Reg.
cogit genLoadArgAtDepth: 0 into: Arg1Reg.
jumpImmediate := self genJumpImmediate: ReceiverResultReg.
jumpBadIndex := self genJumpNotSmallInteger: Arg0Reg scratchReg: TempReg.
self genConvertSmallIntegerToIntegerInReg: Arg0Reg.
cogit SubCq: 1 R: Arg0Reg. "1-rel => 0-rel"
"formatReg := self formatOf: ReceiverResultReg"
self cppIf: IMMUTABILITY
ifTrue:
[ self genGetFormatOf: ReceiverResultReg
into: (formatReg := SendNumArgsReg)
leastSignificantHalfOfBaseHeaderIntoScratch: TempReg.
jumpImmutable := self genJumpBaseHeaderImmutable: TempReg ]
ifFalse:
[ self genGetFormatOf: ReceiverResultReg
into: (formatReg := SendNumArgsReg)
leastSignificantHalfOfBaseHeaderIntoScratch: NoReg ].
self genGetNumSlotsOf: ReceiverResultReg into: ClassReg.
"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 weakArrayFormat R: formatReg.
jumpNotPointers := cogit JumpAbove: 0.
"optimistic store check; assume index in range (almost always is)."
self genStoreCheckReceiverReg: ReceiverResultReg
valueReg: Arg1Reg
scratchReg: TempReg
inFrame: false.
cogit CmpCq: objectMemory arrayFormat R: formatReg.
jumpNotIndexablePointers := cogit JumpBelow: 0.
jumpHasFixedFields := cogit JumpNonZero: 0.
cogit CmpR: Arg0Reg R: ClassReg.
jumpArrayOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg0Reg.
cogit MoveR: Arg1Reg Xwr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpHasFixedFields jmpTarget: cogit Label.
self genGetClassIndexOfNonImm: ReceiverResultReg into: formatReg.
cogit CmpCq: ClassMethodContextCompactIndex R: formatReg.
jumpIsContext := cogit JumpZero: 0.
"get # fixed fields in formatReg"
self genGetClassObjectOfClassIndex: formatReg into: Scratch0Reg scratchReg: TempReg.
self genLoadSlot: InstanceSpecificationIndex sourceReg: Scratch0Reg destReg: formatReg.
self genConvertSmallIntegerToIntegerInReg: formatReg.
cogit AndCq: objectMemory fixedFieldsOfClassFormatMask R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: formatReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpFixedFieldsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit AddR: formatReg R: Arg0Reg.
cogit MoveR: Arg1Reg Xwr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpNotPointers jmpTarget:
(cogit CmpCq: objectMemory firstCompiledMethodFormat R: formatReg).
jumpIsCompiledMethod := cogit JumpAboveOrEqual: 0.
jumpNonSmallIntegerValue := self genJumpNotSmallInteger: Arg1Reg scratchReg: TempReg.
cogit CmpCq: objectMemory firstByteFormat R: formatReg.
jumpIsBytes := cogit JumpAboveOrEqual: 0.
cogit CmpCq: objectMemory firstShortFormat R: formatReg.
jumpIsShorts := cogit JumpAboveOrEqual: 0.
cogit CmpCq: objectMemory firstLongFormat R: formatReg.
"For now ignore 64-bit indexability."
jumpNotIndexableBits := cogit JumpBelow: 0.
"fall through to words"
cogit CmpCq: (objectMemory integerObjectOf: 16rFFFFFFFF) R: Arg1Reg.
jumpWordsOutOfRange := cogit JumpAbove: 0.
cogit LogicalShiftLeftCq: objectMemory shiftForWord - 2 R: ClassReg.
cogit AndCq: objectMemory wordSize / 4 - 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpWordsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
cogit AddCq: objectMemory baseHeaderSize >> (objectMemory shiftForWord - 1) R: Arg0Reg.
cogit MoveR: TempReg X32r: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpIsBytes jmpTarget:
(cogit CmpCq: (objectMemory integerObjectOf: 255) R: Arg1Reg).
jumpBytesOutOfRange := cogit JumpAbove: 0.
cogit LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
cogit AndCq: objectMemory wordSize - 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
cogit AddCq: objectMemory baseHeaderSize R: Arg0Reg.
cogit MoveR: TempReg Xbr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpIsShorts jmpTarget:
(cogit CmpCq: (objectMemory integerObjectOf: 65535) R: Arg1Reg).
jumpShortsOutOfRange := cogit JumpAbove: 0.
cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
cogit AndCq: objectMemory wordSize / 2 - 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
cogit AddR: Arg0Reg R: ReceiverResultReg.
cogit MoveR: TempReg M16: objectMemory baseHeaderSize r: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
cogit genPrimReturn.
jumpIsContext jmpTarget:
(jumpNotIndexableBits jmpTarget:
(jumpBytesOutOfRange jmpTarget:
(jumpShortsOutOfRange jmpTarget:
(jumpWordsOutOfRange jmpTarget:
(jumpIsCompiledMethod jmpTarget:
(jumpArrayOutOfBounds jmpTarget:
(jumpBytesOutOfBounds jmpTarget:
(jumpShortsOutOfBounds jmpTarget:
(jumpWordsOutOfBounds jmpTarget:
(jumpNotIndexablePointers jmpTarget:
(jumpNonSmallIntegerValue jmpTarget:
(jumpFixedFieldsOutOfBounds jmpTarget: cogit Label)))))))))))).
self cppIf: IMMUTABILITY
+ ifTrue: [jumpImmutable jmpTarget: jumpIsContext getJmpTarget].
- ifTrue: [jumpImmutable jmpTarget: jumpIsContext jumpTarget].
cogit AddCq: 1 R: Arg0Reg. "0-rel => 1-rel"
self genConvertIntegerToSmallIntegerInReg: Arg0Reg.
jumpBadIndex jmpTarget: (jumpImmediate jmpTarget: cogit Label).
^0!
Item was changed:
----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveStringAtPut (in category 'primitive generators') -----
genPrimitiveStringAtPut
| formatReg jumpBadIndex jumpBadArg jumpShortsDone jumpWordsDone
jumpBytesOutOfRange jumpShortsOutOfRange jumpWordsOutOfRange
jumpIsBytes jumpIsShorts jumpNotString jumpIsCompiledMethod jumpImmutable
jumpBytesOutOfBounds jumpWordsOutOfBounds jumpShortsOutOfBounds |
"c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:"
<var: #jumpBadArg type: #'AbstractInstruction *'>
<var: #jumpIsBytes type: #'AbstractInstruction *'>
<var: #jumpIsShorts type: #'AbstractInstruction *'>
<var: #jumpBadIndex type: #'AbstractInstruction *'>
<var: #jumpShortsDone type: #'AbstractInstruction *'>
<var: #jumpWordsDone type: #'AbstractInstruction *'>
<var: #jumpBytesOutOfRange type: #'AbstractInstruction *'>
<var: #jumpShortsOutOfRange type: #'AbstractInstruction *'>
<var: #jumpWordsOutOfRange type: #'AbstractInstruction *'>
<var: #jumpBytesOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpShortsOutOfBounds type: #'AbstractInstruction *'>
<var: #jumpWordsOutOfBounds type: #'AbstractInstruction *'>
cogit genLoadArgAtDepth: 1 into: Arg0Reg.
cogit genLoadArgAtDepth: 0 into: Arg1Reg.
jumpBadIndex := self genJumpNotSmallInteger: Arg0Reg scratchReg: TempReg.
jumpBadArg := self genJumpNotCharacter: Arg1Reg scratchReg: TempReg.
self genConvertSmallIntegerToIntegerInReg: Arg0Reg.
cogit SubCq: 1 R: Arg0Reg. "1-rel => 0-rel"
"formatReg := self formatOf: ReceiverResultReg"
self cppIf: IMMUTABILITY
ifTrue:
[ self genGetFormatOf: ReceiverResultReg
into: (formatReg := SendNumArgsReg)
leastSignificantHalfOfBaseHeaderIntoScratch: TempReg.
jumpImmutable := self genJumpBaseHeaderImmutable: TempReg ]
ifFalse:
[ self genGetFormatOf: ReceiverResultReg
into: (formatReg := SendNumArgsReg)
leastSignificantHalfOfBaseHeaderIntoScratch: NoReg ].
self genGetNumSlotsOf: ReceiverResultReg into: ClassReg.
"dispatch on format; words and/or bytes.
0 to 8 = pointer objects, forwarders, reserved.
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 firstLongFormat R: formatReg.
jumpNotString := cogit JumpBelowOrEqual: 0.
cogit CmpCq: objectMemory firstCompiledMethodFormat R: formatReg.
jumpIsCompiledMethod := cogit JumpAboveOrEqual: 0.
cogit CmpCq: objectMemory firstByteFormat R: formatReg.
jumpIsBytes := cogit JumpGreaterOrEqual: 0.
cogit CmpCq: objectMemory firstShortFormat R: formatReg.
jumpIsShorts := cogit JumpGreaterOrEqual: 0.
cogit CmpCq: (objectMemory characterObjectOf: 1 << self numCharacterBits - 1) R: Arg1Reg.
jumpWordsOutOfRange := cogit JumpAbove: Arg1Reg.
cogit LogicalShiftLeftCq: objectMemory shiftForWord - 2 R: ClassReg.
cogit AndCq: objectMemory wordSize / 4 - 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpWordsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
cogit AddCq: objectMemory baseHeaderSize >> (objectMemory shiftForWord - 1) R: Arg0Reg.
cogit MoveR: TempReg X32r: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
jumpWordsDone := cogit Jump: 0.
jumpIsShorts jmpTarget:
(cogit CmpCq: (objectMemory characterObjectOf: 65535) R: Arg1Reg).
jumpShortsOutOfRange := cogit JumpAbove: 0.
cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: ClassReg.
cogit AndCq: objectMemory wordSize / 2 - 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertSmallIntegerToIntegerInReg: TempReg.
cogit AddR: Arg0Reg R: ReceiverResultReg.
cogit MoveR: TempReg M16: objectMemory baseHeaderSize r: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
jumpShortsDone := cogit Jump: 0.
jumpIsBytes jmpTarget:
(cogit CmpCq: (objectMemory characterObjectOf: 255) R: Arg1Reg).
jumpBytesOutOfRange := cogit JumpAbove: 0.
cogit LogicalShiftLeftCq: objectMemory shiftForWord R: ClassReg.
cogit AndCq: objectMemory wordSize - 1 R: formatReg.
cogit SubR: formatReg R: ClassReg.
cogit CmpR: Arg0Reg R: ClassReg.
jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0.
cogit MoveR: Arg1Reg R: TempReg.
self genConvertCharacterToCodeInReg: TempReg.
cogit AddCq: objectMemory baseHeaderSize R: Arg0Reg.
cogit MoveR: TempReg Xbr: Arg0Reg R: ReceiverResultReg.
cogit MoveR: Arg1Reg R: ReceiverResultReg.
jumpWordsDone jmpTarget:
(jumpShortsDone jmpTarget: cogit genPrimReturn).
jumpNotString jmpTarget:
(jumpBytesOutOfRange jmpTarget:
(jumpShortsOutOfRange jmpTarget:
(jumpWordsOutOfRange jmpTarget:
(jumpIsCompiledMethod jmpTarget:
(jumpBytesOutOfBounds jmpTarget:
(jumpShortsOutOfBounds jmpTarget:
(jumpWordsOutOfBounds jmpTarget: cogit Label))))))).
self cppIf: IMMUTABILITY
+ ifTrue: [jumpImmutable jmpTarget: jumpNotString getJmpTarget].
- ifTrue: [jumpImmutable jmpTarget: jumpNotString jumpTarget].
cogit AddCq: 1 R: Arg0Reg. "0-rel => 1-rel"
self genConvertIntegerToSmallIntegerInReg: Arg0Reg.
jumpBadArg jmpTarget:
(jumpBadIndex jmpTarget: cogit Label).
^CompletePrimitive!
Item was changed:
----- Method: CogObjectRepresentationFor64BitSpur>>genSmallFloatArithmetic:preOpCheck: (in category 'primitive generators') -----
genSmallFloatArithmetic: arithmeticOperator preOpCheck: preOpCheckOrNil
<var: #preOpCheckOrNil declareC: 'AbstractInstruction *(*preOpCheckOrNil)(int rcvrReg, int argReg)'>
+ | jumpFailAlloc jumpFailCheck jumpImmediate jumpNotSmallFloat jumpNotSmallInteger jumpNotBoxedFloat doOp |
+ <var: #jumpNotSmallInteger type: #'AbstractInstruction *'>
+ <var: #jumpNotBoxedFloat type: #'AbstractInstruction *'>
+ <var: #jumpNotSmallFloat type: #'AbstractInstruction *'>
- | jumpFailClass jumpFailAlloc jumpFailCheck jumpImmediate jumpNonInt doOp |
- <var: #jumpFailClass type: #'AbstractInstruction *'>
- <var: #jumpFailAlloc type: #'AbstractInstruction *'>
- <var: #jumpNonInt type: #'AbstractInstruction *'>
<var: #jumpImmediate type: #'AbstractInstruction *'>
<var: #jumpFailCheck type: #'AbstractInstruction *'>
+ <var: #jumpFailAlloc type: #'AbstractInstruction *'>
<var: #doOp type: #'AbstractInstruction *'>
cogit genLoadArgAtDepth: 0 into: Arg0Reg.
+ self genGetSmallFloatValueOf: ReceiverResultReg scratch: TempReg into: DPFPReg0.
+ cogit
+ MoveR: Arg0Reg R: ClassReg;
+ AndCq: objectMemory tagMask R: ClassReg;
+ CmpCq: objectMemory smallFloatTag R: ClassReg.
+ jumpNotSmallFloat := cogit JumpNonZero: 0.
+ self genGetSmallFloatValueOf: Arg0Reg scratch: TempReg into: DPFPReg1.
- self genGetSmallFloatValueOf: ReceiverResultReg scratch: SendNumArgsReg into: DPFPReg0.
- cogit MoveR: Arg0Reg R: ClassReg.
- jumpImmediate := self genJumpImmediate: Arg0Reg.
- self genGetCompactClassIndexNonImmOf: Arg0Reg into: SendNumArgsReg.
- self genCmpClassFloatCompactIndexR: SendNumArgsReg.
- jumpFailClass := cogit JumpNonZero: 0.
- self genGetDoubleValueOf: Arg0Reg into: DPFPReg1.
doOp := cogit Label.
preOpCheckOrNil ifNotNil:
[jumpFailCheck := cogit perform: preOpCheckOrNil with: DPFPReg0 with: DPFPReg1].
cogit gen: arithmeticOperator operand: DPFPReg1 operand: DPFPReg0.
+ jumpFailAlloc := self genAllocFloatValue: DPFPReg0 into: SendNumArgsReg scratchReg: ClassReg scratchReg: TempReg.
- jumpFailAlloc := self
- genAllocFloatValue: DPFPReg0
- into: SendNumArgsReg
- scratchReg: ClassReg
- scratchReg: TempReg.
cogit MoveR: SendNumArgsReg R: ReceiverResultReg.
cogit genPrimReturn.
+ jumpNotSmallFloat jmpTarget:
+ (cogit CmpCq: objectMemory smallIntegerTag R: ClassReg).
+ jumpNotSmallInteger := cogit JumpNonZero: 0.
+ cogit MoveR: Arg0Reg R: Arg1Reg.
+ self genConvertSmallIntegerToIntegerInReg: Arg1Reg.
+ cogit ConvertR: Arg1Reg Rd: DPFPReg1.
- jumpImmediate jmpTarget: cogit Label.
- self maybeGenConvertIfSmallFloatIn: Arg0Reg scratchReg: TempReg into: DPFPReg1 andJumpTo: doOp.
- jumpNonInt := self genJumpNotSmallInteger: Arg0Reg scratchReg: TempReg.
- self genConvertSmallIntegerToIntegerInReg: ClassReg.
- cogit ConvertR: ClassReg Rd: DPFPReg1.
cogit Jump: doOp.
+ jumpNotSmallInteger jmpTarget: (cogit CmpCq: 0 R: ClassReg).
+ jumpImmediate := cogit JumpNonZero: 0.
+ self genGetCompactClassIndexNonImmOf: Arg0Reg into: SendNumArgsReg.
+ self genCmpClassFloatCompactIndexR: SendNumArgsReg.
+ jumpNotBoxedFloat := cogit JumpNonZero: 0.
+ self genGetDoubleValueOf: Arg0Reg into: DPFPReg1.
+ cogit Jump: doOp.
+ jumpImmediate jmpTarget:
+ (jumpNotBoxedFloat jmpTarget:
+ (jumpNotSmallInteger jmpTarget:
+ (jumpFailAlloc jmpTarget: cogit Label))).
- jumpFailClass jmpTarget: cogit Label.
- jumpNonInt jmpTarget: jumpFailClass getJmpTarget.
preOpCheckOrNil ifNotNil:
+ [jumpFailCheck jmpTarget: jumpFailAlloc getJmpTarget].
- [jumpFailCheck jmpTarget: jumpFailClass getJmpTarget].
- jumpFailAlloc jmpTarget: cogit Label.
^0!
Item was changed:
----- Method: CogObjectRepresentationFor64BitSpur>>genSmallFloatComparison:invert: (in category 'primitive generators') -----
genSmallFloatComparison: jumpOpcodeGenerator invert: invertComparison
<var: #jumpOpcodeGenerator declareC: 'AbstractInstruction *(*jumpOpcodeGenerator)(void *)'>
+ | jumpImmediate jumpNotSmallFloat jumpNotSmallInteger jumpNotBoxedFloat jumpCond compare |
+ <var: #jumpNotSmallInteger type: #'AbstractInstruction *'>
+ <var: #jumpNotBoxedFloat type: #'AbstractInstruction *'>
+ <var: #jumpNotSmallFloat type: #'AbstractInstruction *'>
- | jumpFail jumpImmediate jumpNonInt jumpCond compare |
<var: #jumpImmediate type: #'AbstractInstruction *'>
- <var: #jumpNonInt type: #'AbstractInstruction *'>
<var: #jumpCond type: #'AbstractInstruction *'>
- <var: #compare type: #'AbstractInstruction *'>
- <var: #jumpFail type: #'AbstractInstruction *'>
cogit genLoadArgAtDepth: 0 into: Arg0Reg.
+ self genGetSmallFloatValueOf: ReceiverResultReg scratch: TempReg into: DPFPReg0.
+ cogit
+ MoveR: Arg0Reg R: ClassReg;
+ AndCq: objectMemory tagMask R: ClassReg;
+ CmpCq: objectMemory smallFloatTag R: ClassReg.
+ jumpNotSmallFloat := cogit JumpNonZero: 0.
+ 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].
- self genGetSmallFloatValueOf: ReceiverResultReg scratch: SendNumArgsReg into: DPFPReg0.
- jumpImmediate := self genJumpImmediate: Arg0Reg.
- self genGetCompactClassIndexNonImmOf: Arg0Reg into: SendNumArgsReg.
- self genCmpClassFloatCompactIndexR: SendNumArgsReg.
- jumpFail := cogit JumpNonZero: 0.
- self genGetDoubleValueOf: Arg0Reg into: DPFPReg1.
- invertComparison "May need to invert for NaNs"
- ifTrue: [compare := cogit CmpRd: DPFPReg0 Rd: DPFPReg1]
- ifFalse: [compare := 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 CmpCq: objectMemory smallIntegerTag R: ClassReg).
+ jumpNotSmallInteger := cogit JumpNonZero: 0.
- jumpImmediate jmpTarget: cogit Label.
- self maybeGenConvertIfSmallFloatIn: Arg0Reg scratchReg: TempReg into: DPFPReg1 andJumpTo: compare.
- jumpNonInt := self genJumpNotSmallInteger: Arg0Reg scratchReg: TempReg.
self genConvertSmallIntegerToIntegerInReg: Arg0Reg.
cogit ConvertR: Arg0Reg Rd: DPFPReg1.
cogit Jump: compare.
+ jumpNotSmallInteger jmpTarget: (cogit CmpCq: 0 R: ClassReg).
+ jumpImmediate := cogit JumpNonZero: 0.
+ 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).
- jumpNonInt jmpTarget: (jumpFail jmpTarget: cogit Label).
^CompletePrimitive!
Item was changed:
----- Method: Spur64BitMMLECoSimulator>>freeStart (in category 'accessing') -----
freeStart
+ "freeStart = 16r328C68 ifTrue: [self halt]."
- freeStart = 16r328C68 ifTrue: [self halt].
^super freeStart!
More information about the Vm-dev
mailing list