changeset 18974:c597c72e163b

Do not compute region set in SchedulePhase. Use new API of ReentrantBlockIterator.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 27 Jan 2015 16:56:10 +0100
parents 78f9a57525af
children 88083bb2e0f8
files graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java
diffstat 1 files changed, 1 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Tue Jan 27 16:52:25 2015 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Tue Jan 27 16:56:10 2015 +0100
@@ -521,9 +521,6 @@
                 // the dominated block is not a successor -> we have a split
                 assert dominatedBlock.getBeginNode() instanceof MergeNode;
 
-                HashSet<Block> region = computeRegion(currentBlock, dominatedBlock);
-                Debug.log("> merge.  %s: region for %s -> %s: %s", n, currentBlock, dominatedBlock, region);
-
                 NewMemoryScheduleClosure closure = null;
                 if (currentBlock == upperBoundBlock) {
                     assert earliestBlock == upperBoundBlock;
@@ -533,7 +530,7 @@
                     closure = new NewMemoryScheduleClosure();
                 }
                 Map<FixedNode, KillSet> states;
-                states = ReentrantBlockIterator.apply(closure, currentBlock, new KillSet(), (block) -> !region.contains(block));
+                states = ReentrantBlockIterator.apply(closure, currentBlock, new KillSet(), block -> block == dominatedBlock);
 
                 KillSet mergeState = states.get(dominatedBlock.getBeginNode());
                 if (mergeState.isKilled(locid)) {
@@ -573,31 +570,6 @@
     }
 
     /**
-     * compute a set that contains all blocks in a region spanned by dominatorBlock and
-     * dominatedBlock (exclusive the dominatedBlock).
-     */
-    private static HashSet<Block> computeRegion(Block dominatorBlock, Block dominatedBlock) {
-        HashSet<Block> region = new HashSet<>();
-        Queue<Block> workList = new LinkedList<>();
-
-        region.add(dominatorBlock);
-        workList.addAll(dominatorBlock.getSuccessors());
-        while (workList.size() > 0) {
-            Block current = workList.poll();
-            if (current != dominatedBlock) {
-                region.add(current);
-                for (Block b : current.getSuccessors()) {
-                    if (!region.contains(b) && !workList.contains(b)) {
-                        workList.offer(b);
-                    }
-                }
-            }
-        }
-        assert !region.contains(dominatedBlock) && region.containsAll(dominatedBlock.getPredecessors());
-        return region;
-    }
-
-    /**
      * Calculates the last block that the given node could be scheduled in, i.e., the common
      * dominator of all usages. To do so all usages are also assigned to blocks.
      *