[vm] If waiting for an active mutator slot for too long, steal a slot from a thread at a native safepoint.

The thread whose slot was stolen will take the slow path attempting to exit its safepoint and wait to reacquire an active mutator slot.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54687
Change-Id: I49c4c12b38d38d7afa4df6b346c2a464f75ef6e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406404
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
Ryan Macnak
2025-02-10 09:38:42 -08:00
committed by Commit Queue
parent a78235cf01
commit 2a08770912
23 changed files with 254 additions and 97 deletions
+2 -2
View File
@@ -1422,7 +1422,7 @@ DART_EXPORT void Dart_ShutdownIsolate() {
// scope objects as the original transition happened outside this scope in
// Dart_EnterIsolate/Dart_CreateIsolateGroup.
ASSERT(T->execution_state() == Thread::kThreadInNative);
T->ExitSafepoint();
T->ExitSafepointFromNative();
T->set_execution_state(Thread::kThreadInVM);
I->WaitForOutstandingSpawns();
@@ -1861,7 +1861,7 @@ DART_EXPORT void Dart_ExitIsolate() {
// scope objects as the original transition happened outside this scope in
// Dart_EnterIsolate/Dart_CreateIsolateGroup.
ASSERT(T->execution_state() == Thread::kThreadInNative);
T->ExitSafepoint();
T->ExitSafepointFromNative();
T->set_execution_state(Thread::kThreadInVM);
Thread::ExitIsolate();
}