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

commits at source.squeak.org commits at source.squeak.org
Thu Nov 19 22:06:38 UTC 2020


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

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

Name: VMMaker.oscog-eem.2888
Author: eem
Time: 19 November 2020, 2:06:30.613338 pm
UUID: 4ab1879f-b54c-4058-9623-0e9566427b23
Ancestors: VMMaker.oscog-eem.2887

Fix a Slang regression in VMMaker.oscog-eem.2884.  The elision of unused argument assignments also elided argument expressions that had side-effects.  The fix is to retain epxressions that have side effects but generate assignments of those expressions to inlined variables only for variables that are actually used in the expansion.

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

Item was changed:
  ----- Method: TMethod>>argAssignmentsFor:send:except:in: (in category 'inlining') -----
  argAssignmentsFor: meth send: aSendNode except: elidedArgs in: aCodeGen
  	"Answer a collection of assignment nodes that assign the given argument expressions to the formal parameter variables of the given method."
  	"Optimization: If the actual parameters are either constants or local variables in the target method (the receiver), substitute them directly into the body of meth. Note that global variables cannot be substituted because the inlined method might depend on the exact ordering of side effects to the globals.
  	 Optimization: Don't answer statements for formal parameters which are unused in the method body."
  
  	| stmtList substitutionDict argList referencedArguments |
  	meth args size > (argList := aSendNode args) size ifTrue:
  		[self assert: (meth args first beginsWith: 'self_in_').
  		 argList := {aSendNode receiver}, aSendNode args].
  	stmtList := OrderedCollection new: argList size.
  	substitutionDict := Dictionary new: argList size.
  	meth args with: argList do:
  		[:argName :exprNode |
  		(self isNode: exprNode substitutableFor: argName inMethod: meth in: aCodeGen)
  			ifTrue:
  				[substitutionDict
  					at: argName
  					put: (aCodeGen
  							node: exprNode
  							typeCompatibleWith: argName
  							inliningInto: meth
  							in: self).
  				 locals remove: argName ifAbsent: [self assert: (argName beginsWith: 'self_in_')].
  				 declarations removeKey: argName ifAbsent: nil]
  			ifFalse: "Add an assignment for anything except an unused self_in_foo argument"
  				[(elidedArgs includes: argName) ifFalse:
  					[self deny: exprNode isLiteralBlock.
  					 stmtList addLast:
  						(TAssignmentNode new
  							setVariable: (TVariableNode new setName: argName)
  							expression: (aCodeGen
  											node: exprNode copy
  											typeCompatibleWith: argName
  											inliningInto: meth
  											in: self))]]].
  	meth parseTree: (meth parseTree bindVariablesIn: substitutionDict).
  	referencedArguments := meth allReferencedArgumentsUsing: aCodeGen.
+ 	^(stmtList
+ 		collect:
+ 			[:assignment|
+ 			(referencedArguments includes: assignment variable name)
+ 				ifTrue: [assignment]
+ 				ifFalse:
+ 					[assignment expression hasSideEffect ifTrue:
+ 						[assignment expression]]])
+ 		select: [:node| node notNil]!
- 	^stmtList select: [:assignment| referencedArguments includes: assignment variable name]!



More information about the Vm-dev mailing list