# HG changeset patch # User Doug Simon # Date 1338541430 -7200 # Node ID fc58f934f9a1317a66f82e99ee7e3289fe282e1c # Parent 425c74c9444de604dcc3c17a7a43ce8d9f3a3375 allow a framestate to flow though a framestate-less loop diff -r 425c74c9444d -r fc58f934f9a1 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Fri Jun 01 11:02:36 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Fri Jun 01 11:03:50 2012 +0200 @@ -352,9 +352,20 @@ for (Block pred : block.getPredecessors()) { if (fs == null) { fs = blockLastState.get(pred); - } else if (fs != blockLastState.get(pred)) { - fs = null; - break; + } else { + if (blockLastState.get(pred) == null) { + // Only a back edge can have a null state for its enclosing block. + assert pred.getEndNode() instanceof LoopEndNode; + + if (block.getBeginNode().stateAfter() == null) { + // We'll assert later that the begin and end of a framestate-less loop + // share the frame state that flowed into the loop + blockLastState.put(pred, fs); + } + } else if (fs != blockLastState.get(pred)) { + fs = null; + break; + } } } if (GraalOptions.TraceLIRGeneratorLevel >= 2) { @@ -433,6 +444,10 @@ TTY.println("END Generating LIR for block B" + block.getId()); } + // Check that the begin and end of a framestate-less loop + // share the frame state that flowed into the loop + assert blockLastState.get(block) == null || blockLastState.get(block) == lastState; + blockLocks.put(currentBlock, curLocks); blockLastState.put(block, lastState); currentBlock = null;