changeset 4402:8220fa69f075

Remove TraceInlining.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 29 Jan 2012 00:03:33 +0100
parents 082672892253
children 48bc781395ae
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java
diffstat 5 files changed, 25 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Sat Jan 28 23:56:49 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java	Sun Jan 29 00:03:33 2012 +0100
@@ -113,8 +113,6 @@
     public static boolean TraceRelocation                    = ____;
     public static boolean TraceLIRVisit                      = ____;
     public static boolean TraceAssembler                     = ____;
-    public static boolean TraceInlining                      = ____;
-    public static boolean TraceDeadCodeElimination           = ____;
     public static boolean TraceEscapeAnalysis                = ____;
     public static int     TraceBytecodeParserLevel           = 0;
     public static boolean ExitVMOnBailout                    = ____;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java	Sat Jan 28 23:56:49 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java	Sun Jan 29 00:03:33 2012 +0100
@@ -22,8 +22,7 @@
  */
 package com.oracle.max.graal.compiler.phases;
 
-import com.oracle.max.criutils.*;
-import com.oracle.max.graal.compiler.*;
+import com.oracle.max.graal.debug.*;
 import com.oracle.max.graal.graph.*;
 import com.oracle.max.graal.nodes.*;
 
@@ -81,9 +80,7 @@
             if (!flood.isMarked(node)) {
                 LoopBeginNode loop = node.loopBegin();
                 if (flood.isMarked(loop)) {
-                    if (GraalOptions.TraceDeadCodeElimination) {
-                        TTY.println("Removing loop with unreachable end: " + loop);
-                    }
+                    Debug.log("Removing loop with unreachable end: %s", loop);
                     node.setLoopBegin(null);
                     EndNode endNode = loop.endAt(0);
                     assert endNode.predecessor() != null;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java	Sat Jan 28 23:56:49 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java	Sun Jan 29 00:03:33 2012 +0100
@@ -504,9 +504,7 @@
                     }
                 } else {
                     exits.add(usage);
-                    if (!GraalOptions.TraceEscapeAnalysis) {
-                        break;
-                    }
+                    break;
                 }
             } else {
                 if (GraalOptions.ProbabilityAnalysis && usage instanceof FixedNode) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Sat Jan 28 23:56:49 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Sun Jan 29 00:03:33 2012 +0100
@@ -26,7 +26,6 @@
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.criutils.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition;
 import com.oracle.max.graal.compiler.util.*;
@@ -83,22 +82,14 @@
             InlineInfo info = inlineCandidates.remove();
             double penalty = Math.pow(GraalOptions.InliningSizePenaltyExp, graph.getNodeCount() / (double) GraalOptions.MaximumDesiredSize) / GraalOptions.InliningSizePenaltyExp;
             if (info.weight > GraalOptions.MaximumInlineWeight / (1 + penalty * GraalOptions.InliningSizePenalty)) {
-                if (GraalOptions.TraceInlining) {
-                    TTY.println("not inlining (cut off by weight):");
-                    while (info != null) {
-                        TTY.println("    %f %s", info.weight, info);
-                        info = inlineCandidates.poll();
-                    }
-                }
+                Debug.log("not inlining (cut off by weight): %e", info.weight);
                 return;
             }
             Iterable<Node> newNodes = null;
             if (info.invoke.node().isAlive()) {
                 try {
                     info.inline(graph, runtime, this);
-                    if (GraalOptions.TraceInlining) {
-                        TTY.println("inlining %f: %s", info.weight, info);
-                    }
+                    Debug.log("inlining %f: %s", info.weight, info);
                     Debug.dump(graph, "after inlining %s", info);
                     // get the new nodes here, the canonicalizer phase will reset the mark
                     newNodes = graph.getNewNodes();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Sat Jan 28 23:56:49 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Sun Jan 29 00:03:33 2012 +0100
@@ -28,7 +28,6 @@
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
-import com.oracle.max.criutils.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.cri.*;
 import com.oracle.max.graal.debug.*;
@@ -53,11 +52,15 @@
     }
 
     private static String methodName(RiResolvedMethod method, Invoke invoke) {
-        if (invoke != null && invoke.stateAfter() != null) {
-            RiMethod parent = invoke.stateAfter().method();
-            return parent.name() + "@" + invoke.bci() + ": " + CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)";
+        if (Debug.isLogEnabled()) {
+            if (invoke != null && invoke.stateAfter() != null) {
+                RiMethod parent = invoke.stateAfter().method();
+                return parent.name() + "@" + invoke.bci() + ": " + CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)";
+            } else {
+                return CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)";
+            }
         } else {
-            return CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)";
+            return null;
         }
     }
 
@@ -153,9 +156,7 @@
             assert invoke.predecessor() != null;
             graph.addBeforeFixed(invoke.node(), guard);
 
-            if (GraalOptions.TraceInlining) {
-                TTY.println("inlining with type check, type probability: %5.3f", probability);
-            }
+            Debug.log("inlining with type check, type probability: %5.3f", probability);
             return super.inline(graph, runtime, callback);
         }
 
@@ -184,10 +185,10 @@
 
         @Override
         public Node inline(StructuredGraph graph, GraalRuntime runtime, InliningCallback callback) {
-            if (GraalOptions.TraceInlining) {
+            if (Debug.isLogEnabled()) {
                 String targetName = CiUtil.format("%H.%n(%p):%r", invoke.callTarget().targetMethod());
                 String concreteName = CiUtil.format("%H.%n(%p):%r", concrete);
-                TTY.println("recording concrete method assumption: %s on receiver type %s -> %s", targetName, context, concreteName);
+                Debug.log("recording concrete method assumption: %s on receiver type %s -> %s", targetName, context, concreteName);
             }
             callback.recordConcreteMethodAssumption(invoke.callTarget().targetMethod(), context, concrete);
             return super.inline(graph, runtime, callback);
@@ -269,30 +270,22 @@
                 }
                 return null;
             } else {
-                if (GraalOptions.TraceInlining) {
-                    TTY.println("not inlining %s because GraalOptions.InlineWithTypeCheck == false", methodName(callTarget.targetMethod(), invoke));
-                }
+                Debug.log("not inlining %s because GraalOptions.InlineWithTypeCheck == false", methodName(callTarget.targetMethod(), invoke));
                 return null;
             }
         } else {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because no monomorphic receiver could be found", methodName(callTarget.targetMethod(), invoke));
-            }
+            Debug.log("not inlining %s because no monomorphic receiver could be found", methodName(callTarget.targetMethod(), invoke));
             return null;
         }
     }
 
     private static boolean checkInvokeConditions(Invoke invoke) {
         if (invoke.stateAfter() == null) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because the invoke has no after state", methodName(invoke.callTarget().targetMethod(), invoke));
-            }
+            Debug.log("not inlining %s because the invoke has no after state", methodName(invoke.callTarget().targetMethod(), invoke));
             return false;
         }
         if (invoke.predecessor() == null) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because the invoke is dead code", methodName(invoke.callTarget().targetMethod(), invoke));
-            }
+            Debug.log("not inlining %s because the invoke is dead code", methodName(invoke.callTarget().targetMethod(), invoke));
             return false;
         }
         return true;
@@ -300,34 +293,24 @@
 
     private static boolean checkTargetConditions(RiMethod method) {
         if (!(method instanceof RiResolvedMethod)) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because it is unresolved", method.toString());
-            }
+            Debug.log("not inlining %s because it is unresolved", method.toString());
             return false;
         }
         RiResolvedMethod resolvedMethod = (RiResolvedMethod) method;
         if (Modifier.isNative(resolvedMethod.accessFlags())) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because it is a native method", methodName(resolvedMethod));
-            }
+            Debug.log("not inlining %s because it is a native method", methodName(resolvedMethod));
             return false;
         }
         if (Modifier.isAbstract(resolvedMethod.accessFlags())) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because it is an abstract method", methodName(resolvedMethod));
-            }
+            Debug.log("not inlining %s because it is an abstract method", methodName(resolvedMethod));
             return false;
         }
         if (!resolvedMethod.holder().isInitialized()) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because of non-initialized class", methodName(resolvedMethod));
-            }
+            Debug.log("not inlining %s because of non-initialized class", methodName(resolvedMethod));
             return false;
         }
         if (!resolvedMethod.canBeInlined()) {
-            if (GraalOptions.TraceInlining) {
-                TTY.println("not inlining %s because it is marked non-inlinable", methodName(resolvedMethod));
-            }
+            Debug.log("not inlining %s because it is marked non-inlinable", methodName(resolvedMethod));
             return false;
         }
         return true;