Mercurial > hg > graal-jvmci-8
changeset 5861:1cb45c7dba55
retarget dependencies during TailDuplicationPhase
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 19 Jul 2012 14:54:33 +0200 |
parents | 32a7714ac0c5 |
children | 44eb34b54526 d6765d84974a a10e72af4dc5 |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/TailDuplicationPhase.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java |
diffstat | 2 files changed, 23 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/TailDuplicationPhase.java Thu Jul 19 00:56:40 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/TailDuplicationPhase.java Thu Jul 19 14:54:33 2012 +0200 @@ -232,6 +232,7 @@ final HashSet<Node> duplicatedNodes = buildDuplicatedNodeSet(fixedNodes, stateAfter); mergeAfter.clearEnds(); expandDuplicated(duplicatedNodes, mergeAfter); + retargetDependencies(duplicatedNodes, anchor); List<EndNode> endSnapshot = merge.forwardEnds().snapshot(); List<PhiNode> 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<Node> duplicatedNodes, ValueAnchorNode anchor) { + for (Node node : duplicatedNodes) { + if (node instanceof ValueNode) { + NodeInputList<ValueNode> 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.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Thu Jul 19 00:56:40 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Thu Jul 19 14:54:33 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;