Search in sources :

Example 1 with Description

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);
}
Also used : TargetDescription(jdk.vm.ci.code.TargetDescription) Description(org.graalvm.compiler.debug.DebugContext.Description) DebugHandlersFactory(org.graalvm.compiler.debug.DebugHandlersFactory) DebugContext(org.graalvm.compiler.debug.DebugContext)

Example 2 with Description

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);
    }
}
Also used : Description(org.graalvm.compiler.debug.DebugContext.Description) TruffleOptionsOverrideScope(org.graalvm.compiler.truffle.common.TruffleCompilerOptions.TruffleOptionsOverrideScope) Scope(org.graalvm.compiler.debug.DebugContext.Scope) DebugContext(org.graalvm.compiler.debug.DebugContext) IOException(java.io.IOException)

Aggregations

DebugContext (org.graalvm.compiler.debug.DebugContext)2 Description (org.graalvm.compiler.debug.DebugContext.Description)2 IOException (java.io.IOException)1 TargetDescription (jdk.vm.ci.code.TargetDescription)1 Scope (org.graalvm.compiler.debug.DebugContext.Scope)1 DebugHandlersFactory (org.graalvm.compiler.debug.DebugHandlersFactory)1 TruffleOptionsOverrideScope (org.graalvm.compiler.truffle.common.TruffleCompilerOptions.TruffleOptionsOverrideScope)1