[Vm-dev] VM Maker: VMMaker.oscog-eem.691.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu May 1 03:43:05 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.691.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.691
Author: eem
Time: 30 April 2014, 8:39:21.591 pm
UUID: b0b20002-0154-49db-938c-4e251f419472
Ancestors: VMMaker.oscog-eem.690
Get the hack in VMMaker.oscog-eem.690 to work. Need to
use the right selector and need to merge properties cuz
numregArgs should be an api method.
=============== Diff against VMMaker.oscog-eem.690 ===============
Item was changed:
----- Method: CogObjectRepresentation class>>prepareToBeAddedToCodeGenerator: (in category 'translation') -----
prepareToBeAddedToCodeGenerator: aCodeGen
"This is a horrible hack to keep an optimization lost by necessary
refactoring of StackToRegisterMappingCogit>>#numRegArgs
when the Spur object representation was added. Avert your gaze?
Refactoring was needed because SimpleStackBasedCogit defines numregArgs as ^0,
so if the object representations also defined numregArgs there would be a clash.
To make numRegArgs a method that answers a constant and hence a
method that Slang will inline at compile time and do code elimination on,
we slam in the preferredNumRegArgs method that does answer a constant.
Another option I played with was defining a <soft> pragma that would be used in
the object representation's numRegArgs, which would cause the code generator
to discard it when used with the SimpleStackBasedCogit, and allow the numRegArgs
in StackToRegisterMappingCogit to have the <doNotGenerate> pragma. Which hack
to prefer is up for debate."
+ ((self includesSelector: #preferredNumRegArgs)
- ((self includesSelector: #preferredNumArgs)
and: [(self >> #preferredNumRegArgs) messages asArray ~= #(subclassResponsibility)]) ifTrue:
[(aCodeGen methodNamed: #numRegArgs) ifNotNil:
[:aTMethod| | doppelganger |
aTMethod compiledMethod messages asArray = #(preferredNumRegArgs) ifTrue:
+ [doppelganger := aCodeGen compileToTMethodSelector: #preferredNumRegArgs in: self.
- [doppelganger := (self >> #preferredNumRegArgs) asTranslationMethodOfClass: TMethod.
doppelganger selector: #numRegArgs.
+ doppelganger mergePropertiesOfSuperMethod: aTMethod.
aCodeGen
removeMethodForSelector: #numRegArgs;
addMethod: doppelganger]]]!
More information about the Vm-dev
mailing list