changeset 5019:836e4fce33ab

changed inlining debug output
author Christian Haeubl <christian.haeubl@oracle.com>
date Fri, 02 Mar 2012 17:43:17 -0800
parents bf63d72879aa
children 77f816847d91
files 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 graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java
diffstat 3 files changed, 30 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Fri Mar 02 16:44:36 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Fri Mar 02 17:43:17 2012 -0800
@@ -85,32 +85,31 @@
 
         while (!inlineCandidates.isEmpty() && graph.getNodeCount() < GraalOptions.MaximumDesiredSize) {
             InlineInfo info = inlineCandidates.remove();
-            if (inliningPolicy.isWorthInlining(graph, info)) {
+            if (info.invoke.node().isAlive() && inliningPolicy.isWorthInlining(graph, info)) {
                 Iterable<Node> newNodes = null;
-                if (info.invoke.node().isAlive()) {
-                    try {
-                        info.inline(graph, runtime, this);
-                        Debug.dump(graph, "after %s", info);
-                        // get the new nodes here, the canonicalizer phase will reset the mark
-                        newNodes = graph.getNewNodes();
-                        if (GraalOptions.OptCanonicalizer) {
-                            new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph);
-                        }
-                        if (GraalOptions.Intrinsify) {
-                            new IntrinsificationPhase(runtime).apply(graph);
-                        }
-                        metricInliningPerformed.increment();
-                    } catch (CiBailout bailout) {
-                        // TODO determine if we should really bail out of the whole compilation.
-                        throw bailout;
-                    } catch (AssertionError e) {
-                        throw new GraalInternalError(e).addContext(info.toString());
-                    } catch (RuntimeException e) {
-                        throw new GraalInternalError(e).addContext(info.toString());
-                    } catch (GraalInternalError e) {
-                        throw e.addContext(info.toString());
+                try {
+                    info.inline(graph, runtime, this);
+                    Debug.dump(graph, "after %s", info);
+                    // get the new nodes here, the canonicalizer phase will reset the mark
+                    newNodes = graph.getNewNodes();
+                    if (GraalOptions.OptCanonicalizer) {
+                        new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph);
+                    }
+                    if (GraalOptions.Intrinsify) {
+                        new IntrinsificationPhase(runtime).apply(graph);
                     }
+                    metricInliningPerformed.increment();
+                } catch (CiBailout bailout) {
+                    // TODO determine if we should really bail out of the whole compilation.
+                    throw bailout;
+                } catch (AssertionError e) {
+                    throw new GraalInternalError(e).addContext(info.toString());
+                } catch (RuntimeException e) {
+                    throw new GraalInternalError(e).addContext(info.toString());
+                } catch (GraalInternalError e) {
+                    throw e.addContext(info.toString());
                 }
+
                 if (newNodes != null && info.level < GraalOptions.MaximumInlineLevel) {
                     scanInvokes(newNodes, info.level + 1, graph);
                 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Fri Mar 02 16:44:36 2012 -0800
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java	Fri Mar 02 17:43:17 2012 -0800
@@ -187,8 +187,6 @@
             graph.addBeforeFixed(invoke.node(), guard);
             graph.addBeforeFixed(invoke.node(), anchor);
 
-            Debug.log("inlining 1 method using 1 type check");
-
             StructuredGraph calleeGraph = getGraph(concrete, callback);
             assert !IntrinsificationPhase.canIntrinsify(invoke, concrete, runtime);
             callback.recordMethodContentsAssumption(concrete);
@@ -251,8 +249,6 @@
             } else {
                 inlineSingleMethod(graph, runtime, callback);
             }
-
-            Debug.log("inlining %d methods with %d type checks and falling back to %s if violated", numberOfMethods, types.length, shouldFallbackToInvoke() ? "invocation" : "deoptimization");
         }
 
         private boolean shouldFallbackToInvoke() {
@@ -487,7 +483,8 @@
 
         @Override
         public String toString() {
-            StringBuilder builder = new StringBuilder(String.format("inlining %d methods with %d type checks: ", concretes.size(), types.length));
+            StringBuilder builder = new StringBuilder(shouldFallbackToInvoke() ? "megamorphic" : "polymorphic");
+            builder.append(String.format(" inlining %d methods with %d type checks: ", concretes.size(), types.length));
             for (int i = 0; i < concretes.size(); i++) {
                 builder.append(CiUtil.format("  %H.%n(%p):%r", concretes.get(i)));
             }
@@ -661,7 +658,11 @@
                             return null;
                         }
                     } else {
-                        Debug.log("not inlining %s because GraalOptions.InlineMonomorphicCalls == false", methodName(targetMethod, invoke));
+                        if (!GraalOptions.InlinePolymorphicCalls && notRecordedTypeProbability == 0) {
+                            Debug.log("not inlining %s because GraalOptions.InlinePolymorphicCalls == false", methodName(targetMethod, invoke));
+                        } else {
+                            Debug.log("not inlining %s because GraalOptions.InlineMegamorphicCalls == false", methodName(targetMethod, invoke));
+                        }
                         return null;
                     }
                 }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Mar 02 16:44:36 2012 -0800
+++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Mar 02 17:43:17 2012 -0800
@@ -290,7 +290,7 @@
                     // java.util.concurrent.BlockingQueue is used to implement the compilation worker
                     // queues. If a compiler thread triggers a compilation, then it may be blocked trying
                     // to add something to its own queue.
-                    return false;
+                    return true;
                 }
             }