[Vm-dev] VM Maker: VMMaker.oscog-eem.690.mcz

commits at source.squeak.org commits at source.squeak.org
Thu May 1 03:03:20 UTC 2014


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.690.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.690
Author: eem
Time: 30 April 2014, 8:00:56.648 pm
UUID: 1f1c7329-a51b-4b95-b7c1-dc6adc9c10dc
Ancestors: VMMaker.oscog-eem.689

Horrible hack to fix regression in inlining of numRegArgs due
to necessary refactoring of numRegArgs on adding the Spur
object representation.

=============== Diff against VMMaker.oscog-eem.689 ===============

Item was added:
+ ----- 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: #preferredNumArgs)
+ 	 and: [(self >> #preferredNumRegArgs) messages asArray ~= #(subclassResponsibility)]) ifTrue:
+ 		[(aCodeGen methodNamed: #numRegArgs) ifNotNil:
+ 			[:aTMethod| | doppelganger |
+ 			 aTMethod compiledMethod messages asArray = #(preferredNumRegArgs) ifTrue:
+ 				[doppelganger := (self >> #preferredNumRegArgs) asTranslationMethodOfClass: TMethod.
+ 				 doppelganger selector: #numRegArgs.
+ 				 aCodeGen
+ 					removeMethodForSelector: #numRegArgs;
+ 					addMethod: doppelganger]]]!



More information about the Vm-dev mailing list