changeset 9813:c010c12ab682

put disassembling of installed code under the control of Debug.log(); use -G:Log=CodeInstall to show disassembly for all installed code
author Doug Simon <doug.simon@oracle.com>
date Fri, 24 May 2013 12:02:30 +0200
parents 8a3242d49786
children e723f9031785
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java
diffstat 2 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri May 24 11:38:07 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri May 24 12:02:30 2013 +0200
@@ -25,16 +25,15 @@
 import static com.oracle.graal.api.code.CodeUtil.*;
 import static com.oracle.graal.nodes.StructuredGraph.*;
 
-import java.lang.reflect.Modifier;
+import java.lang.reflect.*;
 import java.util.concurrent.*;
 
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.*;
+import com.oracle.graal.api.code.CallingConvention.Type;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.internal.*;
-import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
@@ -62,6 +61,8 @@
     private final int id;
     private final int priority;
 
+    private StructuredGraph graph;
+
     public static CompilationTask create(HotSpotGraalRuntime graalRuntime, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotResolvedJavaMethod method, int entryBCI, int id, int priority) {
         return new CompilationTask(graalRuntime, plan, optimisticOpts, method, entryBCI, id, priority);
     }
@@ -151,7 +152,7 @@
                     public CompilationResult call() throws Exception {
                         graalRuntime.evictDeoptedGraphs();
                         Replacements replacements = graalRuntime.getReplacements();
-                        StructuredGraph graph = replacements.getMethodSubstitution(method);
+                        graph = replacements.getMethodSubstitution(method);
                         if (graph == null || entryBCI != INVOCATION_ENTRY_BCI) {
                             graph = new StructuredGraph(method, entryBCI);
                         } else {
@@ -172,7 +173,7 @@
                 }
             }
 
-            installMethod(result, null);
+            installMethod(result);
         } catch (BailoutException bailout) {
             Debug.metric("Bailouts").increment();
             if (GraalOptions.ExitVMOnBailout) {
@@ -204,7 +205,7 @@
                         MetaUtil.format("%H::%n(%p)", method), isOSR ? "@ " + entryBCI + " " : "", method.getCodeSize()));
     }
 
-    private void installMethod(final CompilationResult compResult, final Graph graph) {
+    private void installMethod(final CompilationResult compResult) {
         Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), graalRuntime.getRuntime(), method}, new Runnable() {
 
             @Override
@@ -213,8 +214,9 @@
                 if (Debug.isDumpEnabled()) {
                     Debug.dump(new Object[]{compResult, installedCode}, "After code installation");
                 }
-                // TTY.println(String.valueOf(graph));
-                // TTY.println(graalRuntime.getRuntime().disassemble(installedCode));
+                if (Debug.isLogEnabled()) {
+                    Debug.log("%s", graalRuntime.getRuntime().disassemble(installedCode));
+                }
             }
 
         });
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Fri May 24 11:38:07 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Fri May 24 12:02:30 2013 +0200
@@ -173,8 +173,9 @@
                             if (Debug.isDumpEnabled()) {
                                 Debug.dump(new Object[]{compResult, installedCode}, "After code installation");
                             }
-                            // TTY.println(stub.toString());
-                            // TTY.println(runtime.disassemble(installedCode));
+                            if (Debug.isLogEnabled()) {
+                                Debug.log("%s", runtime.disassemble(installedCode));
+                            }
                             return installedCode;
                         }
                     });