# HG changeset patch # User Gilles Duboscq # Date 1342778739 -7200 # Node ID d6765d84974a07d30819eb429ad93534d0a74bfb # Parent 59f209dd356bab763c572927d620f0b608c6214a# Parent 1cb45c7dba5517a8113f70a9a06d9fa7f460497e Merge diff -r 59f209dd356b -r d6765d84974a graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/TailDuplicationPhase.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/TailDuplicationPhase.java Fri Jul 20 12:05:20 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/TailDuplicationPhase.java Fri Jul 20 12:05:39 2012 +0200 @@ -232,6 +232,7 @@ final HashSet duplicatedNodes = buildDuplicatedNodeSet(fixedNodes, stateAfter); mergeAfter.clearEnds(); expandDuplicated(duplicatedNodes, mergeAfter); + retargetDependencies(duplicatedNodes, anchor); List endSnapshot = merge.forwardEnds().snapshot(); List phiSnapshot = merge.phis().snapshot(); @@ -491,6 +492,27 @@ } /** + * Moves all depdendencies that point outside the duplicated area to the supplied value anchor node. + * + * @param duplicatedNodes The set of duplicated nodes. + * @param anchor The node that will be the new target for all dependencies that point outside the duplicated set of nodes. + */ + private static void retargetDependencies(HashSet duplicatedNodes, ValueAnchorNode anchor) { + for (Node node : duplicatedNodes) { + if (node instanceof ValueNode) { + NodeInputList dependencies = ((ValueNode) node).dependencies(); + for (int i = 0; i < dependencies.size(); i++) { + Node dependency = dependencies.get(i); + if (dependency != null && !duplicatedNodes.contains(dependency)) { + Debug.log("retargeting dependency %s to %s on %s", dependency, anchor, node); + dependencies.set(i, anchor); + } + } + } + } + } + + /** * Checks if the given node has usages that are not within the given set of nodes. * * @param node The node whose usages are checked. diff -r 59f209dd356b -r d6765d84974a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Fri Jul 20 12:05:20 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Fri Jul 20 12:05:39 2012 +0200 @@ -45,21 +45,11 @@ public final class GuardNode extends FloatingNode implements Canonicalizable, LIRLowerable, TypeFeedbackProvider, Node.IterableNodeType, Negatable { @Input private BooleanNode condition; - @Input(notDataflow = true) private FixedNode anchor; private final DeoptimizationReason reason; private final DeoptimizationAction action; private boolean negated; private final long leafGraphId; - public FixedNode anchor() { - return anchor; - } - - public void setAnchor(FixedNode x) { - updateUsages(anchor, x); - anchor = x; - } - /** * The instruction that produces the tested boolean value. */ @@ -85,9 +75,8 @@ } public GuardNode(BooleanNode condition, FixedNode anchor, DeoptimizationReason reason, DeoptimizationAction action, boolean negated, long leafGraphId) { - super(StampFactory.dependency()); + super(StampFactory.dependency(), anchor); this.condition = condition; - this.anchor = anchor; this.reason = reason; this.action = action; this.negated = negated;