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

commits at source.squeak.org commits at source.squeak.org
Thu Nov 8 20:50:49 UTC 2018


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

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

Name: VMMaker.oscog-eem.2482
Author: eem
Time: 8 November 2018, 12:50:24.101736 pm
UUID: 7df020b4-6565-4768-9e4a-75bc5464ed95
Ancestors: VMMaker.oscog-eem.2481

Slang
Fix mis-handling of trailing boolean on inlining in conditionals when trailing boolean would cause the conditional to be taken.  e.g. in
	self tryCopyingBitsQuickly ifTrue:
		[^nil].
tryCopyingBitsQuickly ends with ^true but the in lining code handled the trailing ^true by taking the fall-through path past the ^nil.

Comnsequently fix a regression in the BitBlt primitive caused by cleanups in VMMaker.oscog-eem.2461.

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

Item was changed:
  ----- Method: TMethod>>inlineReturningConditional:in: (in category 'inlining') -----
  inlineReturningConditional: aSendNode in: aCodeGen
  	"Inline
  		aSend ifTrue:/ifFalse: [^expr]
  	 where aSend is inlineable and always answers booleans.  We inline ^expr
  	 into aSend."
  	| returnIfTrue returnNode replacementTree map lastNode label method |
  	self assert: self == aCodeGen currentMethod.
  	self assert: (self isInlineableConditional: aSendNode in: aCodeGen).
  	aCodeGen maybeBreakForInlineOf: aSendNode receiver in: self.
  	returnIfTrue := aSendNode selector = #ifTrue:.
  	returnNode := aSendNode args first.
  	method := (aCodeGen methodNamed: aSendNode receiver selector) copy.
  	replacementTree := method inlineFunctionCall: aSendNode receiver in: aCodeGen.
  	map := Dictionary new.
+ 	"The last node is either a return or a boolean constant."
+ 	lastNode := replacementTree statements last.
+ 	replacementTree statements last isReturn
+ 		ifTrue:
+ 			[replacementTree statements last expression value == returnIfTrue ifTrue:
+ 				[lastNode := nil "i.e. take the fall-through path and /don't/ return"]]
+ 		ifFalse:
+ 			[self assert: (lastNode isConstant and: [#(true false) includes: lastNode value]).
+ 			 lastNode value == returnIfTrue ifTrue: "i.e. /do/ return"
+ 				[map at: lastNode put: returnNode]].
- 	(replacementTree statements last isReturn
- 	 and: [replacementTree statements last expression value = returnIfTrue not]) ifTrue:
- 		[lastNode := replacementTree statements last].
  	replacementTree nodesDo:
  		[:node| | expr |
  		 node isReturn ifTrue:
  			[expr := node expression.
  			 self assert: (expr isConstant and: [#(true false) includes: expr value]).
  			 map
  				at: node
  				put: (expr value == returnIfTrue
  						ifTrue: [returnNode]
  						ifFalse:
  							[node == lastNode
  								ifTrue: [TLabeledCommentNode new setComment: 'end ', aSendNode receiver selector, '; fall through']
  								ifFalse:
  									[label ifNil:
  										[label := TLabeledCommentNode new setLabel:
  													(self unusedLabelForInlining: method)].
  									 TGoToNode new setLabel: label label]])]].
  	replacementTree replaceNodesIn: map.
  	self addVarsDeclarationsAndLabelsOf: method except: method args.
  	replacementTree comment: {'inline ', aSendNode receiver selector}.
  	^label
  		ifNil: [replacementTree]
  		ifNotNil:
  			[TStmtListNode new
  				setArguments: #()
  				statements: {replacementTree. label}]!



More information about the Vm-dev mailing list