Skip to content

Commit 1071e3e

Browse files
aamCommit Queue
authored and
Commit Queue
committed
[vm/isolate] Avoid isolate scan when exiting known isolate.
IsolateFibonacci before 3291867, after 3061103 Fixes #50789 TEST=benchmark/IsolateFibonacci Change-Id: I667838c4ae089b9ac8889ae3eb3d773115437397 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276760 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
1 parent 27b4e28 commit 1071e3e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

runtime/lib/isolate.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,14 @@ DEFINE_NATIVE_ENTRY(Isolate_exit_, 0, 2) {
351351
handle->set_ptr(msg_array);
352352
isolate->bequeath(std::unique_ptr<Bequest>(new Bequest(handle, port.Id())));
353353
}
354-
Isolate::KillIfExists(isolate, Isolate::LibMsgId::kKillMsg);
355-
// Drain interrupts before running so any IMMEDIATE operations on the current
356-
// isolate happen synchronously.
357-
const Error& error = Error::Handle(thread->HandleInterrupts());
358-
RELEASE_ASSERT(error.IsUnwindError());
354+
355+
Thread::Current()->StartUnwindError();
356+
const String& msg =
357+
String::Handle(String::New("isolate terminated by Isolate.exit"));
358+
const UnwindError& error = UnwindError::Handle(UnwindError::New(msg));
359+
error.set_is_user_initiated(true);
359360
Exceptions::PropagateError(error);
361+
UNREACHABLE();
360362
// We will never execute dart code again in this isolate.
361363
return Object::null();
362364
}

runtime/vm/dart_api_impl_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ void Func1() {
775775

776776
result = Dart_Invoke(lib, NewString("Func1"), 0, NULL);
777777
EXPECT(Dart_IsError(result));
778-
EXPECT_SUBSTRING("isolate terminated by Isolate.kill", Dart_GetError(result));
778+
EXPECT_SUBSTRING("isolate terminated by Isolate.exit", Dart_GetError(result));
779779

780780
result = Dart_Invoke(lib, NewString("Func1"), 0, NULL);
781781
EXPECT(Dart_IsError(result));

0 commit comments

Comments
 (0)