# HG changeset patch # User Tom Rodriguez # Date 1406680751 25200 # Node ID 0f2a9150d6f84024551197fc4766ede834a6dc12 # Parent 0d582cb054c7e7dc5fcdee211d053b6184c16632 CleanTypeProfileProxyPhase should cleanup after itself diff -r 0d582cb054c7 -r 0f2a9150d6f8 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java Tue Jul 29 17:35:33 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java Tue Jul 29 17:39:11 2014 -0700 @@ -70,7 +70,7 @@ } } - appendPhase(new CleanTypeProfileProxyPhase()); + appendPhase(new CleanTypeProfileProxyPhase(canonicalizer)); if (FullUnroll.getValue()) { appendPhase(new LoopFullUnrollPhase(canonicalizer)); diff -r 0d582cb054c7 -r 0f2a9150d6f8 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java Tue Jul 29 17:35:33 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java Tue Jul 29 17:39:11 2014 -0700 @@ -22,15 +22,30 @@ */ package com.oracle.graal.phases.common; +import com.oracle.graal.graph.Graph.NodeEventScope; import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; +import com.oracle.graal.phases.common.util.*; +import com.oracle.graal.phases.tiers.*; -public class CleanTypeProfileProxyPhase extends Phase { +public class CleanTypeProfileProxyPhase extends BasePhase { + + private CanonicalizerPhase canonicalizer; + + public CleanTypeProfileProxyPhase(CanonicalizerPhase canonicalizer) { + this.canonicalizer = canonicalizer; + } @Override - protected void run(StructuredGraph graph) { - for (TypeProfileProxyNode proxy : graph.getNodes(TypeProfileProxyNode.class)) { - graph.replaceFloating(proxy, proxy.getValue()); + protected void run(StructuredGraph graph, PhaseContext context) { + HashSetNodeEventListener listener = new HashSetNodeEventListener(); + try (NodeEventScope s = graph.trackNodeEvents(listener)) { + for (TypeProfileProxyNode proxy : graph.getNodes(TypeProfileProxyNode.class)) { + graph.replaceFloating(proxy, proxy.getValue()); + } + } + if (!listener.getNodes().isEmpty()) { + canonicalizer.applyIncremental(graph, context, listener.getNodes()); } assert graph.getNodes(TypeProfileProxyNode.class).count() == 0; }