Skip to content

Commit 88c9f0a

Browse files
committed
example of non-local control flow with call
1 parent a56ddc1 commit 88c9f0a

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(module
2+
(type (;0;) (func (param i32)))
3+
(type (;1;) (func))
4+
(import "console" "log" (func (;0;) (type 0)))
5+
(func (;1;) (type 1)
6+
(local i32)
7+
try
8+
i32.const 1
9+
call 0
10+
call 2
11+
i32.const 3
12+
call 0
13+
catch
14+
;; [42, resume]
15+
i32.const 2
16+
call 0
17+
drop
18+
resume0
19+
i32.const 4
20+
call 0
21+
end
22+
i32.const 5
23+
call 0
24+
)
25+
(func (;2;) (type 1)
26+
i32.const 42
27+
throw
28+
i32.const 3
29+
call 0
30+
)
31+
(start 1))

src/test/scala/TestTFP.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ class TestTFP extends AnyFunSuite {
161161
testFileOutput("./benchmarks/wasm/trycatch/try_catch_catch_br.wat", List(1, 2, 6, 4, 6, 5))
162162
}
163163

164+
test("try-catch-call") {
165+
testFileOutput("./benchmarks/wasm/trycatch/try_catch_call.wat", List(1, 2, 3, 3, 4, 5))
166+
}
167+
164168
// SpecTest
165169
test("spectest_return_call") {
166170
testWastFile("./benchmarks/wasm/spectest/return_call.bin.wast")

0 commit comments

Comments
 (0)