changeset 17113:583bf03b3e1a

apply CompilerToVM.shouldDebugNonSafepoints() to HotSpot Truffle compilations as well
author Doug Simon <doug.simon@oracle.com>
date Tue, 16 Sep 2014 22:00:22 +0200
parents 4c9c347fa4da
children 8ca5e41dde86
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderConfiguration.java graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java
diffstat 4 files changed, 25 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Mon Sep 15 20:20:51 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Tue Sep 16 22:00:22 2014 +0200
@@ -52,7 +52,6 @@
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.java.*;
-import com.oracle.graal.java.GraphBuilderConfiguration.DebugInfoMode;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
@@ -131,16 +130,6 @@
 
     protected PhaseSuite<HighTierContext> getGraphBuilderSuite(HotSpotProviders providers) {
         PhaseSuite<HighTierContext> suite = providers.getSuites().getDefaultGraphBuilderSuite();
-
-        if (HotSpotGraalRuntime.runtime().getCompilerToVM().shouldDebugNonSafepoints()) {
-            // need to tweak the graph builder config
-            suite = suite.copy();
-            GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) suite.findPhase(GraphBuilderPhase.class).previous();
-            GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig();
-            GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig.withDebugInfoMode(DebugInfoMode.Simple));
-            suite.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase);
-        }
-
         boolean osrCompilation = entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI;
         if (osrCompilation) {
             suite = suite.copy();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java	Mon Sep 15 20:20:51 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java	Tue Sep 16 22:00:22 2014 +0200
@@ -27,6 +27,7 @@
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.java.*;
+import com.oracle.graal.java.GraphBuilderConfiguration.*;
 import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
@@ -75,7 +76,11 @@
 
     protected PhaseSuite<HighTierContext> createGraphBuilderSuite() {
         PhaseSuite<HighTierContext> suite = new PhaseSuite<>();
-        suite.appendPhase(new GraphBuilderPhase(GraphBuilderConfiguration.getDefault()));
+        GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault();
+        if (runtime.getCompilerToVM().shouldDebugNonSafepoints()) {
+            config = config.withDebugInfoMode(DebugInfoMode.Simple);
+        }
+        suite.appendPhase(new GraphBuilderPhase(config));
         return suite;
     }
 }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderConfiguration.java	Mon Sep 15 20:20:51 2014 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderConfiguration.java	Tue Sep 16 22:00:22 2014 +0200
@@ -38,7 +38,7 @@
     public static enum DebugInfoMode {
         SafePointsOnly,
         /**
-         * This mode inserts {@link FullInfopointNode}s in places where no safepoints would be
+         * This mode inserts {@link SimpleInfopointNode}s in places where no safepoints would be
          * inserted: inlining boundaries, and line number switches.
          * <p>
          * In this mode the infopoint only have a location (method and bytecode index) and no
@@ -50,11 +50,11 @@
          */
         Simple,
         /**
-         * In this mode, infopoints are generated in the same locations as in {@link #Simple} mode
-         * but the infopoints have access to the runtime values.
+         * In this mode, {@link FullInfopointNode}s are generated in the same locations as in
+         * {@link #Simple} mode but the infopoints have access to the runtime values.
          * <p>
          * This is relevant when code is to be generated for native, machine-code level debugging
-         * but can have a limit the amount of optimisation applied to the code.
+         * but can have a limit the amount of optimization applied to the code.
          */
         Full,
     }
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Mon Sep 15 20:20:51 2014 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Tue Sep 16 22:00:22 2014 +0200
@@ -44,6 +44,7 @@
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.java.*;
+import com.oracle.graal.java.GraphBuilderConfiguration.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
@@ -246,7 +247,7 @@
         removeInliningPhase(suites);
         StructuredGraph graph = new StructuredGraph(javaMethod);
         new GraphBuilderPhase.Instance(metaAccess, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph);
-        PhaseSuite<HighTierContext> graphBuilderSuite = suitesProvider.getDefaultGraphBuilderSuite();
+        PhaseSuite<HighTierContext> graphBuilderSuite = getGraphBuilderSuite(suitesProvider);
         CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false);
         Backend backend = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend();
         CompilationResultBuilderFactory factory = getOptimizedCallTargetInstrumentationFactory(backend.getTarget().arch.getName(), javaMethod);
@@ -259,6 +260,19 @@
         return runtimeProvider.getHostBackend().getProviders();
     }
 
+    private static PhaseSuite<HighTierContext> getGraphBuilderSuite(SuitesProvider suitesProvider) {
+        PhaseSuite<HighTierContext> graphBuilderSuite = suitesProvider.getDefaultGraphBuilderSuite();
+        if (HotSpotGraalRuntime.runtime().getCompilerToVM().shouldDebugNonSafepoints()) {
+            // need to tweak the graph builder config
+            graphBuilderSuite = graphBuilderSuite.copy();
+            GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) graphBuilderSuite.findPhase(GraphBuilderPhase.class).previous();
+            GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig();
+            GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig.withDebugInfoMode(DebugInfoMode.Simple));
+            graphBuilderSuite.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase);
+        }
+        return graphBuilderSuite;
+    }
+
     private static void removeInliningPhase(Suites suites) {
         ListIterator<BasePhase<? super HighTierContext>> inliningPhase = suites.getHighTier().findPhase(InliningPhase.class);
         if (inliningPhase != null) {