Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1854.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1854 Author: eem Time: 30 April 2016, 1:13:30.569533 pm UUID: 69822805-79e9-43ee-a302-00e3536dc4fe Ancestors: VMMaker.oscog-nice.1853
Delete a broken assert. Rename a misnamed method.
=============== Diff against VMMaker.oscog-nice.1853 ===============
Item was changed: ----- Method: TMethod>>exitVar:label: (in category 'inlining') ----- exitVar: exitVar label: exitLabel "Replace each return statement in this method with an assignment to the exit variable followed by either a return or a goto to the given label. Answer if a goto was generated." "Optimization: If exitVar is nil, the return value of the inlined method is not being used, so don't add the assignment statement."
| labelUsed map elisions eliminateReturnSelfs | labelUsed := false. map := Dictionary new. elisions := Set new. "Conceivably one might ^self from a struct class and mean it. In most cases though ^self means `get me outta here, fast'. So unless this method is from a VMStruct class, elide any ^self's" eliminateReturnSelfs := ((definingClass inheritsFrom: VMClass) and: [definingClass isStructClass]) not and: [returnType = #void or: [returnType = #sqInt]]. parseTree nodesDo: [:node | | replacement | node isReturn ifTrue: [self transformReturnSubExpression: node toAssignmentOf: exitVar andGoto: exitLabel unless: eliminateReturnSelfs into: [:rep :labelWasUsed| replacement := rep. labelWasUsed ifTrue: [labelUsed := true]]. "replaceNodesIn: is strictly top-down, so any replacement for ^expr ifTrue: [...^fu...] ifFalse: [...^bar...] will prevent replacement of either ^fu or ^bar. The corollary is that ^expr ifTrue: [foo] ifFalse: [^bar] must be transformed into expr ifTrue: [^foo] ifFalse: [^bar]" (node expression isConditionalSend and: [node expression hasExplicitReturn]) ifTrue: [elisions add: node. (node expression args reject: [:arg| arg endsWithReturn]) do: [:nodeNeedingReturn| self transformReturnSubExpression: nodeNeedingReturn statements last toAssignmentOf: exitVar andGoto: exitLabel unless: eliminateReturnSelfs into: [:rep :labelWasUsed| replacement := rep. labelWasUsed ifTrue: [labelUsed := true]]. map at: nodeNeedingReturn statements last put: replacement]] ifFalse: [map at: node put: (replacement ifNil: [TLabeledCommentNode new setComment: 'return ', node expression printString])]]]. map isEmpty ifTrue: [self deny: labelUsed. ^false]. "Now do a top-down replacement for all returns that should be mapped to assignments and gotos" parseTree replaceNodesIn: map. "Now it is safe to eliminate the returning ifs..." elisions isEmpty ifFalse: [| elisionMap | elisionMap := Dictionary new. elisions do: [:returnNode| elisionMap at: returnNode put: returnNode expression]. parseTree replaceNodesIn: elisionMap]. - "Afterwards all returns should be gone." - self deny: parseTree hasExplicitReturn. "Now flatten any new statement lists..." parseTree nodesDo: [:node| | list | (node isStmtList and: [node statements notEmpty and: [node statements last isStmtList]]) ifTrue: [list := node statements last statements. node statements removeLast; addAllLast: list]]. ^labelUsed!
Item was changed: ----- Method: TParseNode>>collect: (in category 'enumerating') ----- collect: aBlock | nodes | + self halt. "This is a misnomer; should be deleted" nodes := OrderedCollection new. self nodesDo: [:n| (aBlock value: n) ifTrue: [nodes add: n]]. ^nodes!
Item was added: + ----- Method: TParseNode>>select: (in category 'enumerating') ----- + select: aBlock + | nodes | + nodes := OrderedCollection new. + self nodesDo: [:n| (aBlock value: n) ifTrue: [nodes add: n]]. + ^nodes!
vm-dev@lists.squeakfoundation.org