# HG changeset patch # User Thomas Wuerthinger # Date 1305722429 -7200 # Node ID 773189811d10881185335cf5ce6f483edbf9a869 # Parent bcbda467e1aea8363c86117438adaf299ef9001c Removed dominator calculation. diff -r bcbda467e1ae -r 773189811d10 graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java --- a/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java Wed May 18 14:37:57 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java Wed May 18 14:40:29 2011 +0200 @@ -170,9 +170,6 @@ } out.println(); - if (block.dominator() != null) { - out.print("dominator \"B").print(block.dominator().blockID).println('"'); - } if (block.loopIndex() != -1) { out.print("loop_index ").println(block.loopIndex()); out.print("loop_depth ").println(block.loopDepth()); diff -r bcbda467e1ae -r 773189811d10 graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java Wed May 18 14:37:57 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java Wed May 18 14:40:29 2011 +0200 @@ -159,14 +159,6 @@ } /** - * Gets the dominator of this block. - * @return the dominator block - */ - public BlockBegin dominator() { - return dominator; - } - - /** * Sets the dominator block for this block. * @param dominator the dominator for this block */ @@ -719,11 +711,6 @@ out.print(')'); } - // print dominator block - if (dominator() != null) { - out.print(" dom B").print(dominator().blockID); - } - // print predecessors if (!blockPredecessors().isEmpty()) { out.print(" pred:"); diff -r bcbda467e1ae -r 773189811d10 graal/GraalCompiler/src/com/sun/c1x/ir/ComputeLinearScanOrder.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ComputeLinearScanOrder.java Wed May 18 14:37:57 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ComputeLinearScanOrder.java Wed May 18 14:40:29 2011 +0200 @@ -126,7 +126,6 @@ } computeOrder(startBlock); - computeDominators(); printBlocks(); assert verify(); @@ -144,7 +143,6 @@ if (C1XOptions.TraceLinearScanLevel >= 3) { TTY.println("Counting edges for block B%d%s", cur.blockID, parent == null ? "" : " coming from B" + parent.blockID); } - assert cur.dominator() == null : "dominator already initialized"; if (isActive(cur)) { if (C1XOptions.TraceLinearScanLevel >= 3) { @@ -329,45 +327,6 @@ } while (!workList.isEmpty()); } - private BlockBegin commonDominator(BlockBegin a, BlockBegin b) { - assert a != null && b != null : "must have input blocks"; - - dominatorBlocks.clearAll(); - while (a != null) { - dominatorBlocks.set(a.blockID); - assert a.dominator() != null || a == linearScanOrder.get(0) : "dominator must be initialized"; - a = a.dominator(); - } - while (b != null && !dominatorBlocks.get(b.blockID)) { - assert b.dominator() != null || b == linearScanOrder.get(0) : "dominator must be initialized"; - b = b.dominator(); - } - - assert b != null : "could not find dominator"; - return b; - } - - private void computeDominator(BlockBegin cur, BlockBegin parent) { - if (cur.dominator() == null) { - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("DOM: initializing dominator of B%d to B%d", cur.blockID, parent.blockID); - } - if (cur.isExceptionEntry()) { - assert parent.dominator() != null; - cur.setDominator(parent.dominator()); - } else { - cur.setDominator(parent); - } - - } else if (!(cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) && parent.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopEnd))) { - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("DOM: computing dominator of B%d: common dominator of B%d and B%d is B%d", cur.blockID, parent.blockID, cur.dominator().blockID, commonDominator(cur.dominator(), parent).blockID); - } - assert cur.numberOfPreds() > 1 : ""; - cur.setDominator(commonDominator(cur.dominator(), parent)); - } - } - private int computeWeight(BlockBegin cur) { BlockBegin singleSux = null; if (cur.numberOfSux() == 1) { @@ -513,7 +472,6 @@ // changed loop order to get "intuitive" order of if- and else-blocks for (i = 0; i < numSux; i++) { BlockBegin sux = cur.suxAt(i); - computeDominator(sux, cur); if (readyForProcessing(sux)) { sortIntoWorkList(sux); } @@ -521,7 +479,6 @@ numSux = cur.numberOfExceptionHandlers(); for (i = 0; i < numSux; i++) { BlockBegin sux = cur.exceptionHandlerAt(i); - computeDominator(sux, cur); if (readyForProcessing(sux)) { sortIntoWorkList(sux); } @@ -529,61 +486,6 @@ } while (workList.size() > 0); } - private boolean computeDominatorsIter() { - boolean changed = false; - int numBlocks = linearScanOrder.size(); - - assert linearScanOrder.get(0).dominator() == null : "must not have dominator"; - assert linearScanOrder.get(0).numberOfPreds() == 0 : "must not have predecessors"; - for (int i = 1; i < numBlocks; i++) { - BlockBegin block = linearScanOrder.get(i); - - assert block.numberOfPreds() > 0; - BlockBegin dominator = block.predAt(0).begin(); - if (block.isExceptionEntry()) { - dominator = dominator.dominator(); - } - - int numPreds = block.numberOfPreds(); - for (int j = 1; j < numPreds; j++) { - BlockBegin curPred = block.predAt(j).begin(); - if (block.isExceptionEntry()) { - curPred = curPred.dominator(); - } - dominator = commonDominator(dominator, curPred); - } - - if (dominator != block.dominator()) { - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("DOM: updating dominator of B%d from B%d to B%d", block.blockID, block.dominator().blockID, dominator.blockID); - } - block.setDominator(dominator); - changed = true; - } - } - return changed; - } - - private void computeDominators() { - if (C1XOptions.TraceLinearScanLevel >= 3) { - TTY.println("----- computing dominators (iterative computation required: %b)", iterativeDominators); - } - - // iterative computation of dominators is only required for methods with non-natural loops - // and OSR-methods. For all other methods : the dominators computed when generating the - // linear scan block order are correct. - if (iterativeDominators) { - do { - if (C1XOptions.TraceLinearScanLevel >= 1) { - TTY.println("DOM: next iteration of fix-point calculation"); - } - } while (computeDominatorsIter()); - } - - // check that dominators are correct - assert !computeDominatorsIter() : "fix point not reached"; - } - public void printBlocks() { if (C1XOptions.TraceLinearScanLevel >= 2) { TTY.println("----- loop information:"); @@ -606,12 +508,6 @@ TTY.print(cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) ? " lh" : " "); TTY.print(cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopEnd) ? " le" : " "); - if (cur.dominator() != null) { - TTY.print(" dom: B%d ", cur.dominator().blockID); - } else { - TTY.print(" dom: null "); - } - if (cur.numberOfPreds() > 0) { TTY.print(" preds: "); for (int j = 0; j < cur.numberOfPreds(); j++) { @@ -675,17 +571,7 @@ if (cur.loopDepth() == begin.loopDepth()) { assert cur.loopIndex() == begin.loopIndex() || cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) : "successing blocks with same loop depth must have same loop index"; } - - assert cur.dominator().linearScanNumber() <= begin.linearScanNumber() : "dominator must be before predecessors"; } - - // check dominator - if (i == 0) { - assert cur.dominator() == null : "first block has no dominator"; - } else { - assert cur.dominator() != null : "all but first block must have dominator"; - } - assert cur.numberOfPreds() != 1 || cur.dominator() == cur.predAt(0).begin() || cur.isExceptionEntry() : "Single predecessor must also be dominator"; } // check that all loops are continuous