Search in sources :

Example 1 with StackIntrospection

use of jdk.vm.ci.code.stack.StackIntrospection in project graal by oracle.

the class SubstrateInspectedFrame method iterateFrames.

@NeverInline("Stack walking starts at the physical caller frame of this method")
@Override
public <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor) {
    if (SubstrateUtil.HOSTED) {
        /*
             * During native-image generation we use HotSpotStackIntrospection to iterate frames.
             * `initialMethods` and `matchingMethods` are hosted versions of `ResolvedJavaMethod`
             * that we provide them in `SubstrateTruffleRuntime`.
             */
        StackIntrospection hostedStackIntrospection = JVMCI.getRuntime().getHostJVMCIBackend().getStackIntrospection();
        return hostedStackIntrospection.iterateFrames(initialMethods, matchingMethods, initialSkip, visitor);
    }
    /* Stack walking starts at the physical caller frame of this method. */
    Pointer startSP = KnownIntrinsics.readCallerStackPointer();
    CodePointer startIP = KnownIntrinsics.readReturnAddress();
    PhysicalStackFrameVisitor<T> physicalFrameVisitor = new PhysicalStackFrameVisitor<>(initialMethods, matchingMethods, initialSkip, visitor);
    JavaStackWalker.walkCurrentThread(startSP, startIP, physicalFrameVisitor);
    return physicalFrameVisitor.result;
}
Also used : CodePointer(org.graalvm.nativeimage.c.function.CodePointer) Pointer(org.graalvm.word.Pointer) CodePointer(org.graalvm.nativeimage.c.function.CodePointer) StackIntrospection(jdk.vm.ci.code.stack.StackIntrospection) NeverInline(com.oracle.svm.core.annotate.NeverInline)

Aggregations

NeverInline (com.oracle.svm.core.annotate.NeverInline)1 StackIntrospection (jdk.vm.ci.code.stack.StackIntrospection)1 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)1 Pointer (org.graalvm.word.Pointer)1