Search in sources :

Example 1 with SubstrateCompilationResult

use of com.oracle.svm.core.graal.code.SubstrateCompilationResult in project graal by oracle.

the class SubstrateGraalUtils method compileGraph.

@SuppressWarnings("try")
public static CompilationResult compileGraph(RuntimeConfiguration runtimeConfig, Suites suites, LIRSuites lirSuites, final SharedMethod method, final StructuredGraph graph) {
    assert runtimeConfig != null : "no runtime";
    if (Options.ForceDumpGraphsBeforeCompilation.getValue()) {
        /*
             * forceDump is often used during debugging, and we want to make sure that it keeps
             * working, i.e., does not lead to image generation problems when adding a call to it.
             * This code ensures that forceDump is seen as reachable for all images that include
             * Graal, because it is conditional on a runtime option.
             */
        graph.getDebug().forceDump(graph, "Force dump before compilation");
    }
    String methodName = method.format("%h.%n");
    try (DebugContext debug = graph.getDebug();
        Indent indent = debug.logAndIndent("compile graph %s for method %s", graph, methodName)) {
        OptimisticOptimizations optimisticOpts = OptimisticOptimizations.ALL.remove(OptimisticOptimizations.Optimization.UseLoopLimitChecks);
        final Backend backend = runtimeConfig.lookupBackend(method);
        try (Indent indent2 = debug.logAndIndent("do compilation")) {
            SubstrateCompilationResult result = new SubstrateCompilationResult(graph.compilationId(), method.format("%H.%n(%p)"));
            GraalCompiler.compileGraph(graph, method, backend.getProviders(), backend, null, optimisticOpts, null, suites, lirSuites, result, CompilationResultBuilderFactory.Default);
            return result;
        }
    }
}
Also used : SubstrateCompilationResult(com.oracle.svm.core.graal.code.SubstrateCompilationResult) Indent(org.graalvm.compiler.debug.Indent) Backend(org.graalvm.compiler.core.target.Backend) DebugContext(org.graalvm.compiler.debug.DebugContext) OptimisticOptimizations(org.graalvm.compiler.phases.OptimisticOptimizations)

Aggregations

SubstrateCompilationResult (com.oracle.svm.core.graal.code.SubstrateCompilationResult)1 Backend (org.graalvm.compiler.core.target.Backend)1 DebugContext (org.graalvm.compiler.debug.DebugContext)1 Indent (org.graalvm.compiler.debug.Indent)1 OptimisticOptimizations (org.graalvm.compiler.phases.OptimisticOptimizations)1