Search in sources :

Example 11 with SubstrateForeignCallTarget

use of com.oracle.svm.core.snippets.SubstrateForeignCallTarget 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

SubstrateForeignCallTarget (com.oracle.svm.core.snippets.SubstrateForeignCallTarget)11 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)5 Safepoint (com.oracle.svm.core.thread.Safepoint)4 FastThreadLocalObject (com.oracle.svm.core.threadlocal.FastThreadLocalObject)2 IsolateThread (org.graalvm.nativeimage.IsolateThread)2 UnsignedWord (org.graalvm.word.UnsignedWord)2 NeverInline (com.oracle.svm.core.annotate.NeverInline)1 RestrictHeapAccess (com.oracle.svm.core.annotate.RestrictHeapAccess)1 DynamicHub (com.oracle.svm.core.hub.DynamicHub)1 FILE (com.oracle.svm.core.posix.headers.Stdio.FILE)1 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)1 WordPointer (org.graalvm.nativeimage.c.type.WordPointer)1 Pointer (org.graalvm.word.Pointer)1