[Vm-dev] VM Maker: VMMaker.oscog-eem.892.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Oct 7 00:24:50 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.892.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.892
Author: eem
Time: 6 October 2014, 5:20:39.792 pm
UUID: 8054d05d-3157-4dd0-b7d6-82df62e46ae2
Ancestors: VMMaker.oscog-eem.891
Stop addMethodFor:selector: from removing methods
unless a doNotGenerate overrides a superclass
implementation. Make isInlineableConditional:in: use
anyMethodNamed:. This rescues #numRegArgs usage
in the CoInterpreter with SimpleStackBasedCogit.
=============== Diff against VMMaker.oscog-eem.891 ===============
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]].
- [methods removeKey: selector]].
^nil].
method isSubclassResponsibility ifTrue:
+ [^nil].
- [methods removeKey: selector ifAbsent: [].
- ^nil].
(self shouldIncludeMethodFor: aClass selector: selector) ifFalse:
+ [^nil].
- [methods removeKey: selector ifAbsent: [].
- ^nil].
tmethod := self compileToTMethodSelector: selector in: aClass.
"Even thoug we exclude initialize methods, we must consider their
global variable usage, otherwise globals may be incorrectly localized."
selector == #initialize ifTrue:
[self checkForGlobalUsage: tmethod allReferencedVariables 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 propertyValueAt: #cmacro:) ifNotNil:
[:macro|
self addMacro: macro for: selector.
(inlineList includes: selector) ifTrue:
[inlineList := inlineList copyWithout: selector]].
^tmethod!
Item was changed:
----- Method: TMethod>>isInlineableConditional:in: (in category 'inlining') -----
isInlineableConditional: aSendNode in: aCodeGen
"Answer if the given send node is of the form aSend [ifTrue:|ifFalse:] [statements]
where the method for aSend is marked as inline and all returns within it answer booleans."
|method |
^(#(ifTrue: ifFalse:) includes: aSendNode selector)
and: [aSendNode receiver isSend
+ and: [(method := aCodeGen anyMethodNamed: aSendNode receiver selector) notNil
- and: [(method := aCodeGen methodNamed: aSendNode receiver selector) notNil
and: [method inline == true
and: [method parseTree statements last isReturn
and: [method parseTree allSatisfy:
[:node|
node isReturn not
or: [node expression isConstant
and: [#(true false) includes: node expression value]]]]]]]]!
More information about the Vm-dev
mailing list