Search in sources :

Example 1 with StackFrameVisitor

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

the class Deoptimizer method deoptimizeInRangeOperation.

/**
 * Deoptimize a specific method on all thread stacks.
 */
private static void deoptimizeInRangeOperation(CodePointer fromIp, CodePointer toIp, boolean deoptAll) {
    VMOperation.guaranteeInProgress("Deoptimizer.deoptimizeInRangeOperation, but not in VMOperation.");
    /* Handle my own thread specially, because I do not have a JavaFrameAnchor. */
    StackFrameVisitor currentThreadDeoptVisitor = getStackFrameVisitor((Pointer) fromIp, (Pointer) toIp, deoptAll, CEntryPointContext.getCurrentIsolateThread());
    Pointer sp = KnownIntrinsics.readCallerStackPointer();
    CodePointer ip = KnownIntrinsics.readReturnAddress();
    JavaStackWalker.walkCurrentThread(sp, ip, currentThreadDeoptVisitor);
    /* If I am multi-threaded, deoptimize this method on all the other stacks. */
    if (SubstrateOptions.MultiThreaded.getValue()) {
        for (IsolateThread vmThread = VMThreads.firstThread(); VMThreads.isNonNullThread(vmThread); vmThread = VMThreads.nextThread(vmThread)) {
            if (vmThread == CEntryPointContext.getCurrentIsolateThread()) {
                continue;
            }
            StackFrameVisitor deoptVisitor = getStackFrameVisitor((Pointer) fromIp, (Pointer) toIp, deoptAll, vmThread);
            JavaStackWalker.walkThread(vmThread, deoptVisitor);
        }
    }
    if (testGCinDeoptimizer) {
        Heap.getHeap().getGC().collect("from Deoptimizer.deoptimizeInRange because of testGCinDeoptimizer");
    }
}
Also used : StackFrameVisitor(com.oracle.svm.core.stack.StackFrameVisitor) IsolateThread(org.graalvm.nativeimage.IsolateThread) CodePointer(org.graalvm.nativeimage.c.function.CodePointer) Pointer(org.graalvm.word.Pointer) CodePointer(org.graalvm.nativeimage.c.function.CodePointer)

Aggregations

StackFrameVisitor (com.oracle.svm.core.stack.StackFrameVisitor)1 IsolateThread (org.graalvm.nativeimage.IsolateThread)1 CodePointer (org.graalvm.nativeimage.c.function.CodePointer)1 Pointer (org.graalvm.word.Pointer)1