Search in sources :

Example 1 with JavaFrameAnchor

use of com.oracle.svm.core.stack.JavaFrameAnchor in project graal by oracle.

the class CFunctionSnippets method prologueSnippet.

@Snippet
private static void prologueSnippet() {
    // Push a Java frame anchor.
    JavaFrameAnchor anchor = (JavaFrameAnchor) StackValueNode.stackValue(1, SizeOf.get(JavaFrameAnchor.class), frameAnchorIdentity);
    anchor.setLastJavaSP(KnownIntrinsics.readStackPointer());
    JavaFrameAnchors.pushFrameAnchor(anchor);
    if (SubstrateOptions.MultiThreaded.getValue()) {
        // Change the VMThread status from Java to native.
        VMThreads.StatusSupport.setStatusNative();
    }
}
Also used : JavaFrameAnchor(com.oracle.svm.core.stack.JavaFrameAnchor) Snippet(org.graalvm.compiler.api.replacements.Snippet)

Example 2 with JavaFrameAnchor

use of com.oracle.svm.core.stack.JavaFrameAnchor in project graal by oracle.

the class SubstrateUtil method dumpJavaFrameAnchors.

@NeverInline("catch implicit exceptions")
private static void dumpJavaFrameAnchors(Log log) {
    log.string("JavaFrameAnchor dump:").newline();
    log.indent(true);
    JavaFrameAnchor anchor = JavaFrameAnchors.getFrameAnchor();
    if (anchor.isNull()) {
        log.string("No anchors").newline();
    }
    while (anchor.isNonNull()) {
        log.string("Anchor ").zhex(anchor.rawValue()).string(" LastJavaSP ").zhex(anchor.getLastJavaSP().rawValue()).newline();
        anchor = anchor.getPreviousAnchor();
    }
    log.indent(false);
}
Also used : JavaFrameAnchor(com.oracle.svm.core.stack.JavaFrameAnchor) NeverInline(com.oracle.svm.core.annotate.NeverInline)

Example 3 with JavaFrameAnchor

use of com.oracle.svm.core.stack.JavaFrameAnchor in project graal by oracle.

the class SubstrateUtil method dumpTopFrame.

@NeverInline("catch implicit exceptions")
private static void dumpTopFrame(Log log, Pointer sp, CodePointer ip) {
    log.string("TopFrame info:").newline();
    log.indent(true);
    if (sp.isNonNull() && ip.isNonNull()) {
        long totalFrameSize;
        DeoptimizedFrame deoptFrame = Deoptimizer.checkDeoptimized(sp);
        if (deoptFrame != null) {
            log.string("RSP ").zhex(sp.rawValue()).string(" frame was deoptimized:").newline();
            log.string("SourcePC ").zhex(deoptFrame.getSourcePC().rawValue()).newline();
            totalFrameSize = deoptFrame.getSourceTotalFrameSize();
        } else {
            log.string("Lookup TotalFrameSize in CodeInfoTable:").newline();
            totalFrameSize = CodeInfoTable.lookupTotalFrameSize(ip);
        }
        log.string("SourceTotalFrameSize ").signed(totalFrameSize).newline();
        if (totalFrameSize == -1) {
            log.string("Does not look like a Java Frame. Use JavaFrameAnchors to find LastJavaSP:").newline();
            JavaFrameAnchor anchor = JavaFrameAnchors.getFrameAnchor();
            while (anchor.isNonNull() && anchor.getLastJavaSP().belowOrEqual(sp)) {
                anchor = anchor.getPreviousAnchor();
            }
            if (anchor.isNonNull()) {
                log.string("Found matching Anchor:").zhex(anchor.rawValue()).newline();
                Pointer lastSp = anchor.getLastJavaSP();
                log.string("LastJavaSP ").zhex(lastSp.rawValue()).newline();
                CodePointer lastIp = FrameAccess.readReturnAddress(lastSp);
                log.string("LastJavaIP ").zhex(lastIp.rawValue()).newline();
            }
        }
    }
    log.indent(false);
}
Also used : JavaFrameAnchor(com.oracle.svm.core.stack.JavaFrameAnchor) CodePointer(org.graalvm.nativeimage.c.function.CodePointer) Pointer(org.graalvm.word.Pointer) CCharPointerPointer(org.graalvm.nativeimage.c.type.CCharPointerPointer) CCharPointer(org.graalvm.nativeimage.c.type.CCharPointer) CodePointer(org.graalvm.nativeimage.c.function.CodePointer) DeoptimizedFrame(com.oracle.svm.core.deopt.DeoptimizedFrame) NeverInline(com.oracle.svm.core.annotate.NeverInline)

Aggregations

JavaFrameAnchor (com.oracle.svm.core.stack.JavaFrameAnchor)3 NeverInline (com.oracle.svm.core.annotate.NeverInline)2 DeoptimizedFrame (com.oracle.svm.core.deopt.DeoptimizedFrame)1 Snippet (org.graalvm.compiler.api.replacements.Snippet)1 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)1 CCharPointer (org.graalvm.nativeimage.c.type.CCharPointer)1 CCharPointerPointer (org.graalvm.nativeimage.c.type.CCharPointerPointer)1 Pointer (org.graalvm.word.Pointer)1