Search in sources :

Example 6 with Bytecode

use of org.graalvm.compiler.bytecode.Bytecode in project graal by oracle.

the class GraphUtil method approxSourceStackTraceElement.

/**
 * Gets an approximate source code location for frame state.
 *
 * @return the StackTraceElements if an approximate source location is found, null otherwise
 */
public static StackTraceElement[] approxSourceStackTraceElement(FrameState frameState) {
    ArrayList<StackTraceElement> elements = new ArrayList<>();
    FrameState state = frameState;
    while (state != null) {
        Bytecode code = state.getCode();
        if (code != null) {
            elements.add(code.asStackTraceElement(state.bci - 1));
        }
        state = state.outerFrameState();
    }
    return elements.toArray(new StackTraceElement[0]);
}
Also used : ArrayList(java.util.ArrayList) Bytecode(org.graalvm.compiler.bytecode.Bytecode) FrameState(org.graalvm.compiler.nodes.FrameState)

Example 7 with Bytecode

use of org.graalvm.compiler.bytecode.Bytecode in project graal by oracle.

the class ClassfileBytecodeProviderTest method checkMethod.

private static void checkMethod(ClassfileBytecodeProvider cbp, MetaAccessProvider metaAccess, Executable executable) {
    ResolvedJavaMethod method = metaAccess.lookupJavaMethod(executable);
    if (method.hasBytecodes()) {
        ResolvedJavaMethodBytecode expected = new ResolvedJavaMethodBytecode(method);
        Bytecode actual = getBytecode(cbp, method);
        new BytecodeComparer(expected, actual).compare();
    }
}
Also used : ResolvedJavaMethodBytecode(org.graalvm.compiler.bytecode.ResolvedJavaMethodBytecode) Bytecode(org.graalvm.compiler.bytecode.Bytecode) ClassfileBytecode(org.graalvm.compiler.replacements.classfile.ClassfileBytecode) ResolvedJavaMethodBytecode(org.graalvm.compiler.bytecode.ResolvedJavaMethodBytecode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

Bytecode (org.graalvm.compiler.bytecode.Bytecode)7 ResolvedJavaMethodBytecode (org.graalvm.compiler.bytecode.ResolvedJavaMethodBytecode)5 DebugContext (org.graalvm.compiler.debug.DebugContext)4 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)4 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)3 GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)3 InvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin)3 OptionValues (org.graalvm.compiler.options.OptionValues)3 SubstrateIntrinsicGraphBuilder (com.oracle.graal.pointsto.phases.SubstrateIntrinsicGraphBuilder)2 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)2 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)2 HostedProviders (com.oracle.graal.pointsto.meta.HostedProviders)1 DeadStoreRemovalPhase (com.oracle.svm.core.graal.phases.DeadStoreRemovalPhase)1 HostedOptionValues (com.oracle.svm.core.option.HostedOptionValues)1 HostedMethod (com.oracle.svm.hosted.meta.HostedMethod)1 DevirtualizeCallsPhase (com.oracle.svm.hosted.phases.DevirtualizeCallsPhase)1 HostedGraphBuilderPhase (com.oracle.svm.hosted.phases.HostedGraphBuilderPhase)1 StrengthenStampsPhase (com.oracle.svm.hosted.phases.StrengthenStampsPhase)1 ArrayList (java.util.ArrayList)1 ConstantReflectionProvider (jdk.vm.ci.meta.ConstantReflectionProvider)1