use of org.graalvm.compiler.debug.DebugContext.Description in project graal by oracle.
the class ReplacementsImpl method openDebugContext.
protected DebugContext openDebugContext(String idPrefix, ResolvedJavaMethod method) {
DebugContext outer = DebugContext.forCurrentThread();
Description description = new Description(method, idPrefix + nextDebugContextId.incrementAndGet());
List<DebugHandlersFactory> factories = debugHandlersFactory == null ? Collections.emptyList() : Collections.singletonList(debugHandlersFactory);
return DebugContext.create(options, description, outer.getGlobalMetrics(), DEFAULT_LOG_STREAM, factories);
}
use of org.graalvm.compiler.debug.DebugContext.Description in project graal by oracle.
the class GraalTruffleRuntime method maybeDumpTruffleTree.
@SuppressWarnings("try")
private static void maybeDumpTruffleTree(DebugContext inDebug, OptionValues options, OptimizedCallTarget callTarget, TruffleInlining inlining) {
DebugContext debug = inDebug;
if (debug == null) {
Description description = new Description(callTarget, "TruffleTree:" + callTarget.getName());
debug = DebugContext.create(options, description, NO_GLOBAL_METRIC_VALUES, DEFAULT_LOG_STREAM, singletonList(new TruffleTreeDebugHandlersFactory()));
}
GraphOutput<Void, ?> output = null;
try (Scope c = debug.scope("TruffleTree")) {
if (debug.isDumpEnabled(DebugContext.BASIC_LEVEL)) {
output = debug.buildOutput(GraphOutput.newBuilder(VoidGraphStructure.INSTANCE));
output.beginGroup(null, "Truffle::" + callTarget.toString(), "Truffle::" + callTarget.toString(), null, 0, DebugContext.addVersionProperties(null));
debug.dump(DebugContext.BASIC_LEVEL, new TruffleTreeDumpHandler.TruffleTreeDump(callTarget, inlining), "TruffleTree");
}
} catch (Throwable e) {
if (output != null) {
try {
output.endGroup();
output.close();
} catch (IOException ex) {
throw debug.handle(ex);
}
}
throw debug.handle(e);
}
}
Aggregations