# HG changeset patch # User Doug Simon # Date 1386962411 -3600 # Node ID 5d47d69d523a2b17d0d2d3cc4f0fb86ae7eace85 # Parent 5e94b8c9e9d0ce03af013437c1f17f028c946f73# Parent 63724649e19ee936112e85557152e549c4222edc Merge. diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Fri Dec 13 20:20:11 2013 +0100 @@ -83,12 +83,6 @@ private final boolean printIRWithLIR; /** - * Maps constants to variables within the scope of a single block to avoid loading a constant - * more than once per block. - */ - private Map constantsLoadedInCurrentBlock; - - /** * Handle for an operation that loads a constant into a variable. The operation starts in the * first block where the constant is used but will eventually be * {@linkplain LIRGenerator#insertConstantLoads() moved} to a block dominating all usages of the @@ -233,63 +227,46 @@ if (nodeOperands == null) { return null; } - Value operand = !node.isExternal() ? nodeOperands.get(node) : null; + Value operand = nodeOperands.get(node); if (operand == null) { return getConstantOperand(node); } return operand; } - /** - * Controls whether commoning is performed on {@linkplain #canInlineConstant(Constant) - * non-inlinable} constants. - */ - private static final boolean CommonConstantLoads = Boolean.parseBoolean(System.getProperty("graal.commonConstantLoads", "true")); - private Value getConstantOperand(ValueNode node) { if (!ConstantNodeRecordsUsages) { Constant value = node.asConstant(); if (value != null) { if (canInlineConstant(value)) { - return !node.isExternal() ? setResult(node, value) : value; + return setResult(node, value); } else { Variable loadedValue; - if (CommonConstantLoads) { - if (constantLoads == null) { - constantLoads = new HashMap<>(); - } - LoadConstant load = constantLoads.get(value); - if (load == null) { - int index = lir.lir(currentBlock).size(); - // loadedValue = newVariable(value.getPlatformKind()); - loadedValue = emitMove(value); - LIRInstruction op = lir.lir(currentBlock).get(index); - constantLoads.put(value, new LoadConstant(loadedValue, currentBlock, index, op)); + if (constantLoads == null) { + constantLoads = new HashMap<>(); + } + LoadConstant load = constantLoads.get(value); + if (load == null) { + int index = lir.lir(currentBlock).size(); + // loadedValue = newVariable(value.getPlatformKind()); + loadedValue = emitMove(value); + LIRInstruction op = lir.lir(currentBlock).get(index); + constantLoads.put(value, new LoadConstant(loadedValue, currentBlock, index, op)); + } else { + Block dominator = ControlFlowGraph.commonDominator(load.block, currentBlock); + loadedValue = load.variable; + if (dominator != load.block) { + if (load.index >= 0) { + // Replace the move with a filler op so that the operation + // list does not need to be adjusted. + List instructions = lir.lir(load.block); + instructions.set(load.index, new NoOp(null, -1)); + load.index = -1; + } } else { - Block dominator = ControlFlowGraph.commonDominator(load.block, currentBlock); - loadedValue = load.variable; - if (dominator != load.block) { - if (load.index >= 0) { - List instructions = lir.lir(load.block); - instructions.set(load.index, new NoOp(null, -1)); - load.index = -1; - } - } else { - assert load.block != currentBlock || load.index < lir.lir(currentBlock).size(); - } - load.block = dominator; + assert load.block != currentBlock || load.index < lir.lir(currentBlock).size(); } - } else { - if (constantsLoadedInCurrentBlock == null) { - constantsLoadedInCurrentBlock = new HashMap<>(); - loadedValue = null; - } else { - loadedValue = constantsLoadedInCurrentBlock.get(value); - } - if (loadedValue == null) { - loadedValue = emitMove(value); - constantsLoadedInCurrentBlock.put(value, loadedValue); - } + load.block = dominator; } return loadedValue; } @@ -442,7 +419,6 @@ } currentBlock = block; - resetLoadedConstants(); // set up the list of LIR instructions assert lir.lir(block) == null : "LIR list already computed for this block"; @@ -506,12 +482,6 @@ } } - private void resetLoadedConstants() { - if (constantsLoadedInCurrentBlock != null && !constantsLoadedInCurrentBlock.isEmpty()) { - constantsLoadedInCurrentBlock.clear(); - } - } - protected abstract boolean peephole(ValueNode valueNode); private boolean hasBlockEnd(Block block) { diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Fri Dec 13 20:20:11 2013 +0100 @@ -75,11 +75,6 @@ NodeChangedListener usagesDroppedToZeroListener; private final HashMap cachedNodes = new HashMap<>(); - /** - * Determines if external nodes will use {@link Graph}'s canonicalization cache. - */ - public static final boolean CacheExternalNodesInGraph = Boolean.parseBoolean(System.getProperty("graal.cacheExternalNodesInGraph", "false")); - private static final class CacheEntry { private final Node node; @@ -347,24 +342,6 @@ return uniqueHelper(node, true); } - /** - * Looks for a node similar to {@code node}. If not found, {@code node} is added to a - * cache in this graph used to canonicalize nodes. - *

- * Note that node must implement {@link ValueNumberable} and must be an - * {@linkplain Node#isExternal() external} node. - * - * @return a node similar to {@code node} if one exists, otherwise {@code node} - */ - public T uniqueExternal(T node) { - assert node.isExternal() : node; - assert node instanceof ValueNumberable : node; - if (!CacheExternalNodesInGraph) { - return node; - } - return uniqueHelper(node, false); - } - @SuppressWarnings("unchecked") T uniqueHelper(T node, boolean addIfMissing) { assert node.getNodeClass().valueNumberable(); @@ -381,14 +358,13 @@ } void putNodeIntoCache(Node node) { - assert node.isExternal() || node.graph() == this || node.graph() == null; + assert node.graph() == this || node.graph() == null; assert node.getNodeClass().valueNumberable(); assert node.getNodeClass().isLeafNode() : node.getClass(); cachedNodes.put(new CacheEntry(node), node); } Node findNodeInCache(Node node) { - assert !node.isExternal() || CacheExternalNodesInGraph; CacheEntry key = new CacheEntry(node); Node result = cachedNodes.get(key); if (result != null && result.isDeleted()) { @@ -785,7 +761,6 @@ } void register(Node node) { - assert !node.isExternal(); assert node.id() == Node.INITIAL_ID; if (nodes.length == nodesSize) { nodes = Arrays.copyOf(nodes, (nodesSize * 2) + 1); diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Fri Dec 13 20:20:11 2013 +0100 @@ -157,11 +157,9 @@ } /** - * Gets the graph context of this node. This must not be called for {@linkplain #isExternal() - * external} nodes. + * Gets the graph context of this node. */ public Graph graph() { - assert !isExternal() : "external node has no graph: " + this; return graph; } @@ -288,15 +286,6 @@ } /** - * Determines if this node has a {@linkplain #graph() graph} context or is external to any - * graph. The {@link #graph()} method must only be called on nodes for which this method returns - * true. - */ - public boolean isExternal() { - return false; - } - - /** * Finds the index of the last non-null entry in a node array. The search assumes that all * non-null entries precede the first null entry in the array. * @@ -531,7 +520,6 @@ assert assertFalse(other == this, "cannot replace a node with itself"); assert assertFalse(isDeleted(), "cannot replace deleted node"); assert assertTrue(other == null || !other.isDeleted(), "cannot replace with deleted node %s", other); - assert assertTrue(other == null || other.isExternal() || other.graph() == graph, "cannot replace with node in different graph: %s", other == null || other.isExternal() ? null : other.graph()); return true; } @@ -588,7 +576,7 @@ assert assertFalse(isDeleted(), "cannot clear inputs of deleted node"); for (Node input : inputs()) { - if (input.recordsUsages() && !input.isExternal()) { + if (input.recordsUsages()) { removeThisFromUsages(input); if (input.usages().isEmpty()) { NodeChangedListener listener = graph.usagesDroppedToZeroListener; @@ -637,7 +625,6 @@ } public final Node copyWithInputs() { - assert !isExternal(); Node newNode = clone(graph); NodeClass clazz = getNodeClass(); clazz.copyInputs(this, newNode); @@ -676,7 +663,6 @@ } final Node clone(Graph into, boolean clearInputsAndSuccessors) { - assert !isExternal(); NodeClass nodeClass = getNodeClass(); if (nodeClass.valueNumberable() && nodeClass.isLeafNode()) { Node otherNode = into.findNodeInCache(this); @@ -711,23 +697,6 @@ return newNode; } - /** - * Determines if a given node is {@linkplain Graph#uniqueExternal(Node) unique} within a given - * graph if the node is non-null and {@linkplain #isExternal() external}. - * - * @param node node to check - * @param graph graph context to use - * @return true if node is null, not external or unique within {@code graph} otherwise raises a - * {@link VerificationError} - */ - public static boolean verifyUniqueIfExternal(Node node, Graph graph) { - if (node != null && node.isExternal() && Graph.CacheExternalNodesInGraph) { - Node cached = graph.findNodeInCache(node); - node.assertTrue(cached == node, "external node does not match canonical node %s", cached); - } - return true; - } - protected void afterClone(@SuppressWarnings("unused") Node other) { } @@ -736,8 +705,6 @@ assertTrue(graph() != null, "null graph"); for (Node input : inputs()) { assertTrue(!input.recordsUsages() || input.usages().contains(this), "missing usage in input %s", input); - assert verifyUniqueIfExternal(input, graph()); - assertTrue(input.isExternal() || input.graph() == graph(), "mismatching graph in input %s", input); } for (Node successor : successors()) { assertTrue(successor.predecessor() == this, "missing predecessor in %s (actual: %s)", successor, successor.predecessor()); @@ -791,9 +758,7 @@ } /** - * Nodes always use an {@linkplain System#identityHashCode(Object) identity} hash code. For this - * reason, {@linkplain #isExternal() external} nodes should still be {@link Graph#unique unique} - * within the context of a graph. + * Nodes always use an {@linkplain System#identityHashCode(Object) identity} hash code. */ @Override public final int hashCode() { @@ -801,8 +766,7 @@ } /** - * Equality tests must rely solely on identity. For this reason, {@linkplain #isExternal() - * external} nodes should still be {@link Graph#unique unique} within the context of a graph. + * Equality tests must rely solely on identity. */ @Override public final boolean equals(Object obj) { diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Fri Dec 13 20:20:11 2013 +0100 @@ -937,7 +937,6 @@ if (input != null) { Node newInput = duplicationReplacement.replacement(input, true); node.updateUsages(null, newInput); - assert Node.verifyUniqueIfExternal(newInput, node.graph()); assert newInput == null || fieldTypes.get(inputOffsets[index]).isAssignableFrom(newInput.getClass()) : "Can not assign " + newInput.getClass() + " to " + fieldTypes.get(inputOffsets[index]) + " in " + node; putNode(node, inputOffsets[index], newInput); @@ -994,7 +993,6 @@ Node oldNode = list.get(i); if (oldNode != null) { Node newNode = duplicationReplacement.replacement(oldNode, true); - assert Node.verifyUniqueIfExternal(newNode, node.graph()); result.set(i, newNode); } } @@ -1079,7 +1077,6 @@ } public boolean replaceFirstInput(Node node, Node old, Node other) { - assert Node.verifyUniqueIfExternal(other, node.graph()); int index = 0; while (index < directInputCount) { Node input = getNode(node, inputOffsets[index]); @@ -1384,9 +1381,6 @@ InplaceUpdateClosure replacementClosure = new InplaceUpdateClosure() { public Node replacement(Node node, boolean isInput) { - if (node.isExternal() && node instanceof ValueNumberable) { - return graph.uniqueExternal(node); - } Node target = newNodes.get(node); if (target == null) { Node replacement = node; diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java Fri Dec 13 20:20:11 2013 +0100 @@ -84,7 +84,7 @@ } public boolean isOutsideLoop(Node n) { - return n.isExternal() || !whole().contains(n); + return !whole().contains(n); } public LoopBeginNode loopBegin() { diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Fri Dec 13 20:20:11 2013 +0100 @@ -71,10 +71,7 @@ @SuppressWarnings("unchecked") public New getDuplicatedNode(Old n) { assert isDuplicate(); - if (!n.isExternal()) { - return (New) duplicationMap.get(n); - } - return n; + return (New) duplicationMap.get(n); } protected void putDuplicatedNode(Old oldNode, New newNode) { diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Fri Dec 13 20:20:11 2013 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.nodes; -import static com.oracle.graal.graph.Graph.*; - import java.util.*; import com.oracle.graal.api.meta.*; @@ -68,40 +66,17 @@ return value; } - private static boolean ConstantNodesAreExternal = Boolean.parseBoolean(System.getProperty("graal.constantNodesAreExternal", "true")); - /** * Used to measure the impact of ConstantNodes not recording their usages. This and all code * predicated on this value being true will be removed at some point. */ - public static final boolean ConstantNodeRecordsUsages = !ConstantNodesAreExternal && Boolean.getBoolean("graal.constantNodeRecordsUsages"); + public static final boolean ConstantNodeRecordsUsages = Boolean.getBoolean("graal.constantNodeRecordsUsages"); @Override public boolean recordsUsages() { return ConstantNodeRecordsUsages; } - @Override - public boolean isDeleted() { - if (!ConstantNodesAreExternal) { - return super.isDeleted(); - } - return false; - } - - @Override - public boolean isAlive() { - if (!ConstantNodesAreExternal) { - return super.isAlive(); - } - return true; - } - - @Override - public boolean isExternal() { - return ConstantNodesAreExternal; - } - /** * Computes the usages of this node by iterating over all the nodes in the graph, searching for * those that have this node as an input. @@ -121,23 +96,10 @@ /** * Gathers all the {@link ConstantNode}s that are inputs to the - * {@linkplain StructuredGraph#getNodes() live nodes} in a given graph. This is an expensive - * operation that should only be used in test/verification/AOT code. + * {@linkplain StructuredGraph#getNodes() live nodes} in a given graph. */ public static NodeIterable getConstantNodes(StructuredGraph graph) { - if (!ConstantNodesAreExternal) { - return graph.getNodes().filter(ConstantNode.class); - } - - Map result = new HashMap<>(); - for (Node node : graph.getNodes()) { - for (Node input : node.inputs()) { - if (input instanceof ConstantNode) { - result.put((ConstantNode) input, (ConstantNode) input); - } - } - } - return new ConstantNodeList(result.keySet()); + return graph.getNodes().filter(ConstantNode.class); } /** @@ -150,9 +112,7 @@ for (Node usage : usages) { usage.replaceFirstInput(this, replacement); } - if (!isExternal()) { - graph.removeFloating(this); - } + graph.removeFloating(this); } else { assert graph == graph(); graph().replaceFloating(this, replacement); @@ -184,10 +144,6 @@ if (constant.getKind().getStackKind() == Kind.Int && constant.getKind() != Kind.Int) { return forInt(constant.asInt(), graph); } - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - Stamp stamp = constant.getKind() == Kind.Object ? StampFactory.forConstant(constant, metaAccess) : StampFactory.forConstant(constant); - return graph.asConstantNode(constant, stamp); - } if (constant.getKind() == Kind.Object) { return unique(graph, new ConstantNode(constant, StampFactory.forConstant(constant, metaAccess))); } else { @@ -210,9 +166,6 @@ * @return a node for a double constant */ public static ConstantNode forDouble(double d, StructuredGraph graph) { - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - return graph.asConstantNode(Constant.forDouble(d), null); - } return unique(graph, createPrimitive(Constant.forDouble(d))); } @@ -223,9 +176,6 @@ * @return a node for a float constant */ public static ConstantNode forFloat(float f, StructuredGraph graph) { - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - return graph.asConstantNode(Constant.forFloat(f), null); - } return unique(graph, createPrimitive(Constant.forFloat(f))); } @@ -236,9 +186,6 @@ * @return a node for an long constant */ public static ConstantNode forLong(long i, StructuredGraph graph) { - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - return graph.asConstantNode(Constant.forLong(i), null); - } return unique(graph, createPrimitive(Constant.forLong(i))); } @@ -249,9 +196,6 @@ * @return a node for an integer constant */ public static ConstantNode forInt(int i, StructuredGraph graph) { - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - return graph.asConstantNode(Constant.forInt(i), null); - } return unique(graph, createPrimitive(Constant.forInt(i))); } @@ -262,9 +206,6 @@ * @return a node representing the boolean */ public static ConstantNode forBoolean(boolean i, StructuredGraph graph) { - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - return graph.asConstantNode(i ? Constant.INT_1 : Constant.INT_0, null); - } return unique(graph, createPrimitive(Constant.forInt(i ? 1 : 0))); } @@ -275,9 +216,6 @@ * @return a node representing the byte */ public static ConstantNode forByte(byte i, StructuredGraph graph) { - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - return graph.asConstantNode(Constant.forInt(i), null); - } return unique(graph, createPrimitive(Constant.forInt(i))); } @@ -288,9 +226,6 @@ * @return a node representing the char */ public static ConstantNode forChar(char i, StructuredGraph graph) { - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - return graph.asConstantNode(Constant.forInt(i), null); - } return unique(graph, createPrimitive(Constant.forInt(i))); } @@ -301,9 +236,6 @@ * @return a node representing the short */ public static ConstantNode forShort(short i, StructuredGraph graph) { - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - return graph.asConstantNode(Constant.forInt(i), null); - } return unique(graph, createPrimitive(Constant.forInt(i))); } @@ -316,18 +248,11 @@ public static ConstantNode forObject(Object o, MetaAccessProvider metaAccess, StructuredGraph graph) { assert !(o instanceof Constant) : "wrapping a Constant into a Constant"; Constant constant = Constant.forObject(o); - if (ConstantNodesAreExternal && !CacheExternalNodesInGraph) { - return graph.asConstantNode(constant, StampFactory.forConstant(constant, metaAccess)); - } return unique(graph, new ConstantNode(constant, StampFactory.forConstant(constant, metaAccess))); } private static ConstantNode unique(StructuredGraph graph, ConstantNode node) { - if (!ConstantNodesAreExternal) { - return graph.unique(node); - } - assert CacheExternalNodesInGraph; - return graph.uniqueExternal(node); + return graph.unique(node); } public static ConstantNode forIntegerKind(Kind kind, long value, StructuredGraph graph) { @@ -390,15 +315,4 @@ return super.toString(verbosity); } } - - static class ConstantNodeList extends NodeList { - - public ConstantNodeList(Collection nodes) { - super(nodes.toArray(new ConstantNode[nodes.size()])); - } - - @Override - protected void update(ConstantNode oldNode, ConstantNode newNode) { - } - } } diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Fri Dec 13 20:20:11 2013 +0100 @@ -29,7 +29,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.java.*; -import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; /** @@ -82,38 +81,6 @@ private boolean isAfterFloatingReadPhase = false; /** - * Used to create canonical {@link ConstantNode}s for {@link Constant}s in this graph. - */ - private Map constants; - - /** - * Gets a node for a given constant that is unique/canonical within this graph. - * - * @param stamp the stamp for an {@link Kind#Object} constant (ignored otherwise) - */ - public ConstantNode asConstantNode(Constant constant, Stamp stamp) { - ConstantNode node; - if (constants == null) { - constants = new HashMap<>(); - node = null; - } else { - node = constants.get(constant); - } - if (node == null) { - node = new ConstantNode(constant, stamp == null ? StampFactory.forConstant(constant) : stamp); - constants.put(constant, node); - } - return node; - } - - @SuppressWarnings("unchecked") - @Override - public T uniqueExternal(T node) { - ConstantNode cn = (ConstantNode) node; - return (T) asConstantNode(cn.asConstant(), cn.stamp()); - } - - /** * Creates a new Graph containing a single {@link AbstractBeginNode} as the {@link #start() * start} node. */ diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Fri Dec 13 20:20:11 2013 +0100 @@ -123,7 +123,7 @@ } public static void killWithUnusedFloatingInputs(Node node) { - if (node.recordsUsages() && !node.isExternal()) { + if (node.recordsUsages()) { List floatingInputs = node.inputs().filter(isFloatingNode()).snapshot(); node.safeDelete(); @@ -354,14 +354,14 @@ * Process a node as part of this search. * * @param node the next node encountered in the search - * @param worklist if non-null and {@code node} is not external, {@code node} will be added - * to this list. Otherwise, {@code node} is treated as a candidate result. + * @param worklist if non-null, {@code node} will be added to this list. Otherwise, + * {@code node} is treated as a candidate result. * @return true if the search should continue, false if a definitive {@link #result} has * been found */ private boolean process(ValueNode node, NodeWorkList worklist) { if (node.isAlive()) { - if (node.isExternal() || worklist == null) { + if (worklist == null) { if (result == null) { // Initial candidate result: continue search result = node; diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java Fri Dec 13 20:20:11 2013 +0100 @@ -112,17 +112,13 @@ for (Node node : graph.getNodes()) { if (flood.isMarked(node)) { for (Node input : node.inputs()) { - if (!input.isExternal()) { - flood.add(input); - } + flood.add(input); } } } for (Node current : flood) { for (Node input : current.inputs()) { - if (!input.isExternal()) { - flood.add(input); - } + flood.add(input); } } } diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Fri Dec 13 20:20:11 2013 +0100 @@ -40,7 +40,6 @@ import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.*; import com.oracle.graal.graph.Graph.DuplicationReplacement; -import com.oracle.graal.graph.Node.ValueNumberable; import com.oracle.graal.graph.Node.Verbosity; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; @@ -1433,12 +1432,7 @@ if (returnNode.result() instanceof LocalNode) { returnValue = localReplacement.replacement(returnNode.result()); } else if (returnNode.result() != null) { - returnValue = returnNode.result(); - if (!returnValue.isExternal()) { - returnValue = duplicates.get(returnValue); - } else if (returnValue instanceof ValueNumberable) { - returnValue = graph.uniqueExternal(returnValue); - } + returnValue = duplicates.get(returnNode.result()); } invoke.asNode().replaceAtUsages(returnValue); Node returnDuplicate = duplicates.get(returnNode); diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Fri Dec 13 20:20:11 2013 +0100 @@ -365,7 +365,7 @@ // stop iterating: fixed nodes within the given set are traversal roots // anyway, and all other // fixed nodes are known to be outside. - } else if (!node.isExternal() && !aboveBound.isMarked(node)) { + } else if (!aboveBound.isMarked(node)) { worklist.add(node); aboveBound.mark(node); } @@ -378,9 +378,7 @@ while (!worklist.isEmpty()) { Node current = worklist.remove(); for (Node input : current.inputs()) { - if (!input.isExternal()) { - aboveClosure.apply(current, input); - } + aboveClosure.apply(current, input); } } diff -r 63724649e19e -r 5d47d69d523a 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 Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Fri Dec 13 20:20:11 2013 +0100 @@ -759,10 +759,6 @@ * Determines the earliest block in which the given node can be scheduled. */ private Block earliestBlock(Node node) { - if (node.isExternal()) { - return cfg.getStartBlock(); - } - Block earliest = cfg.getNodeToBlock().get(node); if (earliest != null) { return earliest; @@ -1088,7 +1084,7 @@ for (Node input : state.inputs()) { if (input instanceof VirtualState) { addUnscheduledToLatestSorting(b, (VirtualState) input, sortedInstructions, visited, reads, beforeLastLocation); - } else if (!input.isExternal()) { + } else { addToLatestSorting(b, (ScheduledNode) input, sortedInstructions, visited, reads, beforeLastLocation); } } @@ -1105,7 +1101,7 @@ if (input instanceof FrameState) { assert state == null; state = (FrameState) input; - } else if (!input.isExternal()) { + } else { addToLatestSorting(b, (ScheduledNode) input, sortedInstructions, visited, reads, beforeLastLocation); } diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Fri Dec 13 20:20:11 2013 +0100 @@ -105,7 +105,6 @@ } private final ConstantPool constantPool; - private final Map externalNodeIds; private final ByteBuffer buffer; private final WritableByteChannel channel; @@ -113,7 +112,6 @@ constantPool = new ConstantPool(); buffer = ByteBuffer.allocateDirect(256 * 1024); this.channel = channel; - this.externalNodeIds = new HashMap<>(); } public void print(Graph graph, String title, SchedulePhase predefinedSchedule) throws IOException { @@ -389,25 +387,9 @@ } } - /** - * Should be higher than any internal {@link Node#getId() node id}. - */ - @SuppressWarnings("javadoc") private static final int FIRST_EXTERNAL_NODE_ID = Integer.getInteger("graal.binaryGraphPrinter.firstExternalNodeId", 10000000); - @SuppressWarnings("deprecation") - private int getNodeId(Node node) { - if (!node.isExternal()) { - assert node.getId() < FIRST_EXTERNAL_NODE_ID : "internal node ids exceeded lowest external node id (" + FIRST_EXTERNAL_NODE_ID + - ") - use graal.binaryGraphPrinter.firstExternalNodeId system property to increase the latter"; - return node.getId(); - } else { - Integer id = externalNodeIds.get(node); - if (id == null) { - id = FIRST_EXTERNAL_NODE_ID + externalNodeIds.size(); - externalNodeIds.put(node, id); - } - return id; - } + private static int getNodeId(Node node) { + return node.getId(); } private void writeNodes(Graph graph) throws IOException { @@ -419,16 +401,8 @@ } } Map props = new HashMap<>(); - Map externalNodes = new HashMap<>(); - for (Node node : graph.getNodes()) { - for (Node input : node.inputs()) { - if (input.isExternal()) { - externalNodes.put(input, getNodeId(input)); - } - } - } - writeInt(graph.getNodeCount() + externalNodes.size()); + writeInt(graph.getNodeCount()); for (Node node : graph.getNodes()) { NodeClass nodeClass = node.getNodeClass(); @@ -453,22 +427,6 @@ props.clear(); } - for (Map.Entry e : externalNodes.entrySet()) { - Node node = e.getKey(); - NodeClass nodeClass = node.getNodeClass(); - node.getDebugProperties(props); - writeInt(e.getValue()); - writePoolObject(nodeClass); - writeByte(0); - // properties - writeShort((char) props.size()); - for (Entry entry : props.entrySet()) { - String key = entry.getKey().toString(); - writePoolObject(key); - writePropertyObject(entry.getValue()); - } - props.clear(); - } } private void writeEdges(Node node, Collection positions) throws IOException { diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsClosure.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsClosure.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsClosure.java Fri Dec 13 20:20:11 2013 +0100 @@ -231,7 +231,7 @@ public ValueNode getScalarAlias(ValueNode node) { assert !(node instanceof VirtualObjectNode); - if (node == null || !node.isAlive() || node.isExternal() || aliases.isNew(node)) { + if (node == null || !node.isAlive() || aliases.isNew(node)) { return node; } ValueNode result = aliases.get(node); diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Fri Dec 13 20:20:11 2013 +0100 @@ -611,7 +611,7 @@ } public ObjectState getObjectState(PartialEscapeBlockState state, ValueNode value) { - if (value == null || value.isExternal()) { + if (value == null) { return null; } if (value.isAlive() && !aliases.isNew(value)) { diff -r 63724649e19e -r 5d47d69d523a graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualUtil.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualUtil.java Fri Dec 13 19:31:10 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualUtil.java Fri Dec 13 20:20:11 2013 +0100 @@ -69,22 +69,18 @@ for (Node node : graph.getNodes()) { if (flood.isMarked(node)) { for (Node input : node.inputs()) { - if (!input.isExternal()) { - flood.add(input); - if (!path.containsKey(input)) { - path.put(input, node); - } + flood.add(input); + if (!path.containsKey(input)) { + path.put(input, node); } } } } for (Node current : flood) { for (Node input : current.inputs()) { - if (!input.isExternal()) { - flood.add(input); - if (!path.containsKey(input)) { - path.put(input, current); - } + flood.add(input); + if (!path.containsKey(input)) { + path.put(input, current); } } }