Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3097.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3097 Author: eem Time: 26 October 2021, 12:58:51.993673 pm UUID: 811f869f-630c-4d34-9a4b-beb526c9f771 Ancestors: VMMaker.oscog-eem.3096
Spur Slang: improve a couple of comments.
=============== Diff against VMMaker.oscog-eem.3096 ===============
Item was changed: ----- Method: CCodeGenerator>>accessorDepthForMethod: (in category 'spur primitive compilation') ----- accessorDepthForMethod: method "TMethod" "Compute the depth the method traverses object structure, assuming it is a primitive. + This is in support of Spur's lazy become. A primitive may fail in argument validation + because it encounters a forwarder. The primitive failure code needs to know to what + depth it must follow arguments to find forwarders, so that if any are found, they can + be followed and the primitive retried. - This is in support of Spur's lazy become. A primitive may fail because it may encounter - a forwarder. The primitive failure code needs to know to what depth it must follow - arguments to find and forwarders and, if any are found, retry the primitive.
This method determines that depth. It starts by collecting references to the stack and then follows these through assignments to variables and use of accessor methods such as fetchPointer:ofObject:. For example | obj field | obj := self stackTop. field := objectMemory fetchPointer: 1 ofObject: obj. self storePointer: 1 ofObject: field withValue: (self stackValue: 1) has depth 2, since field is accessed, and field is an element of obj.
The information is cached since it needs to be computed *before* inlining." ^accessorDepthCache at: method smalltalkSelector ifAbsentPut: [beganInlining ifTrue: [(method export or: [vmClass notNil or: [vmClass primitiveTable includes: method smalltalkSelector]]) ifTrue: [-1] ifFalse: [self error: 'it is too late to compute accessor depths!!']] ifFalse: [((method definingClass includesSelector: method smalltalkSelector) ifTrue: [(method definingClass >> method smalltalkSelector) pragmaAt: #accessorDepth:]) ifNotNil: [:pragma| pragma arguments first] ifNil: ["Deal with the primitiveFoo objectMemory hasSpurMemoryManagerAPI ifTrue: [self primitiveFooSpur] ifFalse: [self primitiveFooV3] cliché" method extractSpurPrimitiveSelector ifNotNil: [:actualSelector| | subMethod | (subMethod := self methodNamed: actualSelector) ifNil: [subMethod := self compileToTMethodSelector: actualSelector in: method definingClass]. self accessorDepthForMethod: subMethod] ifNil: [self accessorDepthForMethod: method interpreterClass: (vmClass ifNil: [StackInterpreter])]]]]!
Item was changed: ----- Method: CCodeGenerator>>accessorDepthForMethod:interpreterClass: (in category 'spur primitive compilation') ----- accessorDepthForMethod: method interpreterClass: interpreterClass "Answer the maximal length of access paths from arguments through objects, in the method, + assuming it is a primitive. This is in support of Spur's lazy become. A primitive may fail in + argument validation because it encounters a forwarder. The primitive failure code needs to + know to what depth it must follow arguments to find forwarders, so that if any are found, + they can be followed and the primitive retried. This method computes that depth. + It starts by collecting references to the stack and then follows these through assignments + to variables and use of accessor methods such as fetchPointer:ofObject:. - assuming it is a primitive. This is in support of Spur's lazy become. A primitive may fail because - it may encounter a forwarder. The primitive failure code needs to know to what depth it must - follow arguments to follow forwarders and, if any are found and followed, retry the primitive. - This method determines that depth. It starts by collecting references to the stack and then follows - these through assignments to variables and use of accessor methods such as fetchPointer:ofObject:. For example | obj field | obj := self stackTop. field := objectMemory fetchPointer: 1 ofObject: obj. self storePointer: 1 ofObject: field withValue: (self stackValue: 1) has depth 2, since field is accessed, and field is an element of obj."
| chains | chains := self accessorsAndAssignmentsForMethod: method actuals: (self actualsForMethod: method) depth: 0 interpreterClass: interpreterClass into: [:roots :accessors :assignments| self transitiveClosureOfAccessorChainRoots: roots accessors: accessors assignments: assignments]. "Now compute the maximal length and subtract 1. The depth for a stack access is 0. The depth of an access to an object taken from the stack is 1, etc. And the depth for no access is -1." ^(chains inject: 0 into: [:maximumLength :chain| maximumLength max: (self accessorDepthForChain: chain)]) - 1!
vm-dev@lists.squeakfoundation.org