# HG changeset patch # User Bernhard Urban # Date 1375370611 -7200 # Node ID b73121a215f75e7201117cbe48223d693b482d10 # Parent 9802c478a26c9efd67ba9b22d2bf9964f472060c NewMemoryAwareScheduling: create nodebitmap once per graph (GRAAL-159) diff -r 9802c478a26c -r b73121a215f7 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 Thu Aug 01 17:23:30 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Thu Aug 01 17:23:31 2013 +0200 @@ -819,8 +819,9 @@ private void sortNodesWithinBlocks(StructuredGraph graph, SchedulingStrategy strategy) { NodeBitMap visited = graph.createNodeBitMap(); + NodeBitMap beforeLastLocation = graph.createNodeBitMap(); for (Block b : cfg.getBlocks()) { - sortNodesWithinBlock(b, visited, strategy); + sortNodesWithinBlock(b, visited, beforeLastLocation, strategy); assert noDuplicatedNodesInBlock(b) : "duplicated nodes in " + b; } } @@ -831,7 +832,7 @@ return list.size() == hashset.size(); } - private void sortNodesWithinBlock(Block b, NodeBitMap visited, SchedulingStrategy strategy) { + private void sortNodesWithinBlock(Block b, NodeBitMap visited, NodeBitMap beforeLastLocation, SchedulingStrategy strategy) { if (visited.isMarked(b.getBeginNode()) || cfg.blockFor(b.getBeginNode()) != b) { throw new SchedulingError(); } @@ -846,7 +847,7 @@ break; case LATEST: case LATEST_OUT_OF_LOOPS: - sortedInstructions = sortNodesWithinBlockLatest(b, visited); + sortedInstructions = sortNodesWithinBlockLatest(b, visited, beforeLastLocation); break; default: throw new GraalInternalError("unknown scheduling strategy"); @@ -882,12 +883,10 @@ * all inputs. This means that a node is added to the list after all its inputs have been * processed. */ - private List sortNodesWithinBlockLatest(Block b, NodeBitMap visited) { + private List sortNodesWithinBlockLatest(Block b, NodeBitMap visited, NodeBitMap beforeLastLocation) { List instructions = blockToNodesMap.get(b); List sortedInstructions = new ArrayList<>(blockToNodesMap.get(b).size() + 2); List reads = new ArrayList<>(); - // TODO: need bitmap for just within a block - NodeBitMap beforeLastLocation = cfg.graph.createNodeBitMap(); if (memsched == MemoryScheduling.OPTIMAL) { /*