changeset 19949:b3a2e8e564ad

Fix a bug in the schedule phase and tighten asserts.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 18 Mar 2015 21:36:12 +0100
parents f73a6e260e0c
children 5ee90d1bf6cd
files graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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<List<Node>> blockToNodesMap, NodeMap<Block> nodeMap) {
         for (Block b : cfg.getBlocks()) {
             List<Node> 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) {