Search in sources :

Example 6 with NeverInline

use of com.oracle.svm.core.annotate.NeverInline 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)

Example 7 with NeverInline

use of com.oracle.svm.core.annotate.NeverInline in project graal by oracle.

the class SubstrateUtil method dumpVMThreads.

@NeverInline("catch implicit exceptions")
private static void dumpVMThreads(Log log) {
    log.string("VMThreads info:").newline();
    log.indent(true);
    for (IsolateThread vmThread = VMThreads.firstThread(); vmThread != VMThreads.nullThread(); vmThread = VMThreads.nextThread(vmThread)) {
        log.string("VMThread ").zhex(vmThread.rawValue()).spaces(2).string(VMThreads.StatusSupport.getStatusString(vmThread)).newline();
    }
    log.indent(false);
}
Also used : IsolateThread(org.graalvm.nativeimage.IsolateThread) NeverInline(com.oracle.svm.core.annotate.NeverInline)

Example 8 with NeverInline

use of com.oracle.svm.core.annotate.NeverInline in project graal by oracle.

the class Deoptimizer method rewriteStackAndJumpToTarget.

/**
 * Performs the actual stack rewriting. When this method is called the sp is already at the
 * bottom of the deopt target method.
 *
 * @param newSp Points to the bottom of the deopt target method (but above the return address
 *            slot).
 * @param frame The deopt frame handle.
 * @return The epilog of this method restores the return value registers from the returned frame
 *         handle. The instructions for restoring the return value registers must be generated
 *         in this method's epilog by a backend-specific FrameContext class.
 */
@DeoptStub(stubType = StubType.ExitStub)
@NeverInline("don't provoke the writeStackPointer devil with a non-trivial method")
@Uninterruptible(reason = "Frame holds Objects in unmanaged storage.")
private static DeoptimizedFrame rewriteStackAndJumpToTarget(Pointer newSp, DeoptimizedFrame frame) {
    /*
         * The first word of the new stack content is already the return address into the caller of
         * deoptimizeInRange(). So when this method returns we are inside the caller of
         * deoptimizeInRange().
         */
    Pointer bottomSp = newSp.subtract(FrameAccess.returnAddressSize());
    frame.getTargetContent().copyToPointer(bottomSp);
    if (DeoptimizationCounters.Options.ProfileDeoptimization.getValue()) {
        DeoptimizationCounters.counters().timeSpentInDeopt.add(System.nanoTime() - DeoptimizationCounters.startTime.get());
    }
    return frame;
}
Also used : CodePointer(org.graalvm.nativeimage.c.function.CodePointer) Pointer(org.graalvm.word.Pointer) Uninterruptible(com.oracle.svm.core.annotate.Uninterruptible) NeverInline(com.oracle.svm.core.annotate.NeverInline)

Example 9 with NeverInline

use of com.oracle.svm.core.annotate.NeverInline in project graal by oracle.

the class DeoptTester method deoptTest.

/**
 * Scans the stack frames and if there are some new (= so far not seen) PCs inside deoptimizable
 * methods, a deopt is done.
 *
 * Foreign call: {@link SnippetRuntime#DEOPTTEST}.
 */
@NeverInline("deoptTest must have a separate stack frame")
@SubstrateForeignCallTarget
public static void deoptTest() {
    if (inDeoptTest > 0) {
        return;
    }
    inDeoptTest++;
    try {
        if (Heap.getHeap().isAllocationDisallowed()) {
            return;
        }
        if (VMOperationControl.TestingBackdoor.isLocked()) {
            return;
        }
        if (VMOperation.isInProgress()) {
            return;
        }
        Pointer startSp = KnownIntrinsics.readCallerStackPointer();
        CodePointer startIp = KnownIntrinsics.readReturnAddress();
        int numHandledPCs = handledPCs.size();
        JavaStackWalker.walkCurrentThread(startSp, startIp, collectPcVisitor);
        if (handledPCs.size() > numHandledPCs) {
            Deoptimizer.deoptimizeAll();
        }
    } finally {
        inDeoptTest--;
    }
}
Also used : CodePointer(org.graalvm.nativeimage.c.function.CodePointer) Pointer(org.graalvm.word.Pointer) CodePointer(org.graalvm.nativeimage.c.function.CodePointer) SubstrateForeignCallTarget(com.oracle.svm.core.snippets.SubstrateForeignCallTarget) NeverInline(com.oracle.svm.core.annotate.NeverInline)

Aggregations

NeverInline (com.oracle.svm.core.annotate.NeverInline)9 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)5 Pointer (org.graalvm.word.Pointer)5 Substitute (com.oracle.svm.core.annotate.Substitute)2 JavaFrameAnchor (com.oracle.svm.core.stack.JavaFrameAnchor)2 IsolateThread (org.graalvm.nativeimage.IsolateThread)2 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)1 DeoptimizedFrame (com.oracle.svm.core.deopt.DeoptimizedFrame)1 StackTraceBuilder (com.oracle.svm.core.jdk.StackTraceBuilder)1 SubstrateForeignCallTarget (com.oracle.svm.core.snippets.SubstrateForeignCallTarget)1 StackIntrospection (jdk.vm.ci.code.stack.StackIntrospection)1 CCharPointer (org.graalvm.nativeimage.c.type.CCharPointer)1 CCharPointerPointer (org.graalvm.nativeimage.c.type.CCharPointerPointer)1