use of org.graalvm.compiler.debug.DebugContext in project graal by oracle.
the class GreedyInliningPolicy method continueInlining.
@Override
public boolean continueInlining(StructuredGraph currentGraph) {
if (InliningUtil.getNodeCount(currentGraph) >= MaximumDesiredSize.getValue(currentGraph.getOptions())) {
DebugContext debug = currentGraph.getDebug();
InliningUtil.logInliningDecision(debug, "inlining is cut off by MaximumDesiredSize");
inliningStoppedByMaxDesiredSizeCounter.increment(debug);
return false;
}
return true;
}
use of org.graalvm.compiler.debug.DebugContext in project graal by oracle.
the class GuardLoweringPhase method processBlock.
private static void processBlock(Block block, ScheduleResult schedule) {
DebugContext debug = block.getBeginNode().getDebug();
new LowerGuards(block, debug.isDumpEnabledForMethod() || debug.isLogEnabledForMethod()).processNodes(block, schedule);
}
use of org.graalvm.compiler.debug.DebugContext 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 in project graal by oracle.
the class HotSpotGraalCompiler method getIntrinsicGraph.
/**
* Gets a graph produced from the intrinsic for a given method that can be compiled and
* installed for the method.
*
* @param method
* @param compilationId
* @param options
* @param debug
* @return an intrinsic graph that can be compiled and installed for {@code method} or null
*/
@SuppressWarnings("try")
public StructuredGraph getIntrinsicGraph(ResolvedJavaMethod method, HotSpotProviders providers, CompilationIdentifier compilationId, OptionValues options, DebugContext debug) {
Replacements replacements = providers.getReplacements();
Bytecode subst = replacements.getSubstitutionBytecode(method);
if (subst != null) {
ResolvedJavaMethod substMethod = subst.getMethod();
assert !substMethod.equals(method);
StructuredGraph graph = new StructuredGraph.Builder(options, debug, AllowAssumptions.YES).method(substMethod).compilationId(compilationId).build();
try (DebugContext.Scope scope = debug.scope("GetIntrinsicGraph", graph)) {
Plugins plugins = new Plugins(providers.getGraphBuilderPlugins());
GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins);
IntrinsicContext initialReplacementContext = new IntrinsicContext(method, substMethod, subst.getOrigin(), ROOT_COMPILATION);
new GraphBuilderPhase.Instance(providers.getMetaAccess(), providers.getStampProvider(), providers.getConstantReflection(), providers.getConstantFieldProvider(), config, OptimisticOptimizations.NONE, initialReplacementContext).apply(graph);
assert !graph.isFrozen();
return graph;
} catch (Throwable e) {
debug.handle(e);
}
}
return null;
}
use of org.graalvm.compiler.debug.DebugContext in project graal by oracle.
the class HotSpotGraalVMEventListener method notifyInstall.
@Override
public void notifyInstall(HotSpotCodeCacheProvider codeCache, InstalledCode installedCode, CompiledCode compiledCode) {
DebugContext debug = DebugContext.forCurrentThread();
if (debug.isDumpEnabled(DebugContext.BASIC_LEVEL)) {
CompilationResult compResult = debug.contextLookup(CompilationResult.class);
assert compResult != null : "can't dump installed code properly without CompilationResult";
debug.dump(DebugContext.BASIC_LEVEL, installedCode, "After code installation");
}
if (debug.isLogEnabled()) {
debug.log("%s", codeCache.disassemble(installedCode));
}
for (HotSpotCodeCacheListener listener : listeners) {
listener.notifyInstall(codeCache, installedCode, compiledCode);
}
}
Aggregations