summaryrefslogtreecommitdiff
path: root/test/lit/basic/exception-handling.wast
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2023-12-19 11:10:27 -0800
committerGitHub <noreply@github.com>2023-12-19 11:10:27 -0800
commit4c53361b205ad30acc05136388b789296a4180f7 (patch)
treea5802be899e365b733efacba4364027b0af9c2e0 /test/lit/basic/exception-handling.wast
parentcad983c975a05bc262437a6d7ed3a61020ef4e8d (diff)
downloadbinaryen-4c53361b205ad30acc05136388b789296a4180f7.tar.gz
binaryen-4c53361b205ad30acc05136388b789296a4180f7.tar.bz2
binaryen-4c53361b205ad30acc05136388b789296a4180f7.zip
[EH] Add instructions for new proposal (#6181)
This adds basic support for the new instructions in the new EH proposal passed at the Oct CG hybrid CG meeting: https://github.com/WebAssembly/meetings/blob/main/main/2023/CG-10.md https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md This mainly adds two instructions: `try_table` and `throw_ref`. This is the bare minimum required to read and write text and binary format, and does not include analyses or optimizations. (It includes some analysis required for validation of existing instructions.) Validation for the new instructions is not yet included. `try_table` faces the same problem with the `resume` instruction in #6083 that without the module-level tag info, we are unable to know the 'sent types' of `try_table`. This solves it with a similar approach taken in #6083: this adds `Module*` parameter to `finalize` methods, which defaults to `nullptr` when not given. The `Module*` parameter is given when called from the binary and text parser, and we cache those tag types in `sentTypes` array within `TryTable` class. In later optimization passes, as long as they don't touch tags, it is fine to call `finalize` without the `Module*`. Refer to https://github.com/WebAssembly/binaryen/pull/6083#issuecomment-1854634679 and #6096 for related discussions when `resume` was added.
Diffstat (limited to 'test/lit/basic/exception-handling.wast')
-rw-r--r--test/lit/basic/exception-handling.wast651
1 files changed, 644 insertions, 7 deletions
diff --git a/test/lit/basic/exception-handling.wast b/test/lit/basic/exception-handling.wast
index 945cca1af..a06e377e6 100644
--- a/test/lit/basic/exception-handling.wast
+++ b/test/lit/basic/exception-handling.wast
@@ -10,9 +10,71 @@
;; RUN: cat %t.bin.nodebug.wast | filecheck %s --check-prefix=CHECK-BIN-NODEBUG
(module
- ;; CHECK-TEXT: (type $0 (func (result exnref)))
+ ;; CHECK-TEXT: (type $0 (func))
- ;; CHECK-TEXT: (func $exnref-nullexnref-test (type $0) (result exnref)
+ ;; CHECK-TEXT: (type $1 (func (result exnref)))
+
+ ;; CHECK-TEXT: (type $2 (func (result i32)))
+
+ ;; CHECK-TEXT: (type $3 (func (result i32 i64)))
+
+ ;; CHECK-TEXT: (type $4 (func (result i32 i64 exnref)))
+
+ ;; CHECK-TEXT: (type $5 (func (result i32 exnref)))
+
+ ;; CHECK-TEXT: (type $6 (func (param i32)))
+
+ ;; CHECK-TEXT: (type $7 (func (param i64)))
+
+ ;; CHECK-TEXT: (type $8 (func (param i32 i64)))
+
+ ;; CHECK-TEXT: (type $9 (func (param eqref)))
+
+ ;; CHECK-TEXT: (tag $e-i32 (param i32))
+ ;; CHECK-BIN: (type $0 (func))
+
+ ;; CHECK-BIN: (type $1 (func (result exnref)))
+
+ ;; CHECK-BIN: (type $2 (func (result i32)))
+
+ ;; CHECK-BIN: (type $3 (func (result i32 i64)))
+
+ ;; CHECK-BIN: (type $4 (func (result i32 i64 exnref)))
+
+ ;; CHECK-BIN: (type $5 (func (result i32 exnref)))
+
+ ;; CHECK-BIN: (type $6 (func (param i32)))
+
+ ;; CHECK-BIN: (type $7 (func (param i64)))
+
+ ;; CHECK-BIN: (type $8 (func (param i32 i64)))
+
+ ;; CHECK-BIN: (type $9 (func (param eqref)))
+
+ ;; CHECK-BIN: (tag $e-i32 (param i32))
+ (tag $e-i32 (param i32))
+ ;; CHECK-TEXT: (tag $e-i64 (param i64))
+ ;; CHECK-BIN: (tag $e-i64 (param i64))
+ (tag $e-i64 (param i64))
+ ;; CHECK-TEXT: (tag $e-i32-i64 (param i32 i64))
+ ;; CHECK-BIN: (tag $e-i32-i64 (param i32 i64))
+ (tag $e-i32-i64 (param i32 i64))
+ ;; CHECK-TEXT: (tag $e-eqref (param eqref))
+ ;; CHECK-BIN: (tag $e-eqref (param eqref))
+ (tag $e-eqref (param (ref null eq)))
+ ;; CHECK-TEXT: (tag $e-empty)
+ ;; CHECK-BIN: (tag $e-empty)
+ (tag $e-empty)
+
+ ;; CHECK-TEXT: (func $foo (type $0)
+ ;; CHECK-TEXT-NEXT: (nop)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $foo (type $0)
+ ;; CHECK-BIN-NEXT: (nop)
+ ;; CHECK-BIN-NEXT: )
+ (func $foo)
+
+ ;; CHECK-TEXT: (func $exnref-nullexnref-test (type $1) (result exnref)
;; CHECK-TEXT-NEXT: (local $exn exnref)
;; CHECK-TEXT-NEXT: (local $null-exn nullexnref)
;; CHECK-TEXT-NEXT: (if (result exnref)
@@ -25,9 +87,7 @@
;; CHECK-TEXT-NEXT: (local.get $exn)
;; CHECK-TEXT-NEXT: )
;; CHECK-TEXT-NEXT: )
- ;; CHECK-BIN: (type $0 (func (result exnref)))
-
- ;; CHECK-BIN: (func $exnref-nullexnref-test (type $0) (result exnref)
+ ;; CHECK-BIN: (func $exnref-nullexnref-test (type $1) (result exnref)
;; CHECK-BIN-NEXT: (local $exn exnref)
;; CHECK-BIN-NEXT: (local $null-exn nullexnref)
;; CHECK-BIN-NEXT: (if (result exnref)
@@ -51,10 +111,413 @@
(local.get $exn)
)
)
+
+ ;; CHECK-TEXT: (func $catchless-try-table (type $0)
+ ;; CHECK-TEXT-NEXT: (try_table
+ ;; CHECK-TEXT-NEXT: (nop)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: (try_table
+ ;; CHECK-TEXT-NEXT: (throw $e-empty)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $catchless-try-table (type $0)
+ ;; CHECK-BIN-NEXT: (try_table
+ ;; CHECK-BIN-NEXT: (nop)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (try_table
+ ;; CHECK-BIN-NEXT: (throw $e-empty)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $catchless-try-table
+ (try_table)
+ (try_table
+ (throw $e-empty)
+ )
+ )
+
+ ;; CHECK-TEXT: (func $simple-try-table-and-throw (type $2) (result i32)
+ ;; CHECK-TEXT-NEXT: (block $l-catch (result i32)
+ ;; CHECK-TEXT-NEXT: (try_table (catch $e-i32 $l-catch)
+ ;; CHECK-TEXT-NEXT: (throw $e-i32
+ ;; CHECK-TEXT-NEXT: (i32.const 0)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $simple-try-table-and-throw (type $2) (result i32)
+ ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $label$1)
+ ;; CHECK-BIN-NEXT: (throw $e-i32
+ ;; CHECK-BIN-NEXT: (i32.const 0)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $simple-try-table-and-throw (result i32)
+ (block $l-catch (result i32)
+ (try_table (catch $e-i32 $l-catch)
+ (throw $e-i32 (i32.const 0))
+ )
+ )
+ )
+
+ ;; CHECK-TEXT: (func $try-table-and-throw-ref (type $0)
+ ;; CHECK-TEXT-NEXT: (throw_ref
+ ;; CHECK-TEXT-NEXT: (block $l-catch-all-ref (result exnref)
+ ;; CHECK-TEXT-NEXT: (try_table (catch_all_ref $l-catch-all-ref)
+ ;; CHECK-TEXT-NEXT: (throw $e-i64
+ ;; CHECK-TEXT-NEXT: (i64.const 0)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $try-table-and-throw-ref (type $0)
+ ;; CHECK-BIN-NEXT: (throw_ref
+ ;; CHECK-BIN-NEXT: (block $label$1 (result exnref)
+ ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $label$1)
+ ;; CHECK-BIN-NEXT: (throw $e-i64
+ ;; CHECK-BIN-NEXT: (i64.const 0)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $try-table-and-throw-ref
+ (throw_ref
+ (block $l-catch-all-ref (result exnref)
+ (try_table (catch_all_ref $l-catch-all-ref)
+ (throw $e-i64 (i64.const 0))
+ )
+ )
+ )
+ )
+
+ ;; CHECK-TEXT: (func $try-table-multivalue-tag (type $0)
+ ;; CHECK-TEXT-NEXT: (block $outer
+ ;; CHECK-TEXT-NEXT: (tuple.drop 3
+ ;; CHECK-TEXT-NEXT: (block $l-catch-ref (type $4) (result i32 i64 exnref)
+ ;; CHECK-TEXT-NEXT: (tuple.drop 2
+ ;; CHECK-TEXT-NEXT: (block $l-catch (type $3) (result i32 i64)
+ ;; CHECK-TEXT-NEXT: (try_table (catch $e-i32-i64 $l-catch) (catch_ref $e-i32-i64 $l-catch-ref)
+ ;; CHECK-TEXT-NEXT: (throw $e-i32-i64
+ ;; CHECK-TEXT-NEXT: (i32.const 0)
+ ;; CHECK-TEXT-NEXT: (i64.const 0)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: (br $outer)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $try-table-multivalue-tag (type $0)
+ ;; CHECK-BIN-NEXT: (local $0 (i32 i64))
+ ;; CHECK-BIN-NEXT: (local $1 i32)
+ ;; CHECK-BIN-NEXT: (local $2 (i32 i64 exnref))
+ ;; CHECK-BIN-NEXT: (local $3 i64)
+ ;; CHECK-BIN-NEXT: (local $4 i32)
+ ;; CHECK-BIN-NEXT: (block $label$1
+ ;; CHECK-BIN-NEXT: (local.set $2
+ ;; CHECK-BIN-NEXT: (block $label$2 (type $4) (result i32 i64 exnref)
+ ;; CHECK-BIN-NEXT: (local.set $0
+ ;; CHECK-BIN-NEXT: (block $label$3 (type $3) (result i32 i64)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-i32-i64 $label$3) (catch_ref $e-i32-i64 $label$2)
+ ;; CHECK-BIN-NEXT: (throw $e-i32-i64
+ ;; CHECK-BIN-NEXT: (i32.const 0)
+ ;; CHECK-BIN-NEXT: (i64.const 0)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (block (result i32)
+ ;; CHECK-BIN-NEXT: (local.set $1
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 0
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 1
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (block (result i32)
+ ;; CHECK-BIN-NEXT: (local.set $4
+ ;; CHECK-BIN-NEXT: (tuple.extract 3 0
+ ;; CHECK-BIN-NEXT: (local.get $2)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (block (result i64)
+ ;; CHECK-BIN-NEXT: (local.set $3
+ ;; CHECK-BIN-NEXT: (tuple.extract 3 1
+ ;; CHECK-BIN-NEXT: (local.get $2)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (tuple.extract 3 2
+ ;; CHECK-BIN-NEXT: (local.get $2)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local.get $3)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local.get $4)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $try-table-multivalue-tag
+ (block $outer
+ (tuple.drop 3
+ (block $l-catch-ref (result i32 i64 exnref)
+ (tuple.drop 2
+ (block $l-catch (result i32 i64)
+ (try_table (catch $e-i32-i64 $l-catch)
+ (catch_ref $e-i32-i64 $l-catch-ref)
+ (throw $e-i32-i64 (i32.const 0) (i64.const 0))
+ )
+ )
+ )
+ (br $outer)
+ )
+ )
+ )
+ )
+
+ ;; CHECK-TEXT: (func $try-table-all-catch-clauses (type $0)
+ ;; CHECK-TEXT-NEXT: (block $outer
+ ;; CHECK-TEXT-NEXT: (drop
+ ;; CHECK-TEXT-NEXT: (block $l-catch (result i32)
+ ;; CHECK-TEXT-NEXT: (tuple.drop 2
+ ;; CHECK-TEXT-NEXT: (block $l-catch-ref (type $5) (result i32 exnref)
+ ;; CHECK-TEXT-NEXT: (block $l-catch-all
+ ;; CHECK-TEXT-NEXT: (throw_ref
+ ;; CHECK-TEXT-NEXT: (block $l-catch-all-ref (result exnref)
+ ;; CHECK-TEXT-NEXT: (try_table (catch $e-i32 $l-catch) (catch_ref $e-i32 $l-catch-ref) (catch_all $l-catch-all) (catch_all_ref $l-catch-all-ref)
+ ;; CHECK-TEXT-NEXT: (call $foo)
+ ;; CHECK-TEXT-NEXT: (call $foo)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: (br $outer)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: (br $outer)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: (br $outer)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $try-table-all-catch-clauses (type $0)
+ ;; CHECK-BIN-NEXT: (local $0 (i32 exnref))
+ ;; CHECK-BIN-NEXT: (local $1 i32)
+ ;; CHECK-BIN-NEXT: (block $label$1
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (block $label$2 (result i32)
+ ;; CHECK-BIN-NEXT: (local.set $0
+ ;; CHECK-BIN-NEXT: (block $label$3 (type $5) (result i32 exnref)
+ ;; CHECK-BIN-NEXT: (block $label$4
+ ;; CHECK-BIN-NEXT: (throw_ref
+ ;; CHECK-BIN-NEXT: (block $label$5 (result exnref)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $label$2) (catch_ref $e-i32 $label$3) (catch_all $label$4) (catch_all_ref $label$5)
+ ;; CHECK-BIN-NEXT: (call $foo)
+ ;; CHECK-BIN-NEXT: (call $foo)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (block (result i32)
+ ;; CHECK-BIN-NEXT: (local.set $1
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 0
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (tuple.extract 2 1
+ ;; CHECK-BIN-NEXT: (local.get $0)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (local.get $1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (br $label$1)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $try-table-all-catch-clauses
+ (block $outer
+ (drop
+ (block $l-catch (result i32)
+ (tuple.drop 2
+ (block $l-catch-ref (result i32 exnref)
+ (block $l-catch-all
+ (throw_ref
+ (block $l-catch-all-ref (result exnref)
+ (try_table (catch $e-i32 $l-catch)
+ (catch_ref $e-i32 $l-catch-ref)
+ (catch_all $l-catch-all)
+ (catch_all_ref $l-catch-all-ref)
+ (call $foo)
+ (call $foo)
+ )
+ (br $outer)
+ )
+ )
+ )
+ (br $outer)
+ )
+ )
+ (br $outer)
+ )
+ )
+ )
+ )
+
+ ;; CHECK-TEXT: (func $try-table-with-label-and-br (type $2) (result i32)
+ ;; CHECK-TEXT-NEXT: (block $l-catch (result i32)
+ ;; CHECK-TEXT-NEXT: (block $l (result i32)
+ ;; CHECK-TEXT-NEXT: (try_table (result i32) (catch $e-i32 $l-catch)
+ ;; CHECK-TEXT-NEXT: (br $l
+ ;; CHECK-TEXT-NEXT: (i32.const 0)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $try-table-with-label-and-br (type $2) (result i32)
+ ;; CHECK-BIN-NEXT: (block $label$1 (result i32)
+ ;; CHECK-BIN-NEXT: (block $label$2 (result i32)
+ ;; CHECK-BIN-NEXT: (try_table (result i32) (catch $e-i32 $label$1)
+ ;; CHECK-BIN-NEXT: (br $label$2
+ ;; CHECK-BIN-NEXT: (i32.const 0)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $try-table-with-label-and-br (result i32)
+ (block $l-catch (result i32)
+ (try_table $l (result i32) (catch $e-i32 $l-catch)
+ (br $l (i32.const 0))
+ )
+ )
+ )
+
+ ;; CHECK-TEXT: (func $nested-try-table (type $1) (result exnref)
+ ;; CHECK-TEXT-NEXT: (block $l-catch-outer (result exnref)
+ ;; CHECK-TEXT-NEXT: (drop
+ ;; CHECK-TEXT-NEXT: (block $l-catch-inner (result i32)
+ ;; CHECK-TEXT-NEXT: (try_table (catch_all_ref $l-catch-outer)
+ ;; CHECK-TEXT-NEXT: (try_table (catch $e-i32 $l-catch-inner)
+ ;; CHECK-TEXT-NEXT: (if
+ ;; CHECK-TEXT-NEXT: (i32.const 0)
+ ;; CHECK-TEXT-NEXT: (throw $e-i32
+ ;; CHECK-TEXT-NEXT: (i32.const 3)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: (throw $e-eqref
+ ;; CHECK-TEXT-NEXT: (ref.null none)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: (ref.null noexn)
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-TEXT-NEXT: )
+ ;; CHECK-BIN: (func $nested-try-table (type $1) (result exnref)
+ ;; CHECK-BIN-NEXT: (block $label$1 (result exnref)
+ ;; CHECK-BIN-NEXT: (drop
+ ;; CHECK-BIN-NEXT: (block $label$2 (result i32)
+ ;; CHECK-BIN-NEXT: (try_table (catch_all_ref $label$1)
+ ;; CHECK-BIN-NEXT: (try_table (catch $e-i32 $label$2)
+ ;; CHECK-BIN-NEXT: (if
+ ;; CHECK-BIN-NEXT: (i32.const 0)
+ ;; CHECK-BIN-NEXT: (throw $e-i32
+ ;; CHECK-BIN-NEXT: (i32.const 3)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (throw $e-eqref
+ ;; CHECK-BIN-NEXT: (ref.null none)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: (ref.null noexn)
+ ;; CHECK-BIN-NEXT: )
+ ;; CHECK-BIN-NEXT: )
+ (func $nested-try-table (result exnref)
+ (block $l-catch-outer (result exnref)
+ (drop
+ (block $l-catch-inner (result i32)
+ (try_table (catch_all_ref $l-catch-outer)
+ (try_table (catch $e-i32 $l-catch-inner)
+ (if
+ (i32.const 0)
+ (throw $e-i32 (i32.const 3))
+ (throw $e-eqref (ref.null eq))
+ )
+ )
+ )
+ )
+ )
+ (ref.null noexn)
+ )
+ )
)
-;; CHECK-BIN-NODEBUG: (type $0 (func (result exnref)))
+;; CHECK-BIN-NODEBUG: (type $0 (func))
+
+;; CHECK-BIN-NODEBUG: (type $1 (func (result exnref)))
+
+;; CHECK-BIN-NODEBUG: (type $2 (func (result i32)))
+
+;; CHECK-BIN-NODEBUG: (type $3 (func (result i32 i64)))
+
+;; CHECK-BIN-NODEBUG: (type $4 (func (result i32 i64 exnref)))
+
+;; CHECK-BIN-NODEBUG: (type $5 (func (result i32 exnref)))
+
+;; CHECK-BIN-NODEBUG: (type $6 (func (param i32)))
+
+;; CHECK-BIN-NODEBUG: (type $7 (func (param i64)))
+
+;; CHECK-BIN-NODEBUG: (type $8 (func (param i32 i64)))
+
+;; CHECK-BIN-NODEBUG: (type $9 (func (param eqref)))
+
+;; CHECK-BIN-NODEBUG: (tag $tag$0 (param i32))
+
+;; CHECK-BIN-NODEBUG: (tag $tag$1 (param i64))
-;; CHECK-BIN-NODEBUG: (func $0 (type $0) (result exnref)
+;; CHECK-BIN-NODEBUG: (tag $tag$2 (param i32 i64))
+
+;; CHECK-BIN-NODEBUG: (tag $tag$3 (param eqref))
+
+;; CHECK-BIN-NODEBUG: (tag $tag$4)
+
+;; CHECK-BIN-NODEBUG: (func $0 (type $0)
+;; CHECK-BIN-NODEBUG-NEXT: (nop)
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $1 (type $1) (result exnref)
;; CHECK-BIN-NODEBUG-NEXT: (local $0 exnref)
;; CHECK-BIN-NODEBUG-NEXT: (local $1 nullexnref)
;; CHECK-BIN-NODEBUG-NEXT: (if (result exnref)
@@ -67,3 +530,177 @@
;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
;; CHECK-BIN-NODEBUG-NEXT: )
;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $2 (type $0)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table
+;; CHECK-BIN-NODEBUG-NEXT: (nop)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (try_table
+;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$4)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $3 (type $2) (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $4 (type $0)
+;; CHECK-BIN-NODEBUG-NEXT: (throw_ref
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$1
+;; CHECK-BIN-NODEBUG-NEXT: (i64.const 0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $5 (type $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local $0 (i32 i64))
+;; CHECK-BIN-NODEBUG-NEXT: (local $1 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local $2 (i32 i64 exnref))
+;; CHECK-BIN-NODEBUG-NEXT: (local $3 i64)
+;; CHECK-BIN-NODEBUG-NEXT: (local $4 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $2
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (type $4) (result i32 i64 exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (type $3) (result i32 i64)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$2 $label$3) (catch_ref $tag$2 $label$2)
+;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$2
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
+;; CHECK-BIN-NODEBUG-NEXT: (i64.const 0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $4
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 0
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i64)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $3
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 1
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 3 2
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $2)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $3)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $4)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $6 (type $0)
+;; CHECK-BIN-NODEBUG-NEXT: (local $0 (i32 exnref))
+;; CHECK-BIN-NODEBUG-NEXT: (local $1 i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$1
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $0
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$3 (type $5) (result i32 exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$4
+;; CHECK-BIN-NODEBUG-NEXT: (throw_ref
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$5 (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $label$2) (catch_ref $tag$0 $label$3) (catch_all $label$4) (catch_all_ref $label$5)
+;; CHECK-BIN-NODEBUG-NEXT: (call $0)
+;; CHECK-BIN-NODEBUG-NEXT: (call $0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (block (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (local.set $1
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 0
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (tuple.extract 2 1
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (local.get $1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (br $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $7 (type $2) (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (result i32) (catch $tag$0 $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (br $label$2
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+
+;; CHECK-BIN-NODEBUG: (func $8 (type $1) (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$1 (result exnref)
+;; CHECK-BIN-NODEBUG-NEXT: (drop
+;; CHECK-BIN-NODEBUG-NEXT: (block $label$2 (result i32)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch_all_ref $label$1)
+;; CHECK-BIN-NODEBUG-NEXT: (try_table (catch $tag$0 $label$2)
+;; CHECK-BIN-NODEBUG-NEXT: (if
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0)
+;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$0
+;; CHECK-BIN-NODEBUG-NEXT: (i32.const 3)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (throw $tag$3
+;; CHECK-BIN-NODEBUG-NEXT: (ref.null none)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: (ref.null noexn)
+;; CHECK-BIN-NODEBUG-NEXT: )
+;; CHECK-BIN-NODEBUG-NEXT: )