changeset 16614:0f2a9150d6f8

CleanTypeProfileProxyPhase should cleanup after itself
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 29 Jul 2014 17:39:11 -0700
parents 0d582cb054c7
children 3812931f9350
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java
diffstat 2 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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));
--- 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<PhaseContext> {
+
+    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;
     }