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--;
}
}
Aggregations