changeset 8150:b66f831ac5ab

Fix CFG printer output. Clean up after making the compiler class all-static.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 07 Mar 2013 15:17:51 +0100
parents 8fe43a4301dd
children b8f261ba79c6
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java
diffstat 7 files changed, 15 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu Mar 07 14:38:28 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu Mar 07 15:17:51 2013 +0100
@@ -51,7 +51,7 @@
                     final StructuredGraph graph, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts) {
         assert (method.getModifiers() & Modifier.NATIVE) == 0 : "compiling native methods is not supported";
 
-        return Debug.scope("GraalCompiler", new Object[]{graph, method}, new Callable<CompilationResult>() {
+        return Debug.scope("GraalCompiler", new Object[]{graph, method, runtime}, new Callable<CompilationResult>() {
 
             public CompilationResult call() {
                 final Assumptions assumptions = new Assumptions(GraalOptions.OptAssumptions);
--- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java	Thu Mar 07 14:38:28 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java	Thu Mar 07 15:17:51 2013 +0100
@@ -93,7 +93,6 @@
 
                 // return the initialized compiler to the client
                 HotSpotGraalRuntime compiler = initializeServer(toVM);
-                compiler.getCompiler();
                 streams.getInvocation().sendResult(compiler);
 
                 for (ConnectionObserver observer : observers) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Mar 07 14:38:28 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Mar 07 15:17:51 2013 +0100
@@ -177,7 +177,7 @@
     }
 
     private void installMethod(final CompilationResult tm) {
-        Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), graalRuntime.getCompiler(), method}, new Runnable() {
+        Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), graalRuntime.getRuntime(), method}, new Runnable() {
 
             @Override
             public void run() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Thu Mar 07 14:38:28 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Thu Mar 07 15:17:51 2013 +0100
@@ -30,7 +30,6 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.logging.*;
@@ -110,7 +109,6 @@
     protected/* final */VMToCompiler vmToCompiler;
 
     protected final HotSpotRuntime runtime;
-    protected final GraalCompiler compiler;
     protected final TargetDescription target;
 
     private HotSpotRuntimeInterpreterInterface runtimeInterpreterInterface;
@@ -143,7 +141,6 @@
 
         backend = createBackend();
         GraalOptions.StackShadowPages = config.stackShadowPages;
-        compiler = new GraalCompiler();
         if (GraalOptions.CacheGraphs) {
             cache = new HotSpotGraphCache();
         }
@@ -178,10 +175,6 @@
         return target;
     }
 
-    public GraalCompiler getCompiler() {
-        return compiler;
-    }
-
     public HotSpotGraphCache getCache() {
         return cache;
     }
@@ -267,9 +260,6 @@
         if (clazz == HotSpotRuntime.class) {
             return (T) runtime;
         }
-        if (clazz == GraalCompiler.class) {
-            return (T) getCompiler();
-        }
         if (clazz == Backend.class) {
             return (T) getBackend();
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu Mar 07 14:38:28 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu Mar 07 15:17:51 2013 +0100
@@ -361,8 +361,8 @@
 
         newInstanceStub = new NewInstanceStub(this, assumptions, graalRuntime.getTarget());
         newArrayStub = new NewArrayStub(this, assumptions, graalRuntime.getTarget());
-        newInstanceStub.install(backend, graalRuntime.getCompiler());
-        newArrayStub.install(backend, graalRuntime.getCompiler());
+        newInstanceStub.install(backend);
+        newArrayStub.install(backend);
     }
 
     public HotSpotGraalRuntime getGraalRuntime() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Thu Mar 07 14:38:28 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Thu Mar 07 15:17:51 2013 +0100
@@ -70,8 +70,8 @@
     protected InstalledCode stubCode;
 
     /**
-     * Creates a new stub container. The new stub still needs to be
-     * {@linkplain #install(Backend, GraalCompiler) installed}.
+     * Creates a new stub container. The new stub still needs to be {@linkplain #install(Backend)
+     * installed}.
      * 
      * @param descriptor linkage details for a call to the stub
      */
@@ -107,7 +107,7 @@
      * Compiles the code for this stub, installs it and initializes the address used for calls to
      * it.
      */
-    public void install(Backend backend, GraalCompiler compiler) {
+    public void install(Backend backend) {
         StructuredGraph graph = (StructuredGraph) stubMethod.getCompilerStorage().get(Graph.class);
 
         Key key = new Key(stubMethod);
@@ -121,7 +121,7 @@
         final CompilationResult compResult = GraalCompiler.compileMethod(runtime(), backend, runtime().getTarget(), stubMethod, graph, null, phasePlan, OptimisticOptimizations.ALL);
 
         final CodeInfo[] info = new CodeInfo[1];
-        stubCode = Debug.scope("CodeInstall", new Object[]{compiler, stubMethod}, new Callable<InstalledCode>() {
+        stubCode = Debug.scope("CodeInstall", new Object[]{runtime(), stubMethod}, new Callable<InstalledCode>() {
 
             @Override
             public InstalledCode call() {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Thu Mar 07 14:38:28 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Thu Mar 07 15:17:51 2013 +0100
@@ -54,6 +54,7 @@
             dumpSandboxed(object, message);
         } catch (Throwable ex) {
             TTY.println("CFGPrinter: Exception during output of " + message + ": " + ex);
+            ex.printStackTrace();
         }
     }
 
@@ -115,18 +116,23 @@
             return;
         }
 
-        cfgPrinter.target = Debug.contextLookup(TargetDescription.class);
         if (object instanceof LIR) {
             cfgPrinter.lir = (LIR) object;
         } else {
             cfgPrinter.lir = Debug.contextLookup(LIR.class);
         }
         cfgPrinter.lirGenerator = Debug.contextLookup(LIRGenerator.class);
+        if (cfgPrinter.lirGenerator != null) {
+            cfgPrinter.target = cfgPrinter.lirGenerator.target();
+        }
         if (cfgPrinter.lir != null) {
             cfgPrinter.cfg = cfgPrinter.lir.cfg;
         }
 
         CodeCacheProvider runtime = Debug.contextLookup(CodeCacheProvider.class);
+        if (runtime != null) {
+            cfgPrinter.target = runtime.getTarget();
+        }
 
         if (object instanceof BciBlockMapping) {
             BciBlockMapping blockMap = (BciBlockMapping) object;