Skip to content

Commit 26060ed

Browse files
aamCommit Queue
authored andcommitted
[vm/shared] Ensure DRT_ResumeFrame can run without isolate.
TEST=shared_resume_test Change-Id: I06be289f538f11df3592b4e726c4a47ec4d8965d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/443360 Reviewed-by: Alexander Markov <[email protected]> Commit-Queue: Alexander Aprelev <[email protected]>
1 parent e3de7ee commit 26060ed

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
//
5+
// Verify that ResumeFrame runtime call entry doesn't crash without isolates.
6+
//
7+
// VMOptions=--experimental-shared-data
8+
//
9+
10+
import 'package:dart_internal/isolate_group.dart' show IsolateGroup;
11+
import 'package:expect/expect.dart';
12+
13+
Iterable<int> foo() sync* {
14+
yield 1;
15+
throw 42;
16+
}
17+
18+
Iterable<int> bar() sync* {
19+
yield* foo();
20+
}
21+
22+
@pragma("vm:shared")
23+
int caught = 0;
24+
25+
main() async {
26+
IsolateGroup.runSync(() {
27+
final iterator = bar().iterator;
28+
iterator.moveNext();
29+
try {
30+
iterator.moveNext();
31+
} on int catch (e) {
32+
caught = e;
33+
}
34+
});
35+
Expect.equals(42, caught);
36+
}

runtime/vm/runtime_entry.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4209,8 +4209,10 @@ DEFINE_RUNTIME_ENTRY(ResumeFrame, 2) {
42094209

42104210
#if !defined(DART_PRECOMPILED_RUNTIME)
42114211
#if !defined(PRODUCT)
4212-
if (isolate->has_resumption_breakpoints()) {
4213-
isolate->debugger()->ResumptionBreakpoint();
4212+
if (isolate != nullptr) {
4213+
if (isolate->has_resumption_breakpoints()) {
4214+
isolate->debugger()->ResumptionBreakpoint();
4215+
}
42144216
}
42154217
#endif
42164218

0 commit comments

Comments
 (0)