Search in sources :

Example 1 with CompilationRequestResult

use of jdk.vm.ci.code.CompilationRequestResult in project graal by oracle.

the class HotSpotGraalCompiler method compileMethod.

@SuppressWarnings("try")
CompilationRequestResult compileMethod(CompilationRequest request, boolean installAsDefault) {
    if (graalRuntime.isShutdown()) {
        return HotSpotCompilationRequestResult.failure(String.format("Shutdown entered"), false);
    }
    ResolvedJavaMethod method = request.getMethod();
    OptionValues options = graalRuntime.getOptions(method);
    if (graalRuntime.isBootstrapping()) {
        if (DebugOptions.BootstrapInitializeOnly.getValue(options)) {
            return HotSpotCompilationRequestResult.failure(String.format("Skip compilation because %s is enabled", DebugOptions.BootstrapInitializeOnly.getName()), true);
        }
        if (bootstrapWatchDog != null) {
            if (bootstrapWatchDog.hitCriticalCompilationRateOrTimeout()) {
                // Drain the compilation queue to expedite completion of the bootstrap
                return HotSpotCompilationRequestResult.failure("hit critical bootstrap compilation rate or timeout", true);
            }
        }
    }
    HotSpotCompilationRequest hsRequest = (HotSpotCompilationRequest) request;
    try (CompilationWatchDog w1 = CompilationWatchDog.watch(method, hsRequest.getId(), options);
        BootstrapWatchDog.Watch w2 = bootstrapWatchDog == null ? null : bootstrapWatchDog.watch(request);
        CompilationAlarm alarm = CompilationAlarm.trackCompilationPeriod(options)) {
        if (compilationCounters != null) {
            compilationCounters.countCompilation(method);
        }
        CompilationTask task = new CompilationTask(jvmciRuntime, this, hsRequest, true, installAsDefault, options);
        CompilationRequestResult r = null;
        try (DebugContext debug = graalRuntime.openDebugContext(options, task.getCompilationIdentifier(), method, getDebugHandlersFactories());
            Activation a = debug.activate()) {
            r = task.runCompilation(debug);
        }
        assert r != null;
        return r;
    }
}
Also used : CompilationRequestResult(jdk.vm.ci.code.CompilationRequestResult) HotSpotCompilationRequestResult(jdk.vm.ci.hotspot.HotSpotCompilationRequestResult) OptionValues(org.graalvm.compiler.options.OptionValues) CompilationAlarm(org.graalvm.compiler.core.common.util.CompilationAlarm) Activation(org.graalvm.compiler.debug.DebugContext.Activation) DebugContext(org.graalvm.compiler.debug.DebugContext) HotSpotCompilationRequest(jdk.vm.ci.hotspot.HotSpotCompilationRequest) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

CompilationRequestResult (jdk.vm.ci.code.CompilationRequestResult)1 HotSpotCompilationRequest (jdk.vm.ci.hotspot.HotSpotCompilationRequest)1 HotSpotCompilationRequestResult (jdk.vm.ci.hotspot.HotSpotCompilationRequestResult)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 CompilationAlarm (org.graalvm.compiler.core.common.util.CompilationAlarm)1 DebugContext (org.graalvm.compiler.debug.DebugContext)1 Activation (org.graalvm.compiler.debug.DebugContext.Activation)1 OptionValues (org.graalvm.compiler.options.OptionValues)1