|
65 | 65 | import com.oracle.svm.core.nodes.SafepointCheckNode;
|
66 | 66 | import com.oracle.svm.core.option.HostedOptionKey;
|
67 | 67 | import com.oracle.svm.core.option.RuntimeOptionKey;
|
| 68 | +import com.oracle.svm.core.snippets.KnownIntrinsics; |
68 | 69 | import com.oracle.svm.core.snippets.SnippetRuntime;
|
69 | 70 | import com.oracle.svm.core.snippets.SnippetRuntime.SubstrateForeignCallDescriptor;
|
70 | 71 | import com.oracle.svm.core.snippets.SubstrateForeignCallTarget;
|
71 | 72 | import com.oracle.svm.core.stack.JavaFrameAnchors;
|
| 73 | +import com.oracle.svm.core.thread.VMThreads.ActionOnExitSafepointSupport; |
72 | 74 | import com.oracle.svm.core.thread.VMThreads.ActionOnTransitionToJavaSupport;
|
73 | 75 | import com.oracle.svm.core.thread.VMThreads.SafepointBehavior;
|
74 | 76 | import com.oracle.svm.core.thread.VMThreads.StatusSupport;
|
@@ -196,6 +198,7 @@ private static void slowPathSafepointCheck(int newStatus, boolean callerHasJavaF
|
196 | 198 | */
|
197 | 199 | VMError.shouldNotReachHere(ex);
|
198 | 200 | }
|
| 201 | + exitSlowPathCheck(); |
199 | 202 | }
|
200 | 203 |
|
201 | 204 | /**
|
@@ -422,6 +425,18 @@ public static void slowPathSafepointCheck() throws Throwable {
|
422 | 425 | slowPathSafepointCheck(StatusSupport.STATUS_IN_JAVA, false, false);
|
423 | 426 | }
|
424 | 427 |
|
| 428 | + @Uninterruptible(reason = "Must not contain safepoint checks") |
| 429 | + private static void exitSlowPathCheck() { |
| 430 | + if (ActionOnExitSafepointSupport.isActionPending()) { |
| 431 | + if (LoomSupport.isEnabled() && ActionOnExitSafepointSupport.isSwitchStackPending()) { |
| 432 | + ActionOnExitSafepointSupport.clearActions(); |
| 433 | + KnownIntrinsics.farReturn(0, ActionOnExitSafepointSupport.getSwitchStackSP(), ActionOnExitSafepointSupport.getSwitchStackIP(), false); |
| 434 | + } else { |
| 435 | + assert false : "Unexpected action pending."; |
| 436 | + } |
| 437 | + } |
| 438 | + } |
| 439 | + |
425 | 440 | /**
|
426 | 441 | * Transition from native to Java, checking for safepoint.
|
427 | 442 | *
|
|
0 commit comments