Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3348.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3348 Author: eem Time: 13 February 2024, 1:01:03.104378 pm UUID: 5a9b79ce-4d0c-4368-96a3-ad3d4147ff63 Ancestors: VMMaker.oscog-eem.3347
Implement VMMaker.oscog-eem.3340 correctly (Slang: fix an inlining bug where inlined struct sends would have their receiver renamed to a parameter, causing the receivers to no longer be elided as required).
Improve selector printing for Cog methods by identifying those with nil selectors.
=============== Diff against VMMaker.oscog-eem.3347 ===============
Item was added: + ----- Method: CCodeGenerator>>isKnownSelector: (in category 'utilities') ----- + isKnownSelector: sel + "Answer if the given selector is one of the selectors known to the VM, i.e. a method, or a built-in." + + ^(methods includesKey: sel) or: [(self isKernelSelector: sel) or: [translationDict includesKey: sel]]!
Item was changed: ----- Method: Cogit>>methodSelectorStringFor: (in category 'disassembly') ----- methodSelectorStringFor: cogMethod "Answer either the hex string or the selector for a method, if it has a valid selector. For full blocks, prepend ``[full address] '' to the selector." <doNotGenerate> cogMethod cmIsFullBlock ifTrue: [| rawString | rawString := String streamContents: [:s| s nextPutAll: '[full '. cogMethod asInteger printOn: s base: 16. "omits 16r prefix". s nextPut: $]]. (coInterpreter maybeSelectorOfMethod: cogMethod methodObject) ifNotNil: [:selector| (objectRepresentation couldBeObject: selector) ifTrue: [^rawString, ' ', (coInterpreter stringOf: selector)]]. ^rawString].
+ cogMethod selector = objectMemory nilObject ifTrue: + [^cogMethod asInteger hex,'(nil sel)']. + + (objectRepresentation couldBeObject: cogMethod selector) ifTrue: - (cogMethod selector ~= objectMemory nilObject - and: [objectRepresentation couldBeObject: cogMethod selector]) ifTrue: [^coInterpreter stringOf: cogMethod selector].
^cogMethod asInteger hex!
Item was removed: - ----- Method: TMethod>>isStructMethod (in category 'testing') ----- - isStructMethod - ^[definingClass isStructClass] - on: MessageNotUnderstood - do: [:ex| false]!
Item was removed: - ----- Method: TMethod>>protectToBeExcludedReceiversForInlining (in category 'inlining support') ----- - protectToBeExcludedReceiversForInlining - "Any struct sends whose receivers will be elided must not be renamed on inlining, as this could prevent their elision when code is generated. Instead, these receivers are renamed to 'self_in_inlined_method' to ensure they persist to be elided when code is generated." - - parseTree nodesWithParentsDo: - [ :node :parent| - (node isVariable - and: [(node name beginsWith: 'self_in_') - and: [parent notNil - and: [parent isSend - and: [parent receiver == node]]]]) ifTrue: - [parent receiver: (TVariableNode new setName: #'self_in_inlined_method')]]!
Item was added: + ----- Method: TMethod>>protectToBeExcludedReceiversForInliningIn: (in category 'inlining support') ----- + protectToBeExcludedReceiversForInliningIn: aCodeGen + "Any struct sends whose receivers will be elided must not be renamed on inlining, as this could prevent their elision when code is generated. Instead, these receivers are renamed to 'self_in_inlined_method' to ensure they persist to be elided when code is generated." + + parseTree nodesWithParentsDo: + [ :node :parent| + (node isVariable + and: [(node name beginsWith: 'self_in_') + and: [parent notNil + and: [parent isSend + and: [parent receiver == node + and: [(aCodeGen isKnownSelector: parent selector) not]]]]]) ifTrue: + [parent receiver: (TVariableNode new setName: #'self_in_inlined_method')]]!
Item was changed: ----- Method: TMethod>>renameVarsForInliningInto:except:in: (in category 'inlining support') ----- renameVarsForInliningInto: destMethod except: doNotRename in: aCodeGen "Rename any variables that would clash with those of the destination method."
| destVars usedVars varMap newVarName | destVars := aCodeGen globalsAsSet copy. destVars addAll: destMethod locals. destVars addAll: destMethod args. usedVars := destVars copy. "keeps track of names in use" usedVars addAll: args; addAll: locals. varMap := Dictionary new: 100. locals, args do: [ :v | ((doNotRename includes: v) not and: [destVars includes: v]) ifTrue: [newVarName := self unusedNamePrefixedBy: v avoiding: usedVars. varMap at: v put: newVarName]]. + self protectToBeExcludedReceiversForInliningIn: aCodeGen. self renameVariablesUsing: varMap!
Item was removed: - ----- Method: TSendNode>>nodeIsThisSendsStructReceiver: (in category 'inlining support') ----- - nodeIsThisSendsStructReceiver: aTParseNode - ^aTParseNode == receiver - and: [receiver name beginsWith: 'self_in_']!
vm-dev@lists.squeakfoundation.org