# HG changeset patch # User Josef Eisl # Date 1397495793 -7200 # Node ID a775a766a3c80d25de9cb6ceef2b44fdfe9f5a06 # Parent ca92d97bb0d63a72dbee52222f6ee890fe8f8a2d Add more loop info to BciBlocks. diff -r ca92d97bb0d6 -r a775a766a3c8 graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Mon Apr 14 16:47:36 2014 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Mon Apr 14 19:16:33 2014 +0200 @@ -82,6 +82,12 @@ public boolean isLoopHeader; public int loopId; + /** + * XXX to be removed - currently only used by baseline compiler + */ + public Loop loop; + public boolean isLoopEnd; + public FixedWithNextNode firstInstruction; public AbstractFrameStateBuilder entryState; @@ -145,13 +151,11 @@ } public Loop getLoop() { - // TODO Auto-generated method stub - return null; + return loop; } public int getLoopDepth() { - // TODO Auto-generated method stub - return 0; + return Long.bitCount(loops); } public boolean isLoopHeader() { @@ -159,13 +163,11 @@ } public boolean isLoopEnd() { - // TODO Auto-generated method stub - return false; + return isLoopEnd; } public boolean isExceptionEntry() { - // TODO Auto-generated method stub - return false; + return isExceptionEntry; } public BciBlock getSuccessor(int index) { @@ -716,6 +718,10 @@ for (BciBlock successor : block.getSuccessors()) { // Recursively process successors. loops |= computeBlockOrder(successor); + if (block.visited && successor.active) { + // Reached block via backward branch. + block.isLoopEnd = true; + } } block.loops = loops;