# HG changeset patch # User Thomas Wuerthinger # Date 1426710972 -3600 # Node ID b3a2e8e564adf133a92e6b78ba25cea0251c314a # Parent f73a6e260e0c898e94526fa70f04020bed3eda36 Fix a bug in the schedule phase and tighten asserts. diff -r f73a6e260e0c -r b3a2e8e564ad graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed Mar 18 10:07:47 2015 -0700 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed Mar 18 21:36:12 2015 +0100 @@ -150,8 +150,9 @@ } else { Block currentBlock = b; assert currentBlock != null; + Block latestBlock = calcLatestBlock(b, isOutOfLoops, currentNode, currentNodeMap); - assert AbstractControlFlowGraph.dominates(currentBlock, latestBlock) || currentNode instanceof VirtualState : currentNode + " " + currentBlock + " " + latestBlock; + assert checkLatestEarliestRelation(currentNode, currentBlock, latestBlock); if (latestBlock != currentBlock) { if (currentNode instanceof FloatingReadNode) { @@ -200,6 +201,12 @@ return watchListMap; } + private static boolean checkLatestEarliestRelation(Node currentNode, Block earliestBlock, Block latestBlock) { + assert AbstractControlFlowGraph.dominates(earliestBlock, latestBlock) || (currentNode instanceof VirtualState && latestBlock == earliestBlock.getDominator()) : String.format("%s %s %s", + currentNode, earliestBlock, latestBlock); + return true; + } + private static boolean verifySchedule(ControlFlowGraph cfg, BlockMap> blockToNodesMap, NodeMap nodeMap) { for (Block b : cfg.getBlocks()) { List nodes = blockToNodesMap.get(b); @@ -414,9 +421,11 @@ assert currentNode.hasUsages(); for (Node usage : currentNode.usages()) { block = calcBlockForUsage(currentNode, usage, block, currentNodeMap); + assert checkLatestEarliestRelation(currentNode, earliestBlock, block); if (scheduleOutOfLoops) { - while (block.getLoopDepth() > earliestBlock.getLoopDepth()) { + while (block.getLoopDepth() > earliestBlock.getLoopDepth() && block != earliestBlock.getDominator()) { block = block.getDominator(); + assert checkLatestEarliestRelation(currentNode, earliestBlock, block); } } if (block == earliestBlock) {