Eliot Miranda uploaded a new version of Cog to project VM Maker: http://source.squeak.org/VMMaker/Cog-eem.350.mcz ==================== Summary ==================== Name: Cog-eem.350 Author: eem Time: 3 January 2019, 4:30:35.959087 pm UUID: 970fa8bf-b63b-4745-b892-7c6dd0a87e83 Ancestors: Cog-eem.349 Add the doit to check that the relevant nodes are dominators and are found by DominatorFinder to the class side as a utility method. Add some MesswgeNode support. =============== Diff against Cog-eem.349 =============== Item was added: + ----- Method: DominatorFinder class>>dominatorTupleForMethod: (in category 'exploration') ----- + dominatorTupleForMethod: aCompiledMethod + "Answer a tuple of + dominating optimized nodes, (inlined if's that are found by DominatorFinder) + anomalous optimized nodes, (inlined if's that are not found by DominatorFinder) + dominated nodes, (inlined if's nested within other inlined if's that occur at teh end of a basic block and hence jump to the same oplacfe as their parent) + dominator pcs (the dominatopr pcs found by the DominatorFinder) + for aCompiledMethod" + | mn dominators offenders dominatorPCs dominated | + mn := CompiledMethod + noCheckSetPreferredBytecodeSetTo: aCompiledMethod encoderClass + while: + [[:c :s| c compile:(c sourceCodeAt: s) + environment: c environment + notifying: nil + trailer: aCompiledMethod trailer + ifFail: [nil]] value: aCompiledMethod methodClass value: aCompiledMethod selector]. + dominatorPCs := (self on: aCompiledMethod) dominators. + dominated := Set new. "The last statement of an inlined if cannot dominate the join of its enclosing if" + mn node nodesDo: + [:n| | lastStatement | + (n isMessage and: [n isOptimizedConditional]) ifTrue: + [lastStatement := n lastBlockOfOptimizedConditional statements last. + (lastStatement isMessage and: [lastStatement isOptimizedConditional]) ifTrue: + [dominated add: lastStatement]]]. + dominators := OrderedCollection new. + offenders := OrderedCollection new. + mn node nodesDo: + [:n| + (n isMessage and: [n isOptimized and: [n isSingleReturningIf not and: [(dominated includes: n) not]]]) ifTrue: + [((dominatorPCs at: n pc ifAbsent: nil) + ifNil: [offenders] + ifNotNil: [dominators]) addLast: n]]. + ^{ dominators. offenders. dominated. dominatorPCs }! Item was added: + ----- Method: MessageNode>>isOptimizedConditional (in category '*Cog-Explorations-testing') ----- + isOptimizedConditional + "Answer if the receiver represents an inlined ifTrue: et al, and: et al, or ifNil: et al." + + ^special > 0 + and: [(special between: 1 and: 6) "ifTrue:...or:" + or: [special between: 15 and: 18]] "ifNil: ... ifNotNil:ifNil:" + + "MacroSelectors := + #( ifTrue: ifFalse: ifTrue:ifFalse: ifFalse:ifTrue: + and: or: + whileFalse: whileTrue: whileFalse whileTrue + to:do: to:by:do: + caseOf: caseOf:otherwise: + ifNil: ifNotNil: ifNil:ifNotNil: ifNotNil:ifNil: + repeat )" + ! Item was added: + ----- Method: MessageNode>>lastBlockOfOptimizedConditional (in category '*Cog-Explorations-testing') ----- + lastBlockOfOptimizedConditional + "Answer the actual last block for an inlined conditional" + + ^special >= 1 ifTrue: + [special <= 2 ifTrue: [^arguments first]. "ifTrue: ifFalse:" + special <= 4 ifTrue: [^arguments last]. "ifTrue:ifFalse: ifFalse:ifTrue:" + special <= 6 ifTrue: [^arguments first]. "and: or:" + special <= 14 ifTrue: [^nil]. + special <= 16 ifTrue: [^arguments first]. "ifNil: ifNotNil:" + special <= 18 ifTrue: [^arguments last]] "ifNil:ifNotNil: ifNotNil:ifNil:"! |
Free forum by Nabble | Edit this page |