Mercurial > hg > graal-jvmci-8
diff graal/GraalCompiler/src/com/sun/c1x/ir/ComputeLinearScanOrder.java @ 2653:7c8ad40c1f88
No need for stateAfter on volatile field loads.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 11 May 2011 15:11:33 +0200 |
parents | 6d19b4f476db |
children | 4a6518c4d17d |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/ComputeLinearScanOrder.java Wed May 11 14:51:33 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ComputeLinearScanOrder.java Wed May 11 15:11:33 2011 +0200 @@ -52,53 +52,53 @@ final List<BlockBegin> workList; // temporary list (used in markLoops and computeOrder) // accessors for visitedBlocks and activeBlocks - void initVisited() { + private void initVisited() { activeBlocks.clearAll(); visitedBlocks.clearAll(); } - boolean isVisited(BlockBegin b) { + private boolean isVisited(BlockBegin b) { return visitedBlocks.get(b.blockID); } - boolean isActive(BlockBegin b) { + private boolean isActive(BlockBegin b) { return activeBlocks.get(b.blockID); } - void setVisited(BlockBegin b) { + private void setVisited(BlockBegin b) { assert !isVisited(b) : "already set"; visitedBlocks.set(b.blockID); } - void setActive(BlockBegin b) { + private void setActive(BlockBegin b) { assert !isActive(b) : "already set"; activeBlocks.set(b.blockID); } - void clearActive(BlockBegin b) { + private void clearActive(BlockBegin b) { assert isActive(b) : "not already"; activeBlocks.clear(b.blockID); } // accessors for forwardBranches - void incForwardBranches(BlockBegin b) { + private void incForwardBranches(BlockBegin b) { forwardBranches[b.blockID]++; } - int decForwardBranches(BlockBegin b) { + private int decForwardBranches(BlockBegin b) { return --forwardBranches[b.blockID]; } // accessors for loopMap - boolean isBlockInLoop(int loopIdx, BlockBegin b) { + private boolean isBlockInLoop(int loopIdx, BlockBegin b) { return loopMap.at(loopIdx, b.blockID); } - void setBlockInLoop(int loopIdx, BlockBegin b) { + private void setBlockInLoop(int loopIdx, BlockBegin b) { loopMap.setBit(loopIdx, b.blockID); } - void clearBlockInLoop(int loopIdx, int blockId) { + private void clearBlockInLoop(int loopIdx, int blockId) { loopMap.clearBit(loopIdx, blockId); } @@ -121,8 +121,6 @@ loopEndBlocks = new ArrayList<BlockBegin>(8); workList = new ArrayList<BlockBegin>(8); - splitCriticalEdges(); - countEdges(startBlock, null); if (numLoops > 0) { @@ -138,10 +136,6 @@ assert verify(); } - void splitCriticalEdges() { - // TODO: move critical edge splitting from IR to here - } - /** * Traverses the CFG to analyze block and edge info. The analysis performed is: * @@ -150,7 +144,7 @@ * 3. Number loop header blocks. * 4. Create a list with all loop end blocks. */ - void countEdges(BlockBegin cur, BlockBegin parent) { + private void countEdges(BlockBegin cur, BlockBegin parent) { if (C1XOptions.TraceLinearScanLevel >= 3) { TTY.println("Counting edges for block B%d%s", cur.blockID, parent == null ? "" : " coming from B" + parent.blockID); } @@ -176,7 +170,6 @@ iterativeDominators = true; return; } -// assert parent.numberOfSux() == 1 && parent.suxAt(0) == cur : "loop end blocks must have one successor (critical edges are split)"; loopEndBlocks.add(parent); return; @@ -227,7 +220,7 @@ } } - void markLoops() { + private void markLoops() { if (C1XOptions.TraceLinearScanLevel >= 3) { TTY.println("----- marking loops"); } @@ -243,7 +236,6 @@ TTY.println("Processing loop from B%d to B%d (loop %d):", loopStart.blockID, loopEnd.blockID, loopIdx); } assert loopEnd.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopEnd) : "loop end flag must be set"; -// assert loopEnd.numberOfSux() == 1 : "incorrect number of successors"; assert loopStart.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) : "loop header flag must be set"; assert loopIdx >= 0 && loopIdx < numLoops : "loop index not set"; assert workList.isEmpty() : "work list must be empty before processing"; @@ -281,7 +273,7 @@ // check for non-natural loops (loops where the loop header does not dominate // all other loop blocks = loops with multiple entries). // such loops are ignored - void clearNonNaturalLoops(BlockBegin startBlock) { + private void clearNonNaturalLoops(BlockBegin startBlock) { for (int i = numLoops - 1; i >= 0; i--) { if (isBlockInLoop(i, startBlock)) { // loop i contains the entry block of the method. @@ -298,7 +290,7 @@ } } - void assignLoopDepth(BlockBegin startBlock) { + private void assignLoopDepth(BlockBegin startBlock) { if (C1XOptions.TraceLinearScanLevel >= 3) { TTY.println("----- computing loop-depth and weight"); } @@ -341,7 +333,7 @@ } while (!workList.isEmpty()); } - BlockBegin commonDominator(BlockBegin a, BlockBegin b) { + private BlockBegin commonDominator(BlockBegin a, BlockBegin b) { assert a != null && b != null : "must have input blocks"; dominatorBlocks.clearAll(); @@ -359,7 +351,7 @@ return b; } - void computeDominator(BlockBegin cur, BlockBegin parent) { + 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); @@ -380,7 +372,7 @@ } } - int computeWeight(BlockBegin cur) { + private int computeWeight(BlockBegin cur) { BlockBegin singleSux = null; if (cur.numberOfSux() == 1) { singleSux = cur.suxAt(0); @@ -439,7 +431,7 @@ return weight; } - boolean readyForProcessing(BlockBegin cur) { + private boolean readyForProcessing(BlockBegin cur) { // Discount the edge just traveled. // When the number drops to zero, all forward branches were processed if (decForwardBranches(cur) != 0) { @@ -451,7 +443,7 @@ return true; } - void sortIntoWorkList(BlockBegin cur) { + private void sortIntoWorkList(BlockBegin cur) { assert !workList.contains(cur) : "block already in work list"; int curWeight = computeWeight(cur); @@ -486,7 +478,7 @@ } } - void appendBlock(BlockBegin cur) { + private void appendBlock(BlockBegin cur) { if (C1XOptions.TraceLinearScanLevel >= 3) { TTY.println("appending block B%d (weight 0x%06x) to linear-scan order", cur.blockID, cur.linearScanNumber()); } @@ -499,7 +491,7 @@ linearScanOrder.add(cur); } - void computeOrder(BlockBegin startBlock) { + private void computeOrder(BlockBegin startBlock) { if (C1XOptions.TraceLinearScanLevel >= 3) { TTY.println("----- computing final block order"); } @@ -547,7 +539,7 @@ } while (workList.size() > 0); } - boolean computeDominatorsIter() { + private boolean computeDominatorsIter() { boolean changed = false; int numBlocks = linearScanOrder.size(); @@ -582,9 +574,9 @@ return changed; } - void computeDominators() { + private void computeDominators() { if (C1XOptions.TraceLinearScanLevel >= 3) { - TTY.println("----- computing dominators (iterative computation reqired: %b)", iterativeDominators); + TTY.println("----- computing dominators (iterative computation required: %b)", iterativeDominators); } // iterative computation of dominators is only required for methods with non-natural loops @@ -656,7 +648,7 @@ } } - boolean verify() { + private boolean verify() { assert linearScanOrder.size() == numBlocks : "wrong number of blocks in list"; if (C1XOptions.StressLinearScan) {