changeset 19860:d4c45ab543c8

Remove metric ConstantNodes. Make LocalLiveness log output only available when assertions are enabled.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 15 Mar 2015 14:16:21 +0100
parents ba265a5410e0
children 7d933ffe6df6
files graal/com.oracle.graal.java/src/com/oracle/graal/java/LocalLiveness.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
diffstat 3 files changed, 33 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/LocalLiveness.java	Sun Mar 15 13:40:28 2015 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/LocalLiveness.java	Sun Mar 15 14:16:21 2015 +0100
@@ -53,24 +53,18 @@
         boolean changed;
         int iteration = 0;
         do {
-            Debug.log("Iteration %d", iteration);
+            assert traceIteration(iteration);
             changed = false;
             for (int i = blocks.length - 1; i >= 0; i--) {
                 BciBlock block = blocks[i];
                 int blockID = block.getId();
-                // log statements in IFs because debugLiveX creates a new String
-                if (Debug.isLogEnabled()) {
-                    Debug.logv("  start B%d  [%d, %d]  in: %s  out: %s  gen: %s  kill: %s", block.getId(), block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID),
-                                    debugLiveGen(blockID), debugLiveKill(blockID));
-                }
+                assert traceStart(block, blockID);
 
                 boolean blockChanged = (iteration == 0);
                 if (block.getSuccessorCount() > 0) {
                     int oldCardinality = liveOutCardinality(blockID);
                     for (BciBlock sux : block.getSuccessors()) {
-                        if (Debug.isLogEnabled()) {
-                            Debug.log("    Successor B%d: %s", sux.getId(), debugLiveIn(sux.getId()));
-                        }
+                        assert traceSuccessor(sux);
                         propagateLiveness(blockID, sux.getId());
                     }
                     blockChanged |= (oldCardinality != liveOutCardinality(blockID));
@@ -78,10 +72,7 @@
 
                 if (blockChanged) {
                     updateLiveness(blockID);
-                    if (Debug.isLogEnabled()) {
-                        Debug.logv("  end   B%d  [%d, %d]  in: %s  out: %s  gen: %s  kill: %s", block.getId(), block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID),
-                                        debugLiveGen(blockID), debugLiveKill(blockID));
-                    }
+                    assert traceEnd(block, blockID);
                 }
                 changed |= blockChanged;
             }
@@ -89,6 +80,34 @@
         } while (changed);
     }
 
+    private static boolean traceIteration(int iteration) {
+        Debug.log("Iteration %d", iteration);
+        return true;
+    }
+
+    private boolean traceEnd(BciBlock block, int blockID) {
+        if (Debug.isLogEnabled()) {
+            Debug.logv("  end   B%d  [%d, %d]  in: %s  out: %s  gen: %s  kill: %s", block.getId(), block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), debugLiveGen(blockID),
+                            debugLiveKill(blockID));
+        }
+        return true;
+    }
+
+    private boolean traceSuccessor(BciBlock sux) {
+        if (Debug.isLogEnabled()) {
+            Debug.log("    Successor B%d: %s", sux.getId(), debugLiveIn(sux.getId()));
+        }
+        return true;
+    }
+
+    private boolean traceStart(BciBlock block, int blockID) {
+        if (Debug.isLogEnabled()) {
+            Debug.logv("  start B%d  [%d, %d]  in: %s  out: %s  gen: %s  kill: %s", block.getId(), block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), debugLiveGen(blockID),
+                            debugLiveKill(blockID));
+        }
+        return true;
+    }
+
     /**
      * Returns whether the local is live at the beginning of the given block.
      */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java	Sun Mar 15 13:40:28 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java	Sun Mar 15 14:16:21 2015 +0100
@@ -28,7 +28,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodeinfo.*;
@@ -42,7 +41,6 @@
 public final class ConstantNode extends FloatingNode implements LIRLowerable {
 
     public static final NodeClass<ConstantNode> TYPE = NodeClass.create(ConstantNode.class);
-    private static final DebugMetric ConstantNodes = Debug.metric("ConstantNodes");
 
     protected final Constant value;
 
@@ -60,7 +58,6 @@
         super(TYPE, stamp);
         assert stamp != null && isCompatible(value, stamp);
         this.value = value;
-        ConstantNodes.increment();
     }
 
     private static boolean isCompatible(Constant value, Stamp stamp) {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Sun Mar 15 13:40:28 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Sun Mar 15 14:16:21 2015 +0100
@@ -262,6 +262,7 @@
         plugins.setInlineInvokePlugin(new InlineInvokePlugin(callTarget.getInlining(), providers.getReplacements()));
         plugins.setLoopExplosionPlugin(new LoopExplosionPlugin());
         TruffleGraphBuilderPlugins.registerInvocationPlugins(providers.getMetaAccess(), newConfig.getPlugins().getInvocationPlugins());
+
         new GraphBuilderPhase.Instance(providers.getMetaAccess(), providers.getStampProvider(), this.snippetReflection, providers.getConstantReflection(), newConfig,
                         TruffleCompilerImpl.Optimizations, null).apply(graph);
         Debug.dump(graph, "After FastPE");