use of org.graalvm.compiler.debug.DebugContext.Activation 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;
}
}
use of org.graalvm.compiler.debug.DebugContext.Activation in project graal by oracle.
the class HotSpotTruffleCompilerImpl method installTruffleCallBoundaryMethods.
/**
* @see #compileTruffleCallBoundaryMethod
*/
@Override
@SuppressWarnings("try")
public void installTruffleCallBoundaryMethods() {
HotSpotTruffleCompilerRuntime runtime = (HotSpotTruffleCompilerRuntime) TruffleCompilerRuntime.getRuntime();
for (ResolvedJavaMethod method : runtime.getTruffleCallBoundaryMethods()) {
HotSpotCompilationIdentifier compilationId = (HotSpotCompilationIdentifier) backend.getCompilationIdentifier(method);
OptionValues options = getOptions();
try (DebugContext debug = DebugStubsAndSnippets.getValue(options) ? hotspotGraalRuntime.openDebugContext(options, compilationId, method, getDebugHandlerFactories()) : DebugContext.DISABLED;
Activation a = debug.activate();
DebugContext.Scope d = debug.scope("InstallingTruffleStub")) {
CompilationResult compResult = compileTruffleCallBoundaryMethod(method, compilationId, debug);
CodeCacheProvider codeCache = providers.getCodeCache();
try (DebugContext.Scope s = debug.scope("CodeInstall", codeCache, method, compResult)) {
CompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(codeCache, method, compilationId.getRequest(), compResult);
codeCache.setDefaultCode(method, compiledCode);
} catch (Throwable e) {
throw debug.handle(e);
}
}
}
}
Aggregations