Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2298.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2298 Author: eem Time: 20 December 2017, 10:55:04.881437 pm UUID: e8cddc90-a9f5-4eb7-90a4-b0efbda600bb Ancestors: VMMaker.oscog-eem.2297
Cogit: More work to full 64-bit access in at:[put:] primitives. Fix slip in x64 setsConditionCodesFor:.
Correct 16-bit bounds check in at:.
Implement 64-bit long access in at:put:.
Neither primitive is correct as yet.
=============== Diff against VMMaker.oscog-eem.2297 ===============
Item was changed: ----- Method: CogObjectRepresentationFor64BitSpur>>genAlloc64BitIntegerValue:into:scratchReg:scratchReg: (in category 'primitive generators') ----- genAlloc64BitIntegerValue: valueReg into: resultReg scratchReg: scratch1 scratchReg: scratch2 <returnTypeC: #'AbstractInstruction *'> | allocSize newLPIHeader jumpFail | <var: #jumpFail type: #'AbstractInstruction *'> allocSize := objectMemory baseHeaderSize + objectMemory wordSize. newLPIHeader := objectMemory headerForSlots: 1 format: objectMemory firstByteFormat classIndex: ClassLargePositiveIntegerCompactIndex. cogit MoveAw: objectMemory freeStartAddress R: resultReg. cogit LoadEffectiveAddressMw: allocSize r: resultReg R: scratch1. cogit CmpCq: objectMemory getScavengeThreshold R: scratch1. jumpFail := cogit JumpAboveOrEqual: 0. cogit MoveR: scratch1 Aw: objectMemory freeStartAddress. self genStoreHeader: newLPIHeader intoNewInstance: resultReg using: scratch1. + cogit MoveR: valueReg Mw: objectMemory baseHeaderSize r: resultReg. - cogit MoveR: valueReg M64: objectMemory baseHeaderSize r: resultReg. ^jumpFail!
Item was changed: ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveAt (in category 'primitive generators') ----- genPrimitiveAt + | formatReg nSlotsOrElementsReg convertToIntAndReturn methodInBounds - | formatReg nSlotsOrBytesReg 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. - nSlotsOrBytesReg := 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. - self genGetNumSlotsOf: ReceiverResultReg into: nSlotsOrBytesReg.
"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). - (cogit CmpR: Arg1Reg R: nSlotsOrBytesReg). 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. - (cogit LogicalShiftLeftCq: objectMemory shiftForWord R: nSlotsOrBytesReg). - cogit AndCq: objectMemory wordSize - 1 R: formatReg R: TempReg. - cogit SubR: TempReg R: nSlotsOrBytesReg; - CmpR: Arg1Reg R: nSlotsOrBytesReg. 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. - (cogit LogicalShiftLeftCq: objectMemory shiftForWord - 1 R: nSlotsOrBytesReg). - cogit AndCq: 1 R: formatReg. - cogit SubR: formatReg R: nSlotsOrBytesReg; - CmpR: Arg1Reg R: nSlotsOrBytesReg. 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. - (cogit CmpR: Arg1Reg R: nSlotsOrBytesReg). 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. - SubR: formatReg R: nSlotsOrBytesReg; - CmpR: Arg1Reg R: nSlotsOrBytesReg. 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). - (cogit CmpR: Arg1Reg R: nSlotsOrBytesReg). 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 R: TempReg. "If in range this is now 0" (cogit lastOpcode setsConditionCodesFor: JumpZero) ifFalse: + [cogit CmpCq: 0 R: TempReg]. "N.B. FLAGS := ClassReg - 0" - [cogit CmpCq: 0 R: ClassReg]. "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. - self getLiteralCountOf: ReceiverResultReg plusOne: true inBytes: true into: nSlotsOrBytesReg scratch: TempReg. - cogit CmpR: Arg1Reg R: nSlotsOrBytesReg. 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!
Item was changed: ----- Method: CogObjectRepresentationFor64BitSpur>>genPrimitiveAtPut (in category 'primitive generators') ----- genPrimitiveAtPut | formatReg nSlotsOrBytesReg methodInBounds jumpImmediate jumpBadIndex jumpImmutable jumpNotIndexablePointers jumpNotIndexableBits + jumpIsContext jumpIsCompiledMethod jumpIsBytes jumpIsShorts jumpIsWords jumpHasFixedFields - jumpIsContext jumpIsCompiledMethod jumpIsBytes jumpIsShorts jumpHasFixedFields jumpArrayOutOfBounds jumpFixedFieldsOutOfBounds jumpWordsOutOfBounds jumpShortsOutOfBounds jumpBytesOutOfBounds jumpShortsOutOfRange jumpWordsOutOfRange jumpBytesOutOfRange jumpNonSmallIntegerValue jumpNotPointers + rejoin jumpNegative jump64BitsOutOfBounds jumpNot64BitIndexable jump64BitArgIsImmediate jumpNot8ByteInteger | "c.f. StackInterpreter>>stSizeOf: SpurMemoryManager>>lengthOf:format: fixedFieldsOf:format:length:" <var: #jumpIsBytes type: #'AbstractInstruction *'> + <var: #jumpIsWords type: #'AbstractInstruction *'> <var: #jumpIsShorts type: #'AbstractInstruction *'> <var: #jumpBadIndex type: #'AbstractInstruction *'> <var: #jumpIsContext type: #'AbstractInstruction *'> <var: #jumpImmediate type: #'AbstractInstruction *'> <var: #methodInBounds 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 *'> + <var: #rejoin type: #'AbstractInstruction *'> + <var: #jumpNegative type: #'AbstractInstruction *'> + <var: #jumpNot8ByteInteger type: #'AbstractInstruction *'> + <var: #jumpNot64BitIndexable type: #'AbstractInstruction *'> + <var: #jump64BitsOutOfBounds type: #'AbstractInstruction *'> + <var: #jump64BitArgIsImmediate type: #'AbstractInstruction *'> - nSlotsOrBytesReg := ClassReg.
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: nSlotsOrBytesReg.
"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: nSlotsOrBytesReg. 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: Extra0Reg scratchReg: TempReg. self genLoadSlot: InstanceSpecificationIndex sourceReg: Extra0Reg destReg: formatReg. self genConvertSmallIntegerToIntegerInReg: formatReg. cogit AndCq: objectMemory fixedFieldsOfClassFormatMask R: formatReg. cogit SubR: formatReg R: nSlotsOrBytesReg. cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: formatReg. cogit CmpR: Arg0Reg R: nSlotsOrBytesReg. 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 Label. 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. + jumpIsWords := cogit JumpAboveOrEqual: 0. + cogit CmpCq: objectMemory sixtyFourBitIndexableFormat R: formatReg. + jumpNotIndexableBits := cogit JumpNonZero: 0. + "fall through to 64-bit words" + cogit MoveR: Arg1Reg R: SendNumArgsReg. + self genConvertSmallIntegerToIntegerInReg: SendNumArgsReg. + cogit CmpCq: 0 R: SendNumArgsReg. + jumpNegative := cogit JumpBelow: 0. + rejoin := + cogit CmpR: Arg0Reg R: nSlotsOrBytesReg. + jump64BitsOutOfBounds := cogit JumpBelowOrEqual: 0. + cogit AddCq: objectMemory baseHeaderSize >> objectMemory shiftForWord R: Arg0Reg. + cogit MoveR: SendNumArgsReg Xwr: Arg0Reg R: ReceiverResultReg. + cogit MoveR: Arg1Reg R: ReceiverResultReg. + cogit genPrimReturn. - "For now ignore 64-bit indexability." - jumpNotIndexableBits := cogit JumpBelow: 0.
+ jumpNonSmallIntegerValue jmpTarget: + (cogit CmpCq: objectMemory sixtyFourBitIndexableFormat R: formatReg). + jumpNot64BitIndexable := cogit JumpNonZero: 0. + jump64BitArgIsImmediate := self genJumpImmediate: Arg1Reg. + "Now check if the header is that of an 8 byte LargePositiveInteger" + cogit MoveMw: 0 r: Arg1Reg R: SendNumArgsReg. + cogit AndCq: (objectMemory + headerForSlots: objectMemory numSlotsMask + format: objectMemory formatMask + classIndex: objectMemory classIndexMask) + R: SendNumArgsReg. + cogit CmpCq: (objectMemory + headerForSlots: 1 + format: objectMemory firstByteFormat + classIndex: ClassLargePositiveIntegerCompactIndex) + R: SendNumArgsReg. + jumpNot8ByteInteger := cogit JumpNonZero: 0. + cogit MoveMw: objectMemory baseHeaderSize r: Arg1Reg R: SendNumArgsReg. + cogit Jump: rejoin. + + jumpIsWords jmpTarget: + (cogit CmpCq: (objectMemory integerObjectOf: 16rFFFFFFFF) R: Arg1Reg). - "fall through to words" - cogit CmpCq: (objectMemory integerObjectOf: 16rFFFFFFFF) R: Arg1Reg. jumpWordsOutOfRange := cogit JumpAbove: 0. cogit LogicalShiftLeftCq: objectMemory shiftForWord - 2 R: nSlotsOrBytesReg. cogit AndCq: objectMemory wordSize / 4 - 1 R: formatReg. cogit SubR: formatReg R: nSlotsOrBytesReg. cogit CmpR: Arg0Reg R: nSlotsOrBytesReg. 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: nSlotsOrBytesReg. cogit AndCq: objectMemory wordSize - 1 R: formatReg R: TempReg. cogit SubR: TempReg R: nSlotsOrBytesReg. cogit CmpR: Arg0Reg R: nSlotsOrBytesReg. jumpBytesOutOfBounds := cogit JumpBelowOrEqual: 0. cogit CmpCq: objectMemory firstCompiledMethodFormat R: formatReg. jumpIsCompiledMethod := cogit JumpAboveOrEqual: 0. methodInBounds := 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: nSlotsOrBytesReg. cogit AndCq: objectMemory wordSize / 2 - 1 R: formatReg. cogit SubR: formatReg R: nSlotsOrBytesReg. cogit CmpR: Arg0Reg R: nSlotsOrBytesReg. jumpShortsOutOfBounds := cogit JumpBelowOrEqual: 0. cogit MoveR: Arg1Reg R: TempReg. self genConvertSmallIntegerToIntegerInReg: TempReg. cogit AddR: Arg0Reg R: ReceiverResultReg. cogit AddR: Arg0Reg R: ReceiverResultReg. cogit MoveR: TempReg M16: objectMemory baseHeaderSize r: ReceiverResultReg. cogit MoveR: Arg1Reg R: ReceiverResultReg. cogit genPrimReturn.
"Now check that the index is beyond the method's literals..." jumpIsCompiledMethod jmpTarget: cogit Label. self getLiteralCountOf: ReceiverResultReg plusOne: true inBytes: true into: nSlotsOrBytesReg scratch: TempReg. cogit CmpR: Arg0Reg R: nSlotsOrBytesReg. cogit JumpBelow: methodInBounds.
+ jumpNegative jmpTarget: + (jumpNot8ByteInteger jmpTarget: + (jump64BitArgIsImmediate jmpTarget: + (jumpNot64BitIndexable jmpTarget: + (jumpIsContext jmpTarget: - jumpIsContext jmpTarget: (jumpNotIndexableBits jmpTarget: (jumpBytesOutOfRange jmpTarget: (jumpShortsOutOfRange jmpTarget: (jumpWordsOutOfRange jmpTarget: (jumpIsCompiledMethod jmpTarget: (jumpArrayOutOfBounds jmpTarget: (jumpBytesOutOfBounds jmpTarget: (jumpShortsOutOfBounds jmpTarget: (jumpWordsOutOfBounds jmpTarget: + (jump64BitsOutOfBounds jmpTarget: (jumpNotIndexablePointers jmpTarget: + (jumpFixedFieldsOutOfBounds jmpTarget: cogit Label)))))))))))))))). - (jumpNonSmallIntegerValue jmpTarget: - (jumpFixedFieldsOutOfBounds jmpTarget: cogit Label)))))))))))). self cppIf: IMMUTABILITY ifTrue: [jumpImmutable jmpTarget: jumpIsContext getJmpTarget].
cogit AddCq: 1 R: Arg0Reg. "0-rel => 1-rel" self genConvertIntegerToSmallIntegerInReg: Arg0Reg.
jumpBadIndex jmpTarget: (jumpImmediate jmpTarget: cogit Label).
^0 "Can't be complete because of contexts."!
Item was changed: ----- Method: CogX64Compiler>>setsConditionCodesFor: (in category 'testing') ----- setsConditionCodesFor: aConditionalJumpOpcode <inline: false> "to save Slang from having to be a real compiler (it can't inline switches that return)" "Answer if the receiver's opcode sets the condition codes correctly for the given conditional jump opcode." ^opcode caseOf: { [ArithmeticShiftRightCqR] -> [self shiftSetsConditionCodesFor: aConditionalJumpOpcode]. [ArithmeticShiftRightRR] -> [self shiftSetsConditionCodesFor: aConditionalJumpOpcode]. [LogicalShiftLeftCqR] -> [self shiftSetsConditionCodesFor: aConditionalJumpOpcode]. + [LogicalShiftLeftRR] -> [self shiftSetsConditionCodesFor: aConditionalJumpOpcode]. + [LogicalShiftRightCqR] -> [false]. + [XorRR] -> [true] - [LogicalShiftLeftRR] -> [self shiftSetsConditionCodesFor: aConditionalJumpOpcode]. - [LogicalShiftRightCqR] -> [self shiftSetsConditionCodesFor: aConditionalJumpOpcode]. - [XorRR] -> [true] } otherwise: [self halt: 'unhandled opcode in setsConditionCodesFor:'. false]!
Item was changed: ----- Method: StackInterpreter>>longPrintOop: (in category 'debug printing') ----- longPrintOop: oop <api> | fmt lastIndex startIP bytecodesPerLine column | ((objectMemory isImmediate: oop) or: [(objectMemory addressCouldBeObj: oop) not or: [(oop bitAnd: objectMemory allocationUnit - 1) ~= 0 or: [(objectMemory isFreeObject: oop) or: [objectMemory isForwarded: oop]]]]) ifTrue: [self printOop: oop. ^self]. self printHex: oop. (objectMemory fetchClassOfNonImm: oop) ifNil: [self print: ' has a nil class!!!!'] ifNotNil: [:class| self print: ': a(n) '; printNameOfClass: class count: 5; print: ' ('. objectMemory hasSpurMemoryManagerAPI ifTrue: [self printHexnp: (objectMemory compactClassIndexOf: oop); print: '=>']. self printHexnp: class; print: ')']. fmt := objectMemory formatOf: oop. self print: ' format '; printHexnp: fmt. fmt > objectMemory lastPointerFormat ifTrue: [self print: ' nbytes '; printNum: (objectMemory numBytesOf: oop)] ifFalse: [(objectMemory isIndexableFormat: fmt) ifTrue: [| len | len := objectMemory lengthOf: oop. self print: ' size '; printNum: len - (objectMemory fixedFieldsOf: oop format: fmt length: len)]]. objectMemory printHeaderTypeOf: oop. self print: ' hash '; printHexnp: (objectMemory rawHashBitsOf: oop). self cr. (fmt between: objectMemory firstByteFormat and: objectMemory firstCompiledMethodFormat - 1) ifTrue: [^self printStringOf: oop; cr]. (fmt between: objectMemory firstLongFormat and: objectMemory firstByteFormat - 1) ifTrue: [0 to: ((objectMemory num32BitUnitsOf: oop) min: 256) - 1 do: + [:i| | field32 | + field32 := objectMemory fetchLong32: i ofObject: oop. + self space; printNum: i; space; printHex: field32; space; cr]. - [:i| | fieldOop | - fieldOop := objectMemory fetchLong32: i ofObject: oop. - self space; printNum: i; space; printHex: fieldOop; space; cr]. ^self]. + objectMemory hasSpurMemoryManagerAPI ifTrue: + [fmt = objectMemory sixtyFourBitIndexableFormat ifTrue: + [0 to: ((objectMemory num64BitUnitsOf: oop) min: 256) - 1 do: + [:i| | field64 | + field64 := objectMemory fetchLong64: i ofObject: oop. + self space; printNum: i; space; printHex: field64; space; cr]. + ^self]. + (fmt between: objectMemory firstShortFormat and: objectMemory firstShortFormat + 1) ifTrue: + [0 to: ((objectMemory num16BitUnitsOf: oop) min: 256) - 1 do: + [:i| | field16 | + field16 := objectMemory fetchShort16: i ofObject: oop. + self space; printNum: i; space; printHex: field16; space; cr]. + ^self]]. "this is nonsense. apologies." startIP := (objectMemory lastPointerOf: oop) + objectMemory bytesPerOop - objectMemory baseHeaderSize / objectMemory bytesPerOop. lastIndex := 256 min: startIP. lastIndex > 0 ifTrue: [1 to: lastIndex do: [:i| | fieldOop | fieldOop := objectMemory fetchPointer: i - 1 ofObject: oop. self space; printNum: i - 1; space; printHex: fieldOop; space. (i = 1 and: [objectMemory isCompiledMethod: oop]) ifTrue: [self printMethodHeaderOop: fieldOop] ifFalse: [self cCode: [self printOopShort: fieldOop] inSmalltalk: [self print: (self shortPrint: fieldOop)]]. self cr]]. (objectMemory isCompiledMethod: oop) ifFalse: [startIP > lastIndex ifTrue: [self print: '...'; cr]] ifTrue: [startIP := startIP * objectMemory wordSize + 1. lastIndex := objectMemory lengthOf: oop. lastIndex - startIP > 100 ifTrue: [lastIndex := startIP + 100]. bytecodesPerLine := 8. column := 1. startIP to: lastIndex do: [:index| | byte | column = 1 ifTrue: [self cCode: 'printf("0x%08" PRIxSQPTR ": ", (usqIntptr_t)(oop+BaseHeaderSize+index-1))' inSmalltalk: [self print: (oop+objectMemory baseHeaderSize+index-1) hex; print: ': ']]. byte := objectMemory fetchByte: index - 1 ofObject: oop. self cCode: 'printf(" %02x/%-3d", (int)byte,(int)byte)' inSmalltalk: [self space; print: (byte radix: 16); printChar: $/; printNum: byte]. column := column + 1. column > bytecodesPerLine ifTrue: [column := 1. self cr]]. column = 1 ifFalse: [self cr]]!
vm-dev@lists.squeakfoundation.org