Search in sources :

Example 1 with SubstrateCompilationIdentifier

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

the class SubstrateGraalUtils method doCompile.

/**
 * Actual method compilation.
 *
 * For zone allocation this is where the zone boundary can be placed when the code is only
 * compiled. However using the returned compilation result would result into a zone allocation
 * invariant violation.
 */
private static CompilationResult doCompile(DebugContext initialDebug, RuntimeConfiguration runtimeConfig, Suites suites, LIRSuites lirSuites, final SubstrateMethod method) {
    String methodString = method.format("%H.%n(%p)");
    SubstrateCompilationIdentifier compilationId = new SubstrateCompilationIdentifier();
    return new CompilationWrapper<CompilationResult>(GraalSupport.get().getDebugOutputDirectory(), compilationProblemsPerAction) {

        @SuppressWarnings({ "unchecked", "unused" })
        <E extends Throwable> RuntimeException silenceThrowable(Class<E> type, Throwable ex) throws E {
            throw (E) ex;
        }

        @Override
        protected CompilationResult handleException(Throwable t) {
            throw silenceThrowable(RuntimeException.class, t);
        }

        @Override
        protected CompilationResult performCompilation(DebugContext debug) {
            StructuredGraph graph = GraalSupport.decodeGraph(debug, null, compilationId, method);
            return compileGraph(runtimeConfig, suites, lirSuites, method, graph);
        }

        @Override
        public String toString() {
            return methodString;
        }

        @Override
        protected DebugContext createRetryDebugContext(OptionValues options) {
            return GraalSupport.get().openDebugContext(options, compilationId, method);
        }
    }.run(initialDebug);
}
Also used : OptionValues(org.graalvm.compiler.options.OptionValues) SubstrateCompilationIdentifier(com.oracle.svm.core.graal.code.SubstrateCompilationIdentifier) DebugContext(org.graalvm.compiler.debug.DebugContext) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) CompilationResult(org.graalvm.compiler.code.CompilationResult) SubstrateCompilationResult(com.oracle.svm.core.graal.code.SubstrateCompilationResult)

Aggregations

SubstrateCompilationIdentifier (com.oracle.svm.core.graal.code.SubstrateCompilationIdentifier)1 SubstrateCompilationResult (com.oracle.svm.core.graal.code.SubstrateCompilationResult)1 CompilationResult (org.graalvm.compiler.code.CompilationResult)1 DebugContext (org.graalvm.compiler.debug.DebugContext)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 OptionValues (org.graalvm.compiler.options.OptionValues)1