Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3367.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3367 Author: eem Time: 18 April 2024, 7:51:44.62085 pm UUID: a7ed57b3-cc68-438c-833d-9b33287ad4ab Ancestors: VMMaker.oscog-eem.3366
Spur Cogit: Improve decoration of the rClass load when selector indices are used. Decode a linked send's class index to its class.
=============== Diff against VMMaker.oscog-eem.3366 ===============
Item was added: + ----- Method: CogAbstractInstruction>>cacheTagLoadInstructionBytes (in category 'accessing') ----- + cacheTagLoadInstructionBytes + "This is a default, overridden in a few choice cases." + ^self literalLoadInstructionBytes!
Item was added: + ----- Method: CogObjectRepresentation>>lookupMaybeInlineCacheTag: (in category 'disassembly') ----- + lookupMaybeInlineCacheTag: anInteger + <doNotGenerate> + ^cogit lookupAddress: anInteger!
Item was added: + ----- Method: CogObjectRepresentationForSpur>>lookupMaybeInlineCacheTag: (in category 'disassembly') ----- + lookupMaybeInlineCacheTag: anInteger + <doNotGenerate> + | classOrNil | + ^((objectMemory isValidClassIndex: anInteger) + and: [(classOrNil := objectMemory classOrNilAtIndex: anInteger) ~= objectMemory nilObject + and: [coInterpreter objCouldBeClassObj: classOrNil]]) + ifTrue: [coInterpreter nameOfClass: classOrNil] + ifFalse: [cogit lookupAddress: anInteger]!
Item was added: + ----- Method: CogX64Compiler>>cacheTagLoadInstructionBytes (in category 'accessing') ----- + cacheTagLoadInstructionBytes + "The inline cache always uses a 32-bit load, which is always 7 bytes" + ^7!
Item was changed: ----- Method: Cogit>>lookupAddress: (in category 'disassembly') ----- lookupAddress: address <doNotGenerate> + address isInteger ifFalse: + [^nil]. address < methodZone freeStart ifTrue: [^address >= methodZoneBase ifTrue: [(methodZone methodFor: address) ifNotNil: [:cogMethod| (self methodSelectorStringFor: cogMethod), '@', ((address - cogMethod asInteger) hex allButFirst: 3)]] ifFalse: [(self trampolineRangeFor: address) ifNotNil: [:range| (self codeEntryNameFor: range first) ifNotNil: [:name| name, (address = range first ifTrue: [''] ifFalse: [' + ', (address - range first) hex])]]]]. (simulatedTrampolines includesKey: address) ifTrue: [^self labelForSimulationAccessor: (simulatedTrampolines at: address)]. (simulatedVariableGetters includesKey: address) ifTrue: ["In methods varBaseAddress is typically stackLimitFromMachineCode, but in trampolines it is typically varBaseAddress..." (varBaseAddress isInteger and: [address = varBaseAddress and: [disassemblingMethod isNil]]) ifTrue: [^'VarBaseAddress']. ^self labelForSimulationAccessor: (simulatedVariableGetters at: address)]. ^(coInterpreter lookupAddress: address) ifNil: [address = self cStackPointerAddress ifTrue: [#CStackPointer] ifFalse: [address = self cFramePointerAddress ifTrue: [#CFramePointer]]]!
Item was added: + ----- Method: Cogit>>lookupAddress:at:couldBeRClassLoad: (in category 'disassembly') ----- + lookupAddress: address at: instructionAddress couldBeRClassLoad: couldBeRClassLoad + <doNotGenerate> + "This is to allow us to informatively decorate selector literal index/class index loads in inline caches in Spur. + If the instruction is follwed by a call instruction then we can tell if it is linked by the address or not." + | offset | + offset := backEnd cacheTagLoadInstructionBytes + backEnd callInstructionByteSize. + (couldBeRClassLoad + and: [instructionAddress between: methodZoneBase and: methodZone freeStart - 1 - offset]) ifTrue: + [(methodZone methodFor: instructionAddress) ifNotNil: + [:cogMethod| | target selector | + (cogMethod cmType >= CMBlock + and: [cogMethod stackCheckOffset > 0 + and: [instructionAddress >= (cogMethod asInteger + cogMethod stackCheckOffset) + and: [backEnd isCallPrecedingReturnPC: instructionAddress + offset]]]) ifTrue: + [address isString ifTrue: + [| addressValue signExtendedAddress | + self assert: (address beginsWith: '0x'). + addressValue := Number readFrom: (address allButFirst: 2) base: 16. + signExtendedAddress := addressValue > (1 << (8 * objectRepresentation wordSize - 1) - 1) + ifTrue: [addressValue - (1 << (8 * objectRepresentation wordSize))] + ifFalse: [addressValue]. + ^self + lookupAddress: signExtendedAddress + at: instructionAddress + couldBeRClassLoad: couldBeRClassLoad]. + target := backEnd callTargetFromReturnAddress: instructionAddress + offset. + target > methodZoneBase ifTrue: "i.e. a linked send" + [^objectRepresentation lookupMaybeInlineCacheTag: address]. + self inlineCacheTagsAreIndexes ifTrue: + [selector := address < 0 + ifTrue: [(coInterpreter specialSelector: -1 - address)] + ifFalse: [coInterpreter literal: address ofMethod: cogMethod methodObject]. + ^self lookupAddress: selector]]]]. + ^self lookupAddress: address!
Item was changed: ----- Method: Cogit>>lookupCHexString: (in category 'disassembly') ----- lookupCHexString: aCHexString <doNotGenerate> + | shortened address | - | pastLastZero shortened address | (aCHexString beginsWith: '0x') ifFalse: [^aCHexString]. + shortened := self shortenCHexString: aCHexString. - pastLastZero := aCHexString findFirst: [:c| c ~= $0 and: [c ~= $x]]. - shortened := pastLastZero = 0 - ifTrue: ['0x0'] - ifFalse: - [(aCHexString size >= 16 and: [pastLastZero >= 4]) - ifTrue: [aCHexString copyReplaceFrom: 3 to: pastLastZero - 1 with: ''] - ifFalse: [aCHexString]]. address := Number readFrom: (ReadStream on: shortened from: 3 to: shortened size) base: 16. (disassemblingMethod notNil and: [address > disassemblingMethod and: [address < (disassemblingMethod asInteger + disassemblingMethod blockSize)]]) ifTrue: [shortened := '.+', (address - disassemblingMethod asInteger printStringBase: 16 length: 4 padded: true)]. ^(self lookupAddress: (Number readFrom: (ReadStream on: shortened from: 3 to: shortened size) base: 16)) ifNotNil: [:string| shortened, '=', string] ifNil: [shortened]!
Item was added: + ----- Method: Cogit>>shortenCHexString: (in category 'disassembly') ----- + shortenCHexString: aCHexString + <doNotGenerate> + | pastLastZero | + (aCHexString beginsWith: '0x') ifFalse: + [^aCHexString]. + pastLastZero := aCHexString findFirst: [:c| c ~= $0 and: [c ~= $x]]. + ^pastLastZero = 0 + ifTrue: ['0x0'] + ifFalse: + [(aCHexString size >= 16 and: [pastLastZero >= 4]) + ifTrue: [aCHexString copyReplaceFrom: 3 to: pastLastZero - 1 with: ''] + ifFalse: [aCHexString]]!
Item was added: + ----- Method: CurrentImageCoInterpreterFacadeForSpurObjectRepresentation>>isValidClassIndex: (in category 'disassembly') ----- + isValidClassIndex: anInteger + (anInteger between: 1 and: (2 raisedTo: 22) - 1) ifTrue: + [Smalltalk allClassesDo: + [:c| + ((c hasIdentityHash and: [c identityHash = anInteger]) + or: [c class identityHash = anInteger]) ifTrue: + [^true]]]. + ^false!
vm-dev@lists.squeakfoundation.org