diff options
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | src/wasm/wasm-binary.cpp | 8 | ||||
-rw-r--r-- | src/wasm/wasm-validator.cpp | 2 | ||||
-rw-r--r-- | src/wasm/wasm.cpp | 6 | ||||
-rw-r--r-- | test/lit/basic/exception-handling-no-gc.wast | 27 | ||||
-rw-r--r-- | test/lit/passes/merge-blocks-eh.wast | 2 | ||||
-rw-r--r-- | test/lit/passes/translate-to-exnref.wast | 140 |
7 files changed, 119 insertions, 76 deletions
@@ -148,6 +148,16 @@ There are a few differences between Binaryen IR and the WebAssembly language: much about this when writing Binaryen passes. For more details see the `requiresNonNullableLocalFixups()` hook in `pass.h` and the `LocalStructuralDominance` class. + * Binaryen IR uses the most refined types possible for references, + specifically: + * The IR type of a `ref.func` is always a specific function type, and not + plain `funcref`. It is also non-nullable. + * Non-nullable types are also used for the type that `try_table` sends + on branches (if we branch, a null is never sent), that is, it sends + (ref exn) and not (ref null exn). + In both cases if GC is not enabled then we emit the less-refined type in the + binary. When reading a binary, the more refined types will be applied as we + build the IR. * `br_if` output types are more refined in Binaryen IR: they have the type of the value, when a value flows in. In the wasm spec the type is that of the branch target, which may be less refined. Using the more refined type here diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 920baf944..bc7ec8ac8 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1544,9 +1544,9 @@ void WasmBinaryWriter::writeInlineBuffer(const char* data, size_t size) { void WasmBinaryWriter::writeType(Type type) { if (type.isRef()) { - // The only reference types allowed without GC are funcref and externref. We - // internally use more refined versions of those types, but we cannot emit - // those more refined types. + // The only reference types allowed without GC are funcref, externref, and + // exnref. We internally use more refined versions of those types, but we + // cannot emit those without GC. if (!wasm->features.hasGC()) { auto ht = type.getHeapType(); if (ht.isMaybeShared(HeapType::string)) { @@ -1555,6 +1555,8 @@ void WasmBinaryWriter::writeType(Type type) { // string, the stringref feature must be enabled. type = Type(HeapTypes::string.getBasic(ht.getShared()), Nullable); } else { + // Only the top type (func, extern, exn) is available, and only the + // nullable version. type = Type(type.getHeapType().getTop(), Nullable); } } diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index a86187fa7..0184e3284 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2658,7 +2658,7 @@ void FunctionValidator::visitTryTable(TryTable* curr) { "the number of catch tags and sent types do not match"); const char* invalidSentTypeMsg = "invalid catch sent type information"; - Type exnref = Type(HeapType::exn, Nullable); + Type exnref = Type(HeapType::exn, NonNullable); for (Index i = 0; i < curr->catchTags.size(); i++) { auto sentType = curr->sentTypes[i]; size_t tagTypeSize; diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 0245fc01e..4150af5b4 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -933,7 +933,11 @@ static void populateTryTableSentTypes(TryTable* curr, Module* wasm) { return; } curr->sentTypes.clear(); - Type exnref = Type(HeapType::exn, Nullable); + // We always use the refined non-nullable type in our IR, which is what the + // wasm spec defines when GC is enabled (=== non-nullable types are allowed). + // If GC is not enabled then we emit a nullable type in the binary format in + // WasmBinaryWriter::writeType. + Type exnref = Type(HeapType::exn, NonNullable); for (Index i = 0; i < curr->catchTags.size(); i++) { auto tagName = curr->catchTags[i]; std::vector<Type> sentType; diff --git a/test/lit/basic/exception-handling-no-gc.wast b/test/lit/basic/exception-handling-no-gc.wast new file mode 100644 index 000000000..4ab0708c4 --- /dev/null +++ b/test/lit/basic/exception-handling-no-gc.wast @@ -0,0 +1,27 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. + +;; Test that we do not emit an invalid (ref exn) when exceptions are enabled +;; but not GC. GC is required for us to be non-nullable. + +;; RUN: wasm-opt %s --enable-reference-types --enable-exception-handling --disable-gc --roundtrip -S -o - | filecheck %s + +(module + ;; CHECK: (func $test (result exnref) + ;; CHECK-NEXT: (block $label$1 (result exnref) + ;; CHECK-NEXT: (try_table (catch_all_ref $label$1) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $test (result exnref) + ;; It is valid to write (ref exn) in Binaryen IR, and internally that is how + ;; we represent things, but when we emit the binary we emit a nullable type, + ;; so after the roundtrip we are less refined. + (block $label (result (ref exn)) + (try_table (catch_all_ref $label) + (unreachable) + ) + ) + ) +) + diff --git a/test/lit/passes/merge-blocks-eh.wast b/test/lit/passes/merge-blocks-eh.wast index e53f601fd..e56f536f4 100644 --- a/test/lit/passes/merge-blocks-eh.wast +++ b/test/lit/passes/merge-blocks-eh.wast @@ -100,7 +100,7 @@ ;; CHECK: (func $drop-block-try_catch_multi_partial (type $0) ;; CHECK-NEXT: (tuple.drop 2 - ;; CHECK-NEXT: (block $outer (type $1) (result i32 exnref) + ;; CHECK-NEXT: (block $outer (type $2) (result i32 (ref exn)) ;; CHECK-NEXT: (block $inner ;; CHECK-NEXT: (try_table (catch_ref $i32 $outer) (catch_all $inner) ;; CHECK-NEXT: (call $import) diff --git a/test/lit/passes/translate-to-exnref.wast b/test/lit/passes/translate-to-exnref.wast index abba6b06e..8bac0dc39 100644 --- a/test/lit/passes/translate-to-exnref.wast +++ b/test/lit/passes/translate-to-exnref.wast @@ -10,9 +10,9 @@ ;; CHECK: (type $2 (func (result i32))) - ;; CHECK: (type $3 (func (result i32 exnref))) + ;; CHECK: (type $3 (func (result i32 (ref exn)))) - ;; CHECK: (type $4 (func (result i32 i64 exnref))) + ;; CHECK: (type $4 (func (result i32 i64 (ref exn)))) ;; CHECK: (type $5 (func (param i32))) @@ -25,9 +25,9 @@ ;; STACKIR-OPT: (type $2 (func (result i32))) - ;; STACKIR-OPT: (type $3 (func (result i32 exnref))) + ;; STACKIR-OPT: (type $3 (func (result i32 (ref exn)))) - ;; STACKIR-OPT: (type $4 (func (result i32 i64 exnref))) + ;; STACKIR-OPT: (type $4 (func (result i32 i64 (ref exn)))) ;; STACKIR-OPT: (type $5 (func (param i32))) @@ -115,9 +115,9 @@ ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (block $outer0 ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all2 (result exnref) + ;; CHECK-NEXT: (block $catch_all2 (result (ref exn)) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch1 (result exnref) + ;; CHECK-NEXT: (block $catch1 (result (ref exn)) ;; CHECK-NEXT: (try_table (catch_ref $e-empty $catch1) (catch_all_ref $catch_all2) ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) @@ -137,8 +137,8 @@ ;; STACKIR-OPT: (func $try-none-tag-none-with-rethrow (type $1) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: block $outer0 - ;; STACKIR-OPT-NEXT: block $catch_all2 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (result exnref) + ;; STACKIR-OPT-NEXT: block $catch_all2 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (result (ref exn)) ;; STACKIR-OPT-NEXT: try_table (catch_ref $e-empty $catch1) (catch_all_ref $catch_all2) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: end @@ -220,12 +220,12 @@ ;; CHECK: (func $try-none-tag-single-with-rethrow (type $1) ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (local $1 i32) - ;; CHECK-NEXT: (local $2 (tuple i32 exnref)) + ;; CHECK-NEXT: (local $2 (tuple i32 (ref exn))) ;; CHECK-NEXT: (block $outer0 ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all2 (result exnref) + ;; CHECK-NEXT: (block $catch_all2 (result (ref exn)) ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (block $catch1 (type $3) (result i32 exnref) + ;; CHECK-NEXT: (block $catch1 (type $3) (result i32 (ref exn)) ;; CHECK-NEXT: (try_table (catch_ref $e-i32 $catch1) (catch_all_ref $catch_all2) ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) @@ -260,10 +260,10 @@ ;; STACKIR-OPT: (func $try-none-tag-single-with-rethrow (type $1) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: (local $1 i32) - ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 exnref)) + ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 (ref exn))) ;; STACKIR-OPT-NEXT: block $outer0 - ;; STACKIR-OPT-NEXT: block $catch_all2 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (type $3) (result i32 exnref) + ;; STACKIR-OPT-NEXT: block $catch_all2 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (type $3) (result i32 (ref exn)) ;; STACKIR-OPT-NEXT: try_table (catch_ref $e-i32 $catch1) (catch_all_ref $catch_all2) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: end @@ -358,12 +358,12 @@ ;; CHECK: (func $try-none-tag-tuple-with-rethrow (type $1) ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (local $1 (tuple i32 i64)) - ;; CHECK-NEXT: (local $2 (tuple i32 i64 exnref)) + ;; CHECK-NEXT: (local $2 (tuple i32 i64 (ref exn))) ;; CHECK-NEXT: (block $outer0 ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all2 (result exnref) + ;; CHECK-NEXT: (block $catch_all2 (result (ref exn)) ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (block $catch1 (type $4) (result i32 i64 exnref) + ;; CHECK-NEXT: (block $catch1 (type $4) (result i32 i64 (ref exn)) ;; CHECK-NEXT: (try_table (catch_ref $e-i32-i64 $catch1) (catch_all_ref $catch_all2) ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) @@ -403,10 +403,10 @@ ;; STACKIR-OPT: (func $try-none-tag-tuple-with-rethrow (type $1) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: (local $1 (tuple i32 i64)) - ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 i64 exnref)) + ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 i64 (ref exn))) ;; STACKIR-OPT-NEXT: block $outer0 - ;; STACKIR-OPT-NEXT: block $catch_all2 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (type $4) (result i32 i64 exnref) + ;; STACKIR-OPT-NEXT: block $catch_all2 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (type $4) (result i32 i64 (ref exn)) ;; STACKIR-OPT-NEXT: try_table (catch_ref $e-i32-i64 $catch1) (catch_all_ref $catch_all2) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: end @@ -500,9 +500,9 @@ ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (block $outer0 (result i32) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all2 (result exnref) + ;; CHECK-NEXT: (block $catch_all2 (result (ref exn)) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch1 (result exnref) + ;; CHECK-NEXT: (block $catch1 (result (ref exn)) ;; CHECK-NEXT: (br $outer0 ;; CHECK-NEXT: (try_table (result i32) (catch_ref $e-empty $catch1) (catch_all_ref $catch_all2) ;; CHECK-NEXT: (call $foo) @@ -524,8 +524,8 @@ ;; STACKIR-OPT: (func $try-single-tag-none-with-rethrow (type $2) (result i32) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: block $outer0 (result i32) - ;; STACKIR-OPT-NEXT: block $catch_all2 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (result exnref) + ;; STACKIR-OPT-NEXT: block $catch_all2 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (result (ref exn)) ;; STACKIR-OPT-NEXT: try_table (result i32) (catch_ref $e-empty $catch1) (catch_all_ref $catch_all2) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: i32.const 0 @@ -609,12 +609,12 @@ ;; CHECK: (func $try-single-tag-single-with-rethrow (type $2) (result i32) ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (local $1 i32) - ;; CHECK-NEXT: (local $2 (tuple i32 exnref)) + ;; CHECK-NEXT: (local $2 (tuple i32 (ref exn))) ;; CHECK-NEXT: (block $outer0 (result i32) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all2 (result exnref) + ;; CHECK-NEXT: (block $catch_all2 (result (ref exn)) ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (block $catch1 (type $3) (result i32 exnref) + ;; CHECK-NEXT: (block $catch1 (type $3) (result i32 (ref exn)) ;; CHECK-NEXT: (br $outer0 ;; CHECK-NEXT: (try_table (result i32) (catch_ref $e-i32 $catch1) (catch_all_ref $catch_all2) ;; CHECK-NEXT: (call $foo) @@ -653,10 +653,10 @@ ;; STACKIR-OPT: (func $try-single-tag-single-with-rethrow (type $2) (result i32) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: (local $1 i32) - ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 exnref)) + ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 (ref exn))) ;; STACKIR-OPT-NEXT: block $outer0 (result i32) - ;; STACKIR-OPT-NEXT: block $catch_all2 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (type $3) (result i32 exnref) + ;; STACKIR-OPT-NEXT: block $catch_all2 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (type $3) (result i32 (ref exn)) ;; STACKIR-OPT-NEXT: try_table (result i32) (catch_ref $e-i32 $catch1) (catch_all_ref $catch_all2) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: i32.const 0 @@ -764,12 +764,12 @@ ;; CHECK: (func $try-single-tag-tuple-with-rethrow (type $2) (result i32) ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (local $1 (tuple i32 i64)) - ;; CHECK-NEXT: (local $2 (tuple i32 i64 exnref)) + ;; CHECK-NEXT: (local $2 (tuple i32 i64 (ref exn))) ;; CHECK-NEXT: (block $outer0 (result i32) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all2 (result exnref) + ;; CHECK-NEXT: (block $catch_all2 (result (ref exn)) ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (block $catch1 (type $4) (result i32 i64 exnref) + ;; CHECK-NEXT: (block $catch1 (type $4) (result i32 i64 (ref exn)) ;; CHECK-NEXT: (br $outer0 ;; CHECK-NEXT: (try_table (result i32) (catch_ref $e-i32-i64 $catch1) (catch_all_ref $catch_all2) ;; CHECK-NEXT: (call $foo) @@ -813,10 +813,10 @@ ;; STACKIR-OPT: (func $try-single-tag-tuple-with-rethrow (type $2) (result i32) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: (local $1 (tuple i32 i64)) - ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 i64 exnref)) + ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 i64 (ref exn))) ;; STACKIR-OPT-NEXT: block $outer0 (result i32) - ;; STACKIR-OPT-NEXT: block $catch_all2 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (type $4) (result i32 i64 exnref) + ;; STACKIR-OPT-NEXT: block $catch_all2 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (type $4) (result i32 i64 (ref exn)) ;; STACKIR-OPT-NEXT: try_table (result i32) (catch_ref $e-i32-i64 $catch1) (catch_all_ref $catch_all2) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: i32.const 0 @@ -937,9 +937,9 @@ ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (block $outer0 (type $0) (result i32 i64) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all2 (result exnref) + ;; CHECK-NEXT: (block $catch_all2 (result (ref exn)) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch1 (result exnref) + ;; CHECK-NEXT: (block $catch1 (result (ref exn)) ;; CHECK-NEXT: (br $outer0 ;; CHECK-NEXT: (try_table (type $0) (result i32 i64) (catch_ref $e-empty $catch1) (catch_all_ref $catch_all2) ;; CHECK-NEXT: (call $foo) @@ -964,8 +964,8 @@ ;; STACKIR-OPT: (func $try-tuple-tag-none-with-rethrow (type $0) (result i32 i64) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: block $outer0 (type $0) (result i32 i64) - ;; STACKIR-OPT-NEXT: block $catch_all2 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (result exnref) + ;; STACKIR-OPT-NEXT: block $catch_all2 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (result (ref exn)) ;; STACKIR-OPT-NEXT: try_table (type $0) (result i32 i64) (catch_ref $e-empty $catch1) (catch_all_ref $catch_all2) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: i32.const 0 @@ -1078,12 +1078,12 @@ ;; CHECK: (func $try-tuple-tag-single-with-rethrow (type $0) (result i32 i64) ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (local $1 i32) - ;; CHECK-NEXT: (local $2 (tuple i32 exnref)) + ;; CHECK-NEXT: (local $2 (tuple i32 (ref exn))) ;; CHECK-NEXT: (block $outer0 (type $0) (result i32 i64) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all2 (result exnref) + ;; CHECK-NEXT: (block $catch_all2 (result (ref exn)) ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (block $catch1 (type $3) (result i32 exnref) + ;; CHECK-NEXT: (block $catch1 (type $3) (result i32 (ref exn)) ;; CHECK-NEXT: (br $outer0 ;; CHECK-NEXT: (try_table (type $0) (result i32 i64) (catch_ref $e-i32 $catch1) (catch_all_ref $catch_all2) ;; CHECK-NEXT: (call $foo) @@ -1125,10 +1125,10 @@ ;; STACKIR-OPT: (func $try-tuple-tag-single-with-rethrow (type $0) (result i32 i64) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: (local $1 i32) - ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 exnref)) + ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 (ref exn))) ;; STACKIR-OPT-NEXT: block $outer0 (type $0) (result i32 i64) - ;; STACKIR-OPT-NEXT: block $catch_all2 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (type $3) (result i32 exnref) + ;; STACKIR-OPT-NEXT: block $catch_all2 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (type $3) (result i32 (ref exn)) ;; STACKIR-OPT-NEXT: try_table (type $0) (result i32 i64) (catch_ref $e-i32 $catch1) (catch_all_ref $catch_all2) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: i32.const 0 @@ -1247,12 +1247,12 @@ ;; CHECK: (func $try-tuple-tag-tuple-with-rethrow (type $0) (result i32 i64) ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (local $1 (tuple i32 i64)) - ;; CHECK-NEXT: (local $2 (tuple i32 i64 exnref)) + ;; CHECK-NEXT: (local $2 (tuple i32 i64 (ref exn))) ;; CHECK-NEXT: (block $outer0 (type $0) (result i32 i64) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all2 (result exnref) + ;; CHECK-NEXT: (block $catch_all2 (result (ref exn)) ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (block $catch1 (type $4) (result i32 i64 exnref) + ;; CHECK-NEXT: (block $catch1 (type $4) (result i32 i64 (ref exn)) ;; CHECK-NEXT: (br $outer0 ;; CHECK-NEXT: (try_table (type $0) (result i32 i64) (catch_ref $e-i32-i64 $catch1) (catch_all_ref $catch_all2) ;; CHECK-NEXT: (call $foo) @@ -1299,10 +1299,10 @@ ;; STACKIR-OPT: (func $try-tuple-tag-tuple-with-rethrow (type $0) (result i32 i64) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: (local $1 (tuple i32 i64)) - ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 i64 exnref)) + ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 i64 (ref exn))) ;; STACKIR-OPT-NEXT: block $outer0 (type $0) (result i32 i64) - ;; STACKIR-OPT-NEXT: block $catch_all2 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (type $4) (result i32 i64 exnref) + ;; STACKIR-OPT-NEXT: block $catch_all2 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (type $4) (result i32 i64 (ref exn)) ;; STACKIR-OPT-NEXT: try_table (type $0) (result i32 i64) (catch_ref $e-i32-i64 $catch1) (catch_all_ref $catch_all2) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: i32.const 0 @@ -1375,17 +1375,17 @@ ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 (tuple i32 i64)) - ;; CHECK-NEXT: (local $3 (tuple i32 exnref)) - ;; CHECK-NEXT: (local $4 (tuple i32 i64 exnref)) + ;; CHECK-NEXT: (local $3 (tuple i32 (ref exn))) + ;; CHECK-NEXT: (local $4 (tuple i32 i64 (ref exn))) ;; CHECK-NEXT: (block $outer0 ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all4 (result exnref) + ;; CHECK-NEXT: (block $catch_all4 (result (ref exn)) ;; CHECK-NEXT: (local.set $4 - ;; CHECK-NEXT: (block $catch3 (type $4) (result i32 i64 exnref) + ;; CHECK-NEXT: (block $catch3 (type $4) (result i32 i64 (ref exn)) ;; CHECK-NEXT: (local.set $3 - ;; CHECK-NEXT: (block $catch2 (type $3) (result i32 exnref) + ;; CHECK-NEXT: (block $catch2 (type $3) (result i32 (ref exn)) ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch1 (result exnref) + ;; CHECK-NEXT: (block $catch1 (result (ref exn)) ;; CHECK-NEXT: (try_table (catch_ref $e-empty $catch1) (catch_ref $e-i32 $catch2) (catch_ref $e-i32-i64 $catch3) (catch_all_ref $catch_all4) ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) @@ -1451,13 +1451,13 @@ ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: (local $1 i32) ;; STACKIR-OPT-NEXT: (local $2 (tuple i32 i64)) - ;; STACKIR-OPT-NEXT: (local $3 (tuple i32 exnref)) - ;; STACKIR-OPT-NEXT: (local $4 (tuple i32 i64 exnref)) + ;; STACKIR-OPT-NEXT: (local $3 (tuple i32 (ref exn))) + ;; STACKIR-OPT-NEXT: (local $4 (tuple i32 i64 (ref exn))) ;; STACKIR-OPT-NEXT: block $outer0 - ;; STACKIR-OPT-NEXT: block $catch_all4 (result exnref) - ;; STACKIR-OPT-NEXT: block $catch3 (type $4) (result i32 i64 exnref) - ;; STACKIR-OPT-NEXT: block $catch2 (type $3) (result i32 exnref) - ;; STACKIR-OPT-NEXT: block $catch1 (result exnref) + ;; STACKIR-OPT-NEXT: block $catch_all4 (result (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch3 (type $4) (result i32 i64 (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch2 (type $3) (result i32 (ref exn)) + ;; STACKIR-OPT-NEXT: block $catch1 (result (ref exn)) ;; STACKIR-OPT-NEXT: try_table (catch_ref $e-empty $catch1) (catch_ref $e-i32 $catch2) (catch_ref $e-i32-i64 $catch3) (catch_all_ref $catch_all4) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: end @@ -1522,7 +1522,7 @@ ;; CHECK-NEXT: (local $1 exnref) ;; CHECK-NEXT: (block $outer3 ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch_all4 (result exnref) + ;; CHECK-NEXT: (block $catch_all4 (result (ref exn)) ;; CHECK-NEXT: (try_table (catch_all_ref $catch_all4) ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) @@ -1531,7 +1531,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (block $outer0 ;; CHECK-NEXT: (local.set $1 - ;; CHECK-NEXT: (block $catch2 (result exnref) + ;; CHECK-NEXT: (block $catch2 (result (ref exn)) ;; CHECK-NEXT: (block $catch1 ;; CHECK-NEXT: (try_table (catch $e-empty $catch1) (catch_ref $e-empty $catch2) ;; CHECK-NEXT: (call $foo) @@ -1553,7 +1553,7 @@ ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: (local $1 exnref) ;; STACKIR-OPT-NEXT: block $outer3 - ;; STACKIR-OPT-NEXT: block $catch_all4 (result exnref) + ;; STACKIR-OPT-NEXT: block $catch_all4 (result (ref exn)) ;; STACKIR-OPT-NEXT: try_table (catch_all_ref $catch_all4) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: end @@ -1561,7 +1561,7 @@ ;; STACKIR-OPT-NEXT: end ;; STACKIR-OPT-NEXT: local.set $0 ;; STACKIR-OPT-NEXT: block $outer0 - ;; STACKIR-OPT-NEXT: block $catch2 (result exnref) + ;; STACKIR-OPT-NEXT: block $catch2 (result (ref exn)) ;; STACKIR-OPT-NEXT: block $catch1 ;; STACKIR-OPT-NEXT: try_table (catch $e-empty $catch1) (catch_ref $e-empty $catch2) ;; STACKIR-OPT-NEXT: call $foo @@ -2216,7 +2216,7 @@ ;; CHECK-NEXT: (local $0 exnref) ;; CHECK-NEXT: (block $outer2 ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (block $catch3 (result exnref) + ;; CHECK-NEXT: (block $catch3 (result (ref exn)) ;; CHECK-NEXT: (try_table (catch_ref $e-empty $catch3) ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) @@ -2245,7 +2245,7 @@ ;; STACKIR-OPT: (func $try-catch-rethrow-with-inner-delegate (type $1) ;; STACKIR-OPT-NEXT: (local $0 exnref) ;; STACKIR-OPT-NEXT: block $outer2 - ;; STACKIR-OPT-NEXT: block $catch3 (result exnref) + ;; STACKIR-OPT-NEXT: block $catch3 (result (ref exn)) ;; STACKIR-OPT-NEXT: try_table (catch_ref $e-empty $catch3) ;; STACKIR-OPT-NEXT: call $foo ;; STACKIR-OPT-NEXT: end |