Search in sources :

Example 16 with CompilationIdentifier

use of org.graalvm.compiler.core.common.CompilationIdentifier in project graal by oracle.

the class CFGPrinterObserver method checkMethodScope.

/**
 * Looks for the outer most method and its {@link DebugDumpScope#decorator}s in the current
 * debug scope and opens a new compilation scope if this pair does not match the current method
 * and decorator pair.
 */
private boolean checkMethodScope(DebugContext debug) {
    JavaMethod method = null;
    CompilationIdentifier compilation = null;
    ArrayList<String> decorators = new ArrayList<>();
    for (Object o : debug.context()) {
        if (o instanceof JavaMethod) {
            method = (JavaMethod) o;
            decorators.clear();
        } else if (o instanceof StructuredGraph) {
            StructuredGraph graph = (StructuredGraph) o;
            if (graph.method() != null) {
                method = graph.method();
                decorators.clear();
                compilation = graph.compilationId();
            }
        } else if (o instanceof DebugDumpScope) {
            DebugDumpScope debugDumpScope = (DebugDumpScope) o;
            if (debugDumpScope.decorator) {
                decorators.add(debugDumpScope.name);
            }
        } else if (o instanceof CompilationResult) {
            CompilationResult compilationResult = (CompilationResult) o;
            compilation = compilationResult.getCompilationId();
        }
    }
    if (method == null && compilation == null) {
        return false;
    }
    if (compilation != null) {
        if (!compilation.equals(curCompilation) || !curDecorators.equals(decorators)) {
            cfgPrinter.printCompilation(compilation);
        }
    } else {
        if (!method.equals(curMethod) || !curDecorators.equals(decorators)) {
            cfgPrinter.printCompilation(method);
        }
    }
    curCompilation = compilation;
    curMethod = method;
    curDecorators = decorators;
    return true;
}
Also used : CompilationIdentifier(org.graalvm.compiler.core.common.CompilationIdentifier) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) DebugDumpScope(org.graalvm.compiler.debug.DebugDumpScope) ArrayList(java.util.ArrayList) JavaMethod(jdk.vm.ci.meta.JavaMethod) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) CompilationResult(org.graalvm.compiler.code.CompilationResult)

Aggregations

CompilationIdentifier (org.graalvm.compiler.core.common.CompilationIdentifier)16 DebugContext (org.graalvm.compiler.debug.DebugContext)10 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)10 CompilationResult (org.graalvm.compiler.code.CompilationResult)7 OptionValues (org.graalvm.compiler.options.OptionValues)7 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)6 OptimizedCallTarget (org.graalvm.compiler.truffle.runtime.OptimizedCallTarget)4 DebugDumpScope (org.graalvm.compiler.debug.DebugDumpScope)3 InstalledCode (jdk.vm.ci.code.InstalledCode)2 Scope (org.graalvm.compiler.debug.DebugContext.Scope)2 GraalError (org.graalvm.compiler.debug.GraalError)2 LIRSuites (org.graalvm.compiler.lir.phases.LIRSuites)2 RemoveValueProxyPhase (org.graalvm.compiler.phases.common.RemoveValueProxyPhase)2 Suites (org.graalvm.compiler.phases.tiers.Suites)2 TruffleOptionsOverrideScope (org.graalvm.compiler.truffle.common.TruffleCompilerOptions.TruffleOptionsOverrideScope)2 RootNode (com.oracle.truffle.api.nodes.RootNode)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ArrayList (java.util.ArrayList)1 ServiceConfigurationError (java.util.ServiceConfigurationError)1 BailoutException (jdk.vm.ci.code.BailoutException)1