VM Maker: VMMaker.oscog-eem.2482.mcz

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

VM Maker: VMMaker.oscog-eem.2482.mcz

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:

==================== 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

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:
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
  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]).
  at: node
  put: (expr value == returnIfTrue
  ifTrue: [returnNode]
  [node == lastNode
  ifTrue: [TLabeledCommentNode new setComment: 'end ', aSendNode receiver selector, '; fall through']
  [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}.
  ifNil: [replacementTree]
  [TStmtListNode new
  setArguments: #()
  statements: {replacementTree. label}]!