# HG changeset patch # User Doug Simon # Date 1410897622 -7200 # Node ID 583bf03b3e1a76e5d53e5462f6ba5438a78d78a9 # Parent 4c9c347fa4daeeaae4a507e569036d5fc36e5006 apply CompilerToVM.shouldDebugNonSafepoints() to HotSpot Truffle compilations as well diff -r 4c9c347fa4da -r 583bf03b3e1a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- 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 getGraphBuilderSuite(HotSpotProviders providers) { PhaseSuite 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(); diff -r 4c9c347fa4da -r 583bf03b3e1a graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java --- 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 createGraphBuilderSuite() { PhaseSuite 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; } } diff -r 4c9c347fa4da -r 583bf03b3e1a graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderConfiguration.java --- 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. *

* 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. *

* 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, } diff -r 4c9c347fa4da -r 583bf03b3e1a graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java --- 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 graphBuilderSuite = suitesProvider.getDefaultGraphBuilderSuite(); + PhaseSuite 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 getGraphBuilderSuite(SuitesProvider suitesProvider) { + PhaseSuite 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> inliningPhase = suites.getHighTier().findPhase(InliningPhase.class); if (inliningPhase != null) {