[Vm-dev] VM Maker: VMMaker.oscog-eem.3238.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Aug 2 18:19:45 UTC 2022
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3238.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3238
Author: eem
Time: 2 August 2022, 11:19:29.444062 am
UUID: 4b576e04-5ba8-4fc4-93c9-efdc751e9877
Ancestors: VMMaker.oscog-eem.3237
...close, but no cigar.
=============== Diff against VMMaker.oscog-eem.3237 ===============
Item was changed:
----- Method: CCodeGenerator>>addMethodFor:selector: (in category 'utilities') -----
addMethodFor: aClass selector: selector
"Add the given method to the code base and answer its translation
or nil if it shouldn't be translated."
| method tmethod |
method := aClass compiledMethodAt: selector.
(method pragmaAt: #doNotGenerate) ifNotNil:
["only remove a previous method if this one overrides it, i.e. this is a subclass method.
If the existing method is in a different hierarchy this method must be merely a redeirect."
(methods at: selector ifAbsent: []) ifNotNil:
[:tm|
(aClass includesBehavior: tm definingClass) ifTrue:
[self removeMethodForSelector: selector]].
^nil].
method isSubclassResponsibility ifTrue:
[^nil].
(self shouldIncludeMethodFor: aClass selector: selector) ifFalse:
[^nil].
tmethod := self compileToTMethodSelector: selector in: aClass.
"Even though we exclude initialize methods, we must consider their
global variable usage, otherwise globals may be incorrectly localized."
selector == #initialize ifTrue:
[self checkForGlobalUsage: (tmethod allReferencedVariablesUsing: self) in: tmethod.
^nil].
self addMethod: tmethod.
"If the method has a macro then add the macro. But keep the method
for analysis purposes (e.g. its variable accesses)."
(method pragmaAt: #cmacro:) ifNotNil:
[:pragma|
self addMacro: (pragma argumentAt: 1) for: selector.
(inlineList includes: selector) ifTrue:
[inlineList := inlineList copyWithout: selector]].
(method pragmaAt: #cmacro) ifNotNil:
[:pragma| | literal | "Method should be just foo ^const"
self assert: (self isValidMacroMethod: method).
+ literal := (method isQuick or: [method numArgs = 1])
- literal := method isQuick
ifTrue: [method decompile quickMethodReturnLiteral]
ifFalse: [method literalAt: 1].
self addMacro: '() ', (method isReturnField
ifTrue: [literal]
ifFalse: [self cLiteralFor: literal value name: method selector]) for: selector.
(inlineList includes: selector) ifTrue:
[inlineList := inlineList copyWithout: selector]].
^tmethod!
More information about the Vm-dev
mailing list