# HG changeset patch # User Thomas Wuerthinger # Date 1307531996 -7200 # Node ID 0e10a9bce78e4883573fc612de7950c4d5f41c79 # Parent c3b8968233fa69a1be27dd5a9ec3e3c9e54ada75 Clean up added deleted node count. diff -r c3b8968233fa -r 0e10a9bce78e graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java Wed Jun 08 12:10:57 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java Wed Jun 08 13:19:56 2011 +0200 @@ -46,17 +46,13 @@ * r2 := r3 becomes r1 := r2 * r1 := r2 r2 := r3 * - * - * @author Marcelo Cintra - * @author Thomas Wuerthinger - * @author Doug Simon */ public class PhiResolver { /** * Tracks a data flow dependency between a source operand and any number of the destination operands. */ - static class Node { + static class PhiResolverNode { /** * A source operand whose value flows into the {@linkplain #destinations destination} operands. @@ -66,7 +62,7 @@ /** * The operands whose values are defined by the {@linkplain #operand source} operand. */ - final ArrayList destinations; + final ArrayList destinations; /** * Denotes if a move instruction has already been emitted to initialize the value of {@link #operand}. @@ -83,9 +79,9 @@ */ boolean startNode; - Node(CiValue operand) { + PhiResolverNode(CiValue operand) { this.operand = operand; - destinations = new ArrayList(4); + destinations = new ArrayList(4); } @Override @@ -93,7 +89,7 @@ StringBuilder buf = new StringBuilder(operand.toString()); if (!destinations.isEmpty()) { buf.append(" ->"); - for (Node node : destinations) { + for (PhiResolverNode node : destinations) { buf.append(' ').append(node.operand); } } @@ -106,17 +102,17 @@ /** * The operand loop header phi for the operand currently being process in {@link #dispose()}. */ - private Node loop; + private PhiResolverNode loop; private CiValue temp; - private final ArrayList variableOperands = new ArrayList(3); - private final ArrayList otherOperands = new ArrayList(3); + private final ArrayList variableOperands = new ArrayList(3); + private final ArrayList otherOperands = new ArrayList(3); /** * Maps operands to nodes. */ - private final HashMap operandToNodeMap = new HashMap(); + private final HashMap operandToNodeMap = new HashMap(); public PhiResolver(LIRGenerator gen) { this.gen = gen; @@ -126,7 +122,7 @@ public void dispose() { // resolve any cycles in moves from and to variables for (int i = variableOperands.size() - 1; i >= 0; i--) { - Node node = variableOperands.get(i); + PhiResolverNode node = variableOperands.get(i); if (!node.visited) { loop = null; move(null, node); @@ -137,7 +133,7 @@ // generate move for move from non variable to arbitrary destination for (int i = otherOperands.size() - 1; i >= 0; i--) { - Node node = otherOperands.get(i); + PhiResolverNode node = otherOperands.get(i); for (int j = node.destinations.size() - 1; j >= 0; j--) { emitMove(node.operand, node.destinations.get(j).operand); } @@ -149,18 +145,18 @@ // tty.print("move "); src.print(); tty.print(" to "); dest.print(); tty.cr(); assert src.isLegal() : "source for phi move is illegal"; assert dest.isLegal() : "destination for phi move is illegal"; - Node srcNode = sourceNode(src); - Node destNode = destinationNode(dest); + PhiResolverNode srcNode = sourceNode(src); + PhiResolverNode destNode = destinationNode(dest); srcNode.destinations.add(destNode); } - private Node createNode(CiValue operand, boolean source) { - Node node; + private PhiResolverNode createNode(CiValue operand, boolean source) { + PhiResolverNode node; if (operand.isVariable()) { node = operandToNodeMap.get(operand); assert node == null || node.operand.equals(operand); if (node == null) { - node = new Node(operand); + node = new PhiResolverNode(operand); operandToNodeMap.put(operand, node); } // Make sure that all variables show up in the list when @@ -172,13 +168,13 @@ } } else { assert source; - node = new Node(operand); + node = new PhiResolverNode(operand); otherOperands.add(node); } return node; } - private Node destinationNode(CiValue opr) { + private PhiResolverNode destinationNode(CiValue opr) { return createNode(opr, false); } @@ -195,7 +191,7 @@ // ie. cycle a := b, b := a start with node a // Call graph: move(NULL, a) -> move(a, b) -> move(b, a) // Generates moves in this order: move b to temp, move a to b, move temp to a - private void move(Node src, Node dest) { + private void move(PhiResolverNode src, PhiResolverNode dest) { if (!dest.visited) { dest.visited = true; for (int i = dest.destinations.size() - 1; i >= 0; i--) { @@ -232,7 +228,7 @@ emitMove(src, temp); } - private Node sourceNode(CiValue opr) { + private PhiResolverNode sourceNode(CiValue opr) { return createNode(opr, true); } } diff -r c3b8968233fa -r 0e10a9bce78e graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Wed Jun 08 12:10:57 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Wed Jun 08 13:19:56 2011 +0200 @@ -25,7 +25,6 @@ import java.util.*; import com.oracle.max.graal.compiler.*; -import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.compiler.ir.*; import com.oracle.max.graal.compiler.lir.*; import com.oracle.max.graal.compiler.observer.*; diff -r c3b8968233fa -r 0e10a9bce78e graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java Wed Jun 08 12:10:57 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java Wed Jun 08 13:19:56 2011 +0200 @@ -319,10 +319,6 @@ } int computeWeight(LIRBlock cur) { - LIRBlock singleSux = null; - if (cur.numberOfSux() == 1) { - singleSux = cur.suxAt(0); - } // limit loop-depth to 15 bit (only for security reason, it will never be so big) int weight = (cur.loopDepth() & 0x7FFF) << 16; diff -r c3b8968233fa -r 0e10a9bce78e graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Schedule.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Schedule.java Wed Jun 08 12:10:57 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Schedule.java Wed Jun 08 13:19:56 2011 +0200 @@ -127,7 +127,7 @@ } else { // We have a single predecessor => check its successor count. if (isBlockEnd(singlePred)) { - Block b = assignBlock(n); + assignBlock(n); blockBeginNodes.add(n); } else { assignBlock(n, nodeToBlock.get(singlePred)); diff -r c3b8968233fa -r 0e10a9bce78e graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java Wed Jun 08 12:10:57 2011 +0200 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java Wed Jun 08 13:19:56 2011 +0200 @@ -35,6 +35,7 @@ private final ArrayList nodes; private final StartNode start; int nextId; + int deletedNodeCount; static int nextGraphId = 0; int id = nextGraphId++; @@ -49,6 +50,10 @@ start = new StartNode(this); } + public int getDeletedNodeCount() { + return deletedNodeCount; + } + public List getNodes() { return Collections.unmodifiableList(nodes); } @@ -61,6 +66,7 @@ void unregister(Node node) { nodes.set(node.id(), Node.Null); + deletedNodeCount++; } public StartNode start() {