File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -1162,6 +1162,16 @@ EvalCtorOutcome evalCtor(EvallingModuleRunner& instance,
1162
1162
results = flow.values ;
1163
1163
1164
1164
if (flow.breaking ()) {
1165
+ if (flow.suspendTag ) {
1166
+ // A suspend reached the exit of the function, so it is unhandled in
1167
+ // it. TODO: We could support the case of the calling function
1168
+ // handling it.
1169
+ if (!quiet) {
1170
+ std::cout << " ...stopping due to unhandled suspend\n " ;
1171
+ }
1172
+ return EvalCtorOutcome ();
1173
+ }
1174
+
1165
1175
// We are returning out of the function (either via a return, or via a
1166
1176
// break to |block|, which has the same outcome. That means we don't
1167
1177
// need to execute any more lines, and can consider them to be
Original file line number Diff line number Diff line change 1
1
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
2
- ;; RUN: foreach %s %t wasm-ctor-eval --ctors=test --kept-exports=test --quiet -all -S -o - | filecheck %s
2
+ ;; RUN: foreach %s %t wasm-ctor-eval --ctors=test,test2 --kept-exports=test,test2 --quiet -all -S -o - | filecheck %s
3
3
4
4
;; Test that we can precompute continuations.
5
5
6
6
(module
7
+ ;; CHECK: (type $f (func))
7
8
(type $f (func ))
8
9
(type $k (cont $f ))
9
10
11
+ ;; CHECK: (type $1 (func (result i32)))
12
+
13
+ ;; CHECK: (tag $more (type $f))
10
14
(tag $more )
11
15
12
16
(global $g (mut i32 ) (i32.const 0 ))
45
49
)
46
50
(global.get $g )
47
51
)
48
- )
49
- ;; CHECK: (type $0 (func (result i32)))
50
52
51
- ;; CHECK: (export "test" (func $test_3))
53
+ ;; CHECK: (export "test" (func $test_4))
54
+
55
+ ;; CHECK: (export "test2" (func $test2))
52
56
53
- ;; CHECK: (func $test_3 (type $0) (result i32)
57
+ ;; CHECK: (func $test2 (type $f)
58
+ ;; CHECK-NEXT: (suspend $more)
59
+ ;; CHECK-NEXT: )
60
+ (func $test2 (export " test2" )
61
+ ;; This unhandled suspend will trap, and should not be precomputed.
62
+ (suspend $more )
63
+ )
64
+ )
65
+ ;; CHECK: (func $test_4 (type $1) (result i32)
54
66
;; CHECK-NEXT: (i32.const 3)
55
67
;; CHECK-NEXT: )
You can’t perform that action at this time.
0 commit comments