summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md8
-rw-r--r--src/passes/Print.cpp82
-rw-r--r--src/wasm-type.h4
-rw-r--r--src/wasm/wasm-binary.cpp4
-rw-r--r--src/wasm/wasm-s-parser.cpp4
-rw-r--r--src/wasm/wat-parser.cpp4
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt8
-rw-r--r--test/gc.wast.from-wast4
-rw-r--r--test/gc.wast.fromBinary4
-rw-r--r--test/gc.wast.fromBinary.noDebugInfo4
-rw-r--r--test/heap-types.wast.from-wast8
-rw-r--r--test/heap-types.wast.fromBinary8
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo8
-rw-r--r--test/lit/passes/coalesce-locals-gc.wast4
-rw-r--r--test/lit/passes/dae-gc-refine-params.wast16
-rw-r--r--test/lit/passes/dae-gc-refine-return.wast56
-rw-r--r--test/lit/passes/dae-gc.wast24
-rw-r--r--test/lit/passes/dae_all-features.wast2
-rw-r--r--test/lit/passes/local-subtyping.wast10
-rw-r--r--test/lit/passes/merge-blocks.wast2
-rw-r--r--test/lit/passes/merge-similar-functions_all-features.wast2
-rw-r--r--test/lit/passes/optimize-instructions-call_ref.wast8
-rw-r--r--test/lit/passes/optimize-instructions-gc-tnh.wast2
-rw-r--r--test/lit/passes/optimize-instructions-gc.wast44
-rw-r--r--test/lit/passes/precompute-gc-immutable.wast2
-rw-r--r--test/lit/passes/remove-unused-brs-gc.wast6
-rw-r--r--test/lit/passes/rse-gc.wast4
-rw-r--r--test/lit/passes/signature-refining.wast16
-rw-r--r--test/lit/passes/simplify-locals-gc.wast8
-rw-r--r--test/lit/passes/type-refining-isorecursive.wast4
-rw-r--r--test/lit/passes/type-refining.wast6
-rw-r--r--test/lit/passes/vacuum-gc.wast8
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.txt2
-rw-r--r--test/passes/merge-locals_all-features.txt4
-rw-r--r--test/passes/remove-unused-brs_all-features.txt10
-rw-r--r--test/passes/simplify-locals_all-features.txt6
-rw-r--r--test/passes/simplify-locals_all-features_disable-exception-handling.txt2
-rw-r--r--test/subtypes.wast.from-wast6
-rw-r--r--test/subtypes.wast.fromBinary6
-rw-r--r--test/subtypes.wast.fromBinary.noDebugInfo18
40 files changed, 200 insertions, 228 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab28fd56d..b1f0df7b5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,13 +21,7 @@ Current Trunk
- Change constant values of some reference types in the C and JS APIs. This is
only observable if you hardcode specific values instead of calling the
relevant methods (like `BinaryenTypeDataref()`). (#4755)
-- `BinaryenModulePrintStackIR`, `BinaryenModuleWriteStackIR` and
- `BinaryenModuleAllocateAndWriteStackIR` now have an extra boolean
- argument `optimize`. (#4832)
-- Remove support for the `let` instruction that has been removed from the typed
- function references spec.
-- HeapType::ext has been restored but is no longer a subtype of HeapType::any to
- match the latest updates in the GC spec. (#4898)
+- `i31ref` and `dataref` are now nullable to match the latest GC spec. (#4843)
v109
----
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 81ae1bfc6..7385c18ea 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -85,56 +85,38 @@ static bool maybePrintRefShorthand(std::ostream& o, Type type) {
return false;
}
auto heapType = type.getHeapType();
- if (heapType.isBasic()) {
- if (type.isNullable()) {
- switch (heapType.getBasic()) {
- case HeapType::ext:
- o << "externref";
- return true;
- case HeapType::func:
- o << "funcref";
- return true;
- case HeapType::any:
- o << "anyref";
- return true;
- case HeapType::eq:
- o << "eqref";
- return true;
- case HeapType::i31:
- case HeapType::data:
- break;
- case HeapType::string:
- o << "stringref";
- return true;
- case HeapType::stringview_wtf8:
- o << "stringview_wtf8";
- return true;
- case HeapType::stringview_wtf16:
- o << "stringview_wtf16";
- return true;
- case HeapType::stringview_iter:
- o << "stringview_iter";
- return true;
- }
- } else {
- switch (heapType.getBasic()) {
- case HeapType::ext:
- case HeapType::func:
- case HeapType::any:
- case HeapType::eq:
- break;
- case HeapType::i31:
- o << "i31ref";
- return true;
- case HeapType::data:
- o << "dataref";
- return true;
- case HeapType::string:
- case HeapType::stringview_wtf8:
- case HeapType::stringview_wtf16:
- case HeapType::stringview_iter:
- break;
- }
+ if (heapType.isBasic() && type.isNullable()) {
+ switch (heapType.getBasic()) {
+ case HeapType::ext:
+ o << "externref";
+ return true;
+ case HeapType::func:
+ o << "funcref";
+ return true;
+ case HeapType::any:
+ o << "anyref";
+ return true;
+ case HeapType::eq:
+ o << "eqref";
+ return true;
+ case HeapType::i31:
+ o << "i31ref";
+ return true;
+ case HeapType::data:
+ o << "dataref";
+ return true;
+ case HeapType::string:
+ o << "stringref";
+ return true;
+ case HeapType::stringview_wtf8:
+ o << "stringview_wtf8";
+ return true;
+ case HeapType::stringview_wtf16:
+ o << "stringview_wtf16";
+ return true;
+ case HeapType::stringview_iter:
+ o << "stringview_iter";
+ return true;
}
}
return false;
diff --git a/src/wasm-type.h b/src/wasm-type.h
index 7235cda8b..778318794 100644
--- a/src/wasm-type.h
+++ b/src/wasm-type.h
@@ -143,8 +143,8 @@ public:
// │ funcref ║ x │ │ x │ x │ f n │ ┐ Ref
// │ anyref ║ x │ │ x │ x │ f? n │ │ f_unc
// │ eqref ║ x │ │ x │ x │ n │ │ n_ullable
- // │ i31ref ║ x │ │ x │ x │ │ │
- // │ dataref ║ x │ │ x │ x │ │ │
+ // │ i31ref ║ x │ │ x │ x │ n │ │
+ // │ dataref ║ x │ │ x │ x │ n │ │
// ├─ Compound ──╫───┼───┼───┼───┤───────┤ │
// │ Ref ║ │ x │ x │ x │ f? n? │◄┘
// │ Tuple ║ │ x │ │ x │ │
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 1fb43c884..685ad978d 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1849,10 +1849,10 @@ bool WasmBinaryBuilder::getBasicType(int32_t code, Type& out) {
out = Type(HeapType::eq, Nullable);
return true;
case BinaryConsts::EncodedType::i31ref:
- out = Type(HeapType::i31, NonNullable);
+ out = Type(HeapType::i31, Nullable);
return true;
case BinaryConsts::EncodedType::dataref:
- out = Type(HeapType::data, NonNullable);
+ out = Type(HeapType::data, Nullable);
return true;
case BinaryConsts::EncodedType::stringref:
out = Type(HeapType::string, Nullable);
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 362ba25f9..a7d63a7c6 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -1179,10 +1179,10 @@ Type SExpressionWasmBuilder::stringToType(const char* str,
return Type(HeapType::eq, Nullable);
}
if (strncmp(str, "i31ref", 6) == 0 && (prefix || str[6] == 0)) {
- return Type(HeapType::i31, NonNullable);
+ return Type(HeapType::i31, Nullable);
}
if (strncmp(str, "dataref", 7) == 0 && (prefix || str[7] == 0)) {
- return Type(HeapType::data, NonNullable);
+ return Type(HeapType::data, Nullable);
}
if (strncmp(str, "stringref", 9) == 0 && (prefix || str[9] == 0)) {
return Type(HeapType::string, Nullable);
diff --git a/src/wasm/wat-parser.cpp b/src/wasm/wat-parser.cpp
index 843e26d08..9e843271f 100644
--- a/src/wasm/wat-parser.cpp
+++ b/src/wasm/wat-parser.cpp
@@ -1343,10 +1343,10 @@ MaybeResult<typename Ctx::TypeT> reftype(Ctx& ctx, ParseInput& in) {
return ctx.makeRefType(ctx.makeEq(), Nullable);
}
if (in.takeKeyword("i31ref"sv)) {
- return ctx.makeRefType(ctx.makeI31(), NonNullable);
+ return ctx.makeRefType(ctx.makeI31(), Nullable);
}
if (in.takeKeyword("dataref"sv)) {
- return ctx.makeRefType(ctx.makeData(), NonNullable);
+ return ctx.makeRefType(ctx.makeData(), Nullable);
}
if (in.takeKeyword("arrayref"sv)) {
return in.err("arrayref not yet supported");
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index f92ceeb4a..7d52a31ff 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -2161,10 +2161,10 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(pop eqref)
)
(drop
- (pop i31ref)
+ (pop (ref i31))
)
(drop
- (pop dataref)
+ (pop (ref data))
)
(drop
(pop stringref)
@@ -4265,10 +4265,10 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(pop eqref)
)
(drop
- (pop i31ref)
+ (pop (ref i31))
)
(drop
- (pop dataref)
+ (pop (ref data))
)
(drop
(pop stringref)
diff --git a/test/gc.wast.from-wast b/test/gc.wast.from-wast
index 91cd83ec6..19936135c 100644
--- a/test/gc.wast.from-wast
+++ b/test/gc.wast.from-wast
@@ -1,6 +1,6 @@
(module
(type $i31ref_dataref_=>_none (func (param i31ref dataref)))
- (type $ref?|i31|_i31ref_ref?|data|_dataref_=>_none (func (param (ref null i31) i31ref (ref null data) dataref)))
+ (type $i31ref_ref|i31|_dataref_ref|data|_=>_none (func (param i31ref (ref i31) dataref (ref data))))
(global $global_anyref (mut anyref) (ref.null any))
(global $global_eqref (mut eqref) (ref.null eq))
(global $global_i31ref (mut i31ref) (i31.new
@@ -148,7 +148,7 @@
)
)
)
- (func $test-variants (param $local_i31refnull (ref null i31)) (param $local_i31refnonnull i31ref) (param $local_datarefnull (ref null data)) (param $local_datarefnonnull dataref)
+ (func $test-variants (param $local_i31refnull i31ref) (param $local_i31refnonnull (ref i31)) (param $local_datarefnull dataref) (param $local_datarefnonnull (ref data))
(nop)
)
)
diff --git a/test/gc.wast.fromBinary b/test/gc.wast.fromBinary
index 3794a01f1..80d12cf1d 100644
--- a/test/gc.wast.fromBinary
+++ b/test/gc.wast.fromBinary
@@ -1,6 +1,6 @@
(module
(type $i31ref_dataref_=>_none (func (param i31ref dataref)))
- (type $ref?|i31|_i31ref_ref?|data|_dataref_=>_none (func (param (ref null i31) i31ref (ref null data) dataref)))
+ (type $i31ref_ref|i31|_dataref_ref|data|_=>_none (func (param i31ref (ref i31) dataref (ref data))))
(global $global_anyref (mut anyref) (ref.null any))
(global $global_eqref (mut eqref) (ref.null eq))
(global $global_i31ref (mut i31ref) (i31.new
@@ -148,7 +148,7 @@
)
)
)
- (func $test-variants (param $local_i31refnull (ref null i31)) (param $local_i31refnonnull i31ref) (param $local_datarefnull (ref null data)) (param $local_datarefnonnull dataref)
+ (func $test-variants (param $local_i31refnull i31ref) (param $local_i31refnonnull (ref i31)) (param $local_datarefnull dataref) (param $local_datarefnonnull (ref data))
(nop)
)
)
diff --git a/test/gc.wast.fromBinary.noDebugInfo b/test/gc.wast.fromBinary.noDebugInfo
index a523e58d2..0ab9159aa 100644
--- a/test/gc.wast.fromBinary.noDebugInfo
+++ b/test/gc.wast.fromBinary.noDebugInfo
@@ -1,6 +1,6 @@
(module
(type $i31ref_dataref_=>_none (func (param i31ref dataref)))
- (type $ref?|i31|_i31ref_ref?|data|_dataref_=>_none (func (param (ref null i31) i31ref (ref null data) dataref)))
+ (type $i31ref_ref|i31|_dataref_ref|data|_=>_none (func (param i31ref (ref i31) dataref (ref data))))
(global $global$0 (mut anyref) (ref.null any))
(global $global$1 (mut eqref) (ref.null eq))
(global $global$2 (mut i31ref) (i31.new
@@ -148,7 +148,7 @@
)
)
)
- (func $1 (param $0 (ref null i31)) (param $1 i31ref) (param $2 (ref null data)) (param $3 dataref)
+ (func $1 (param $0 i31ref) (param $1 (ref i31)) (param $2 dataref) (param $3 (ref data))
(nop)
)
)
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index 3af46eb21..527184084 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -221,8 +221,8 @@
(local $y anyref)
(local $z anyref)
(local $temp-func funcref)
- (local $temp-data (ref null data))
- (local $temp-i31 (ref null i31))
+ (local $temp-data dataref)
+ (local $temp-i31 i31ref)
(block $null
(local.set $z
(br_on_null $null
@@ -241,7 +241,7 @@
)
)
(drop
- (block $data (result (ref null data))
+ (block $data (result dataref)
(local.set $y
(br_on_data $data
(local.get $x)
@@ -251,7 +251,7 @@
)
)
(drop
- (block $i31 (result (ref null i31))
+ (block $i31 (result i31ref)
(local.set $y
(br_on_i31 $i31
(local.get $x)
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index 803908b19..e8d96de24 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -219,8 +219,8 @@
(local $y anyref)
(local $z anyref)
(local $temp-func funcref)
- (local $temp-data (ref null data))
- (local $temp-i31 (ref null i31))
+ (local $temp-data dataref)
+ (local $temp-i31 i31ref)
(block $label$1
(local.set $z
(br_on_null $label$1
@@ -239,7 +239,7 @@
)
)
(drop
- (block $label$3 (result (ref null data))
+ (block $label$3 (result dataref)
(local.set $y
(br_on_data $label$3
(local.get $x)
@@ -249,7 +249,7 @@
)
)
(drop
- (block $label$4 (result (ref null i31))
+ (block $label$4 (result i31ref)
(local.set $y
(br_on_i31 $label$4
(local.get $x)
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index eb697b12d..fefec450a 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -219,8 +219,8 @@
(local $1 anyref)
(local $2 anyref)
(local $3 funcref)
- (local $4 (ref null data))
- (local $5 (ref null i31))
+ (local $4 dataref)
+ (local $5 i31ref)
(block $label$1
(local.set $2
(br_on_null $label$1
@@ -239,7 +239,7 @@
)
)
(drop
- (block $label$3 (result (ref null data))
+ (block $label$3 (result dataref)
(local.set $1
(br_on_data $label$3
(local.get $0)
@@ -249,7 +249,7 @@
)
)
(drop
- (block $label$4 (result (ref null i31))
+ (block $label$4 (result i31ref)
(local.set $1
(br_on_i31 $label$4
(local.get $0)
diff --git a/test/lit/passes/coalesce-locals-gc.wast b/test/lit/passes/coalesce-locals-gc.wast
index 52243ebc8..074c9caf0 100644
--- a/test/lit/passes/coalesce-locals-gc.wast
+++ b/test/lit/passes/coalesce-locals-gc.wast
@@ -8,10 +8,10 @@
;; CHECK: (global $global (ref null $array) (ref.null $array))
(global $global (ref null $array) (ref.null $array))
- ;; CHECK: (func $test-dead-get-non-nullable (param $0 dataref)
+ ;; CHECK: (func $test-dead-get-non-nullable (param $0 (ref data))
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result dataref)
+ ;; CHECK-NEXT: (block (result (ref data))
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
diff --git a/test/lit/passes/dae-gc-refine-params.wast b/test/lit/passes/dae-gc-refine-params.wast
index e67600c54..3b104bdcc 100644
--- a/test/lit/passes/dae-gc-refine-params.wast
+++ b/test/lit/passes/dae-gc-refine-params.wast
@@ -466,11 +466,11 @@
)
;; CHECK: (func $unused-and-refinable
- ;; CHECK-NEXT: (local $0 (ref null data))
+ ;; CHECK-NEXT: (local $0 dataref)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
;; NOMNL: (func $unused-and-refinable (type $none_=>_none)
- ;; NOMNL-NEXT: (local $0 (ref null data))
+ ;; NOMNL-NEXT: (local $0 dataref)
;; NOMNL-NEXT: (nop)
;; NOMNL-NEXT: )
(func $unused-and-refinable (param $0 dataref)
@@ -498,25 +498,21 @@
)
;; CHECK: (func $non-nullable-fixup (param $0 (ref ${}))
- ;; CHECK-NEXT: (local $1 (ref null data))
+ ;; CHECK-NEXT: (local $1 dataref)
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (ref.as_non_null
- ;; CHECK-NEXT: (local.get $1)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $non-nullable-fixup (type $ref|${}|_=>_none) (param $0 (ref ${}))
- ;; NOMNL-NEXT: (local $1 (ref null data))
+ ;; NOMNL-NEXT: (local $1 dataref)
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (local.get $0)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (local.set $1
- ;; NOMNL-NEXT: (ref.as_non_null
- ;; NOMNL-NEXT: (local.get $1)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (local.get $1)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $non-nullable-fixup (param $0 dataref)
diff --git a/test/lit/passes/dae-gc-refine-return.wast b/test/lit/passes/dae-gc-refine-return.wast
index f0a6fa18e..ccf11509c 100644
--- a/test/lit/passes/dae-gc-refine-return.wast
+++ b/test/lit/passes/dae-gc-refine-return.wast
@@ -80,17 +80,17 @@
)
;; Refine the return type based on the value flowing out.
- ;; CHECK: (func $refine-return-flow (result (ref null i31))
+ ;; CHECK: (func $refine-return-flow (result i31ref)
;; CHECK-NEXT: (local $temp anyref)
- ;; CHECK-NEXT: (local $i31 (ref null i31))
+ ;; CHECK-NEXT: (local $i31 i31ref)
;; CHECK-NEXT: (local.set $temp
;; CHECK-NEXT: (call $refine-return-flow)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.get $i31)
;; CHECK-NEXT: )
- ;; NOMNL: (func $refine-return-flow (type $none_=>_ref?|i31|) (result (ref null i31))
+ ;; NOMNL: (func $refine-return-flow (type $none_=>_i31ref) (result i31ref)
;; NOMNL-NEXT: (local $temp anyref)
- ;; NOMNL-NEXT: (local $i31 (ref null i31))
+ ;; NOMNL-NEXT: (local $i31 i31ref)
;; NOMNL-NEXT: (local.set $temp
;; NOMNL-NEXT: (call $refine-return-flow)
;; NOMNL-NEXT: )
@@ -104,23 +104,23 @@
(local.get $i31)
)
- ;; CHECK: (func $call-refine-return-flow (result (ref null i31))
+ ;; CHECK: (func $call-refine-return-flow (result i31ref)
;; CHECK-NEXT: (local $temp anyref)
;; CHECK-NEXT: (local.set $temp
;; CHECK-NEXT: (call $call-refine-return-flow)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (if (result (ref null i31))
+ ;; CHECK-NEXT: (if (result i31ref)
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: (call $refine-return-flow)
;; CHECK-NEXT: (call $refine-return-flow)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $call-refine-return-flow (type $none_=>_ref?|i31|) (result (ref null i31))
+ ;; NOMNL: (func $call-refine-return-flow (type $none_=>_i31ref) (result i31ref)
;; NOMNL-NEXT: (local $temp anyref)
;; NOMNL-NEXT: (local.set $temp
;; NOMNL-NEXT: (call $call-refine-return-flow)
;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (if (result (ref null i31))
+ ;; NOMNL-NEXT: (if (result i31ref)
;; NOMNL-NEXT: (i32.const 1)
;; NOMNL-NEXT: (call $refine-return-flow)
;; NOMNL-NEXT: (call $refine-return-flow)
@@ -141,9 +141,9 @@
)
;; Refine the return type based on a return.
- ;; CHECK: (func $refine-return-return (result (ref null i31))
+ ;; CHECK: (func $refine-return-return (result i31ref)
;; CHECK-NEXT: (local $temp anyref)
- ;; CHECK-NEXT: (local $i31 (ref null i31))
+ ;; CHECK-NEXT: (local $i31 i31ref)
;; CHECK-NEXT: (local.set $temp
;; CHECK-NEXT: (call $refine-return-return)
;; CHECK-NEXT: )
@@ -151,9 +151,9 @@
;; CHECK-NEXT: (local.get $i31)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $refine-return-return (type $none_=>_ref?|i31|) (result (ref null i31))
+ ;; NOMNL: (func $refine-return-return (type $none_=>_i31ref) (result i31ref)
;; NOMNL-NEXT: (local $temp anyref)
- ;; NOMNL-NEXT: (local $i31 (ref null i31))
+ ;; NOMNL-NEXT: (local $i31 i31ref)
;; NOMNL-NEXT: (local.set $temp
;; NOMNL-NEXT: (call $refine-return-return)
;; NOMNL-NEXT: )
@@ -171,9 +171,9 @@
)
;; Refine the return type based on multiple values.
- ;; CHECK: (func $refine-return-many (result (ref null i31))
+ ;; CHECK: (func $refine-return-many (result i31ref)
;; CHECK-NEXT: (local $temp anyref)
- ;; CHECK-NEXT: (local $i31 (ref null i31))
+ ;; CHECK-NEXT: (local $i31 i31ref)
;; CHECK-NEXT: (local.set $temp
;; CHECK-NEXT: (call $refine-return-many)
;; CHECK-NEXT: )
@@ -191,9 +191,9 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.get $i31)
;; CHECK-NEXT: )
- ;; NOMNL: (func $refine-return-many (type $none_=>_ref?|i31|) (result (ref null i31))
+ ;; NOMNL: (func $refine-return-many (type $none_=>_i31ref) (result i31ref)
;; NOMNL-NEXT: (local $temp anyref)
- ;; NOMNL-NEXT: (local $i31 (ref null i31))
+ ;; NOMNL-NEXT: (local $i31 i31ref)
;; NOMNL-NEXT: (local.set $temp
;; NOMNL-NEXT: (call $refine-return-many)
;; NOMNL-NEXT: )
@@ -230,8 +230,8 @@
;; CHECK: (func $refine-return-many-lub (result eqref)
;; CHECK-NEXT: (local $temp anyref)
- ;; CHECK-NEXT: (local $i31 (ref null i31))
- ;; CHECK-NEXT: (local $data (ref null data))
+ ;; CHECK-NEXT: (local $i31 i31ref)
+ ;; CHECK-NEXT: (local $data dataref)
;; CHECK-NEXT: (local.set $temp
;; CHECK-NEXT: (call $refine-return-many-lub)
;; CHECK-NEXT: )
@@ -251,8 +251,8 @@
;; CHECK-NEXT: )
;; NOMNL: (func $refine-return-many-lub (type $none_=>_eqref) (result eqref)
;; NOMNL-NEXT: (local $temp anyref)
- ;; NOMNL-NEXT: (local $i31 (ref null i31))
- ;; NOMNL-NEXT: (local $data (ref null data))
+ ;; NOMNL-NEXT: (local $i31 i31ref)
+ ;; NOMNL-NEXT: (local $data dataref)
;; NOMNL-NEXT: (local.set $temp
;; NOMNL-NEXT: (call $refine-return-many-lub)
;; NOMNL-NEXT: )
@@ -291,8 +291,8 @@
;; CHECK: (func $refine-return-many-lub-2 (result eqref)
;; CHECK-NEXT: (local $temp anyref)
- ;; CHECK-NEXT: (local $i31 (ref null i31))
- ;; CHECK-NEXT: (local $data (ref null data))
+ ;; CHECK-NEXT: (local $i31 i31ref)
+ ;; CHECK-NEXT: (local $data dataref)
;; CHECK-NEXT: (local.set $temp
;; CHECK-NEXT: (call $refine-return-many-lub-2)
;; CHECK-NEXT: )
@@ -312,8 +312,8 @@
;; CHECK-NEXT: )
;; NOMNL: (func $refine-return-many-lub-2 (type $none_=>_eqref) (result eqref)
;; NOMNL-NEXT: (local $temp anyref)
- ;; NOMNL-NEXT: (local $i31 (ref null i31))
- ;; NOMNL-NEXT: (local $data (ref null data))
+ ;; NOMNL-NEXT: (local $i31 i31ref)
+ ;; NOMNL-NEXT: (local $data dataref)
;; NOMNL-NEXT: (local.set $temp
;; NOMNL-NEXT: (call $refine-return-many-lub-2)
;; NOMNL-NEXT: )
@@ -351,9 +351,9 @@
)
;; We can refine the return types of tuples.
- ;; CHECK: (func $refine-return-tuple (result (ref null i31) i32)
+ ;; CHECK: (func $refine-return-tuple (result i31ref i32)
;; CHECK-NEXT: (local $temp anyref)
- ;; CHECK-NEXT: (local $i31 (ref null i31))
+ ;; CHECK-NEXT: (local $i31 i31ref)
;; CHECK-NEXT: (local.set $temp
;; CHECK-NEXT: (tuple.extract 0
;; CHECK-NEXT: (call $refine-return-tuple)
@@ -364,9 +364,9 @@
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $refine-return-tuple (type $none_=>_ref?|i31|_i32) (result (ref null i31) i32)
+ ;; NOMNL: (func $refine-return-tuple (type $none_=>_i31ref_i32) (result i31ref i32)
;; NOMNL-NEXT: (local $temp anyref)
- ;; NOMNL-NEXT: (local $i31 (ref null i31))
+ ;; NOMNL-NEXT: (local $i31 i31ref)
;; NOMNL-NEXT: (local.set $temp
;; NOMNL-NEXT: (tuple.extract 0
;; NOMNL-NEXT: (call $refine-return-tuple)
diff --git a/test/lit/passes/dae-gc.wast b/test/lit/passes/dae-gc.wast
index 7740d8345..5ec272ea4 100644
--- a/test/lit/passes/dae-gc.wast
+++ b/test/lit/passes/dae-gc.wast
@@ -21,13 +21,11 @@
)
)
;; CHECK: (func $bar
- ;; CHECK-NEXT: (local $0 (ref null i31))
+ ;; CHECK-NEXT: (local $0 i31ref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.as_non_null
- ;; CHECK-NEXT: (local.tee $0
- ;; CHECK-NEXT: (i31.new
- ;; CHECK-NEXT: (i32.const 2)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.tee $0
+ ;; CHECK-NEXT: (i31.new
+ ;; CHECK-NEXT: (i32.const 2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -36,13 +34,11 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $bar (type $none_=>_none)
- ;; NOMNL-NEXT: (local $0 (ref null i31))
+ ;; NOMNL-NEXT: (local $0 i31ref)
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.as_non_null
- ;; NOMNL-NEXT: (local.tee $0
- ;; NOMNL-NEXT: (i31.new
- ;; NOMNL-NEXT: (i32.const 2)
- ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (local.tee $0
+ ;; NOMNL-NEXT: (i31.new
+ ;; NOMNL-NEXT: (i32.const 2)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -164,7 +160,7 @@
)
)
- ;; CHECK: (func $bar (param $0 (ref null i31))
+ ;; CHECK: (func $bar (param $0 i31ref)
;; CHECK-NEXT: (local $1 anyref)
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (ref.null any)
@@ -178,7 +174,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $bar (type $ref?|i31|_=>_none) (param $0 (ref null i31))
+ ;; NOMNL: (func $bar (type $i31ref_=>_none) (param $0 i31ref)
;; NOMNL-NEXT: (local $1 anyref)
;; NOMNL-NEXT: (local.set $1
;; NOMNL-NEXT: (ref.null any)
diff --git a/test/lit/passes/dae_all-features.wast b/test/lit/passes/dae_all-features.wast
index 446951561..89ce922ac 100644
--- a/test/lit/passes/dae_all-features.wast
+++ b/test/lit/passes/dae_all-features.wast
@@ -531,7 +531,7 @@
;; CHECK: (type $none_=>_none (func))
;; CHECK: (func $0
- ;; CHECK-NEXT: (local $0 (ref null i31))
+ ;; CHECK-NEXT: (local $0 i31ref)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
(func $0 (param $x i31ref)
diff --git a/test/lit/passes/local-subtyping.wast b/test/lit/passes/local-subtyping.wast
index 98de29e27..37990ad24 100644
--- a/test/lit/passes/local-subtyping.wast
+++ b/test/lit/passes/local-subtyping.wast
@@ -20,7 +20,7 @@
;; not the optimal LUB.
;; CHECK: (func $refinalize (param $x i32)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (if (result i31ref)
+ ;; CHECK-NEXT: (if (result (ref i31))
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: (i31.new
;; CHECK-NEXT: (i32.const 0)
@@ -31,7 +31,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $block (result i31ref)
+ ;; CHECK-NEXT: (block $block (result (ref i31))
;; CHECK-NEXT: (br $block
;; CHECK-NEXT: (i31.new
;; CHECK-NEXT: (i32.const 0)
@@ -85,10 +85,10 @@
)
)
- ;; CHECK: (func $locals-with-multiple-assignments (param $data (ref null data))
+ ;; CHECK: (func $locals-with-multiple-assignments (param $data dataref)
;; CHECK-NEXT: (local $x eqref)
- ;; CHECK-NEXT: (local $y (ref null i31))
- ;; CHECK-NEXT: (local $z (ref null data))
+ ;; CHECK-NEXT: (local $y i31ref)
+ ;; CHECK-NEXT: (local $z dataref)
;; CHECK-NEXT: (local $w funcref)
;; CHECK-NEXT: (local.set $x
;; CHECK-NEXT: (i31.new
diff --git a/test/lit/passes/merge-blocks.wast b/test/lit/passes/merge-blocks.wast
index d6ff8b3d8..e22f4c604 100644
--- a/test/lit/passes/merge-blocks.wast
+++ b/test/lit/passes/merge-blocks.wast
@@ -17,7 +17,7 @@
;; CHECK: (func $br_on_to_drop
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $label$1 (result (ref null i31))
+ ;; CHECK-NEXT: (block $label$1 (result i31ref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (br_on_i31 $label$1
;; CHECK-NEXT: (ref.null any)
diff --git a/test/lit/passes/merge-similar-functions_all-features.wast b/test/lit/passes/merge-similar-functions_all-features.wast
index deda3b36b..bcd9c706b 100644
--- a/test/lit/passes/merge-similar-functions_all-features.wast
+++ b/test/lit/passes/merge-similar-functions_all-features.wast
@@ -5,7 +5,7 @@
;; CHECK: (type $[i8] (array i8))
(type $[i8] (array i8))
- ;; CHECK: (func $take-ref-null-data (param $0 (ref null data))
+ ;; CHECK: (func $take-ref-null-data (param $0 dataref)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $take-ref-null-data (param (ref null data))
diff --git a/test/lit/passes/optimize-instructions-call_ref.wast b/test/lit/passes/optimize-instructions-call_ref.wast
index c2b2be364..7164fda55 100644
--- a/test/lit/passes/optimize-instructions-call_ref.wast
+++ b/test/lit/passes/optimize-instructions-call_ref.wast
@@ -16,7 +16,7 @@
;; CHECK: (type $i32_=>_none (func (param i32)))
- ;; CHECK: (type $data_=>_none (func (param dataref)))
+ ;; CHECK: (type $data_=>_none (func (param (ref data))))
(type $data_=>_none (func (param (ref data))))
;; CHECK: (type $i32_i32_i32_ref|$i32_i32_=>_none|_=>_none (func (param i32 i32 i32 (ref $i32_i32_=>_none))))
@@ -124,10 +124,10 @@
)
)
- ;; CHECK: (func $fallthrough-non-nullable (param $x dataref)
- ;; CHECK-NEXT: (local $1 (ref null data))
+ ;; CHECK: (func $fallthrough-non-nullable (param $x (ref data))
+ ;; CHECK-NEXT: (local $1 dataref)
;; CHECK-NEXT: (call $fallthrough-non-nullable
- ;; CHECK-NEXT: (block (result dataref)
+ ;; CHECK-NEXT: (block (result (ref data))
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
diff --git a/test/lit/passes/optimize-instructions-gc-tnh.wast b/test/lit/passes/optimize-instructions-gc-tnh.wast
index aad02c17c..b1fc9a42b 100644
--- a/test/lit/passes/optimize-instructions-gc-tnh.wast
+++ b/test/lit/passes/optimize-instructions-gc-tnh.wast
@@ -75,7 +75,7 @@
;; NO_TNH-NEXT: )
;; NO_TNH-NEXT: (unreachable)
;; NO_TNH-NEXT: )
- ;; NO_TNH-NEXT: (block (result dataref)
+ ;; NO_TNH-NEXT: (block (result (ref data))
;; NO_TNH-NEXT: (drop
;; NO_TNH-NEXT: (ref.func $ref.eq-no)
;; NO_TNH-NEXT: )
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast
index e8db92523..6a52f2f44 100644
--- a/test/lit/passes/optimize-instructions-gc.wast
+++ b/test/lit/passes/optimize-instructions-gc.wast
@@ -154,7 +154,7 @@
;; ref.is_null is not needed on a non-nullable value, and if something is
;; a func we don't need that either etc. if we know the result
- ;; CHECK: (func $unneeded_is (param $struct (ref $struct)) (param $func (ref func)) (param $data dataref) (param $i31 i31ref)
+ ;; CHECK: (func $unneeded_is (param $struct (ref $struct)) (param $func (ref func)) (param $data (ref data)) (param $i31 (ref i31))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
;; CHECK-NEXT: (drop
@@ -188,7 +188,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $unneeded_is (type $ref|$struct|_ref|func|_dataref_i31ref_=>_none) (param $struct (ref $struct)) (param $func (ref func)) (param $data dataref) (param $i31 i31ref)
+ ;; NOMNL: (func $unneeded_is (type $ref|$struct|_ref|func|_ref|data|_ref|i31|_=>_none) (param $struct (ref $struct)) (param $func (ref func)) (param $data (ref data)) (param $i31 (ref i31))
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (block (result i32)
;; NOMNL-NEXT: (drop
@@ -243,7 +243,7 @@
;; similar to $unneeded_is, but the values are nullable. we can at least
;; leave just the null check.
- ;; CHECK: (func $unneeded_is_null (param $struct (ref null $struct)) (param $func funcref) (param $data (ref null data)) (param $i31 (ref null i31))
+ ;; CHECK: (func $unneeded_is_null (param $struct (ref null $struct)) (param $func funcref) (param $data dataref) (param $i31 i31ref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.is_null
;; CHECK-NEXT: (local.get $struct)
@@ -271,7 +271,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $unneeded_is_null (type $ref?|$struct|_funcref_ref?|data|_ref?|i31|_=>_none) (param $struct (ref null $struct)) (param $func funcref) (param $data (ref null data)) (param $i31 (ref null i31))
+ ;; NOMNL: (func $unneeded_is_null (type $ref?|$struct|_funcref_dataref_i31ref_=>_none) (param $struct (ref null $struct)) (param $func funcref) (param $data dataref) (param $i31 i31ref)
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (ref.is_null
;; NOMNL-NEXT: (local.get $struct)
@@ -320,7 +320,7 @@
;; similar to $unneeded_is, but the values are of mixed kind (is_func of
;; data, etc.). regardless of nullability the result here is always 0.
- ;; CHECK: (func $unneeded_is_bad_kinds (param $func funcref) (param $data (ref null data)) (param $i31 (ref null i31))
+ ;; CHECK: (func $unneeded_is_bad_kinds (param $func funcref) (param $data dataref) (param $i31 i31ref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
;; CHECK-NEXT: (drop
@@ -376,7 +376,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $unneeded_is_bad_kinds (type $funcref_ref?|data|_ref?|i31|_=>_none) (param $func funcref) (param $data (ref null data)) (param $i31 (ref null i31))
+ ;; NOMNL: (func $unneeded_is_bad_kinds (type $funcref_dataref_i31ref_=>_none) (param $func funcref) (param $data dataref) (param $i31 i31ref)
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (block (result i32)
;; NOMNL-NEXT: (drop
@@ -459,7 +459,7 @@
;; ref.as_non_null is not needed on a non-nullable value, and if something is
;; a func we don't need that either etc., and can just return the value.
- ;; CHECK: (func $unneeded_as (param $struct (ref $struct)) (param $func (ref func)) (param $data dataref) (param $i31 i31ref)
+ ;; CHECK: (func $unneeded_as (param $struct (ref $struct)) (param $func (ref func)) (param $data (ref data)) (param $i31 (ref i31))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $struct)
;; CHECK-NEXT: )
@@ -473,7 +473,7 @@
;; CHECK-NEXT: (local.get $i31)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $unneeded_as (type $ref|$struct|_ref|func|_dataref_i31ref_=>_none) (param $struct (ref $struct)) (param $func (ref func)) (param $data dataref) (param $i31 i31ref)
+ ;; NOMNL: (func $unneeded_as (type $ref|$struct|_ref|func|_ref|data|_ref|i31|_=>_none) (param $struct (ref $struct)) (param $func (ref func)) (param $data (ref data)) (param $i31 (ref i31))
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $struct)
;; NOMNL-NEXT: )
@@ -508,7 +508,7 @@
;; similar to $unneeded_as, but the values are nullable. we can turn the
;; more specific things into ref.as_non_null.
- ;; CHECK: (func $unneeded_as_null (param $struct (ref null $struct)) (param $func funcref) (param $data (ref null data)) (param $i31 (ref null i31))
+ ;; CHECK: (func $unneeded_as_null (param $struct (ref null $struct)) (param $func funcref) (param $data dataref) (param $i31 i31ref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.as_non_null
;; CHECK-NEXT: (local.get $struct)
@@ -530,7 +530,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $unneeded_as_null (type $ref?|$struct|_funcref_ref?|data|_ref?|i31|_=>_none) (param $struct (ref null $struct)) (param $func funcref) (param $data (ref null data)) (param $i31 (ref null i31))
+ ;; NOMNL: (func $unneeded_as_null (type $ref?|$struct|_funcref_dataref_i31ref_=>_none) (param $struct (ref null $struct)) (param $func funcref) (param $data dataref) (param $i31 i31ref)
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (ref.as_non_null
;; NOMNL-NEXT: (local.get $struct)
@@ -573,7 +573,7 @@
;; similar to $unneeded_as, but the values are of mixed kind (as_func of
;; data, etc.), so we know we will trap
- ;; CHECK: (func $unneeded_as_bad_kinds (param $func funcref) (param $data (ref null data)) (param $i31 (ref null i31))
+ ;; CHECK: (func $unneeded_as_bad_kinds (param $func funcref) (param $data dataref) (param $i31 i31ref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result (ref func))
;; CHECK-NEXT: (drop
@@ -583,7 +583,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result dataref)
+ ;; CHECK-NEXT: (block (result (ref data))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $i31)
;; CHECK-NEXT: )
@@ -591,7 +591,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result i31ref)
+ ;; CHECK-NEXT: (block (result (ref i31))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $func)
;; CHECK-NEXT: )
@@ -607,7 +607,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result dataref)
+ ;; CHECK-NEXT: (block (result (ref data))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $i31)
;; CHECK-NEXT: )
@@ -615,7 +615,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result i31ref)
+ ;; CHECK-NEXT: (block (result (ref i31))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $func)
;; CHECK-NEXT: )
@@ -623,7 +623,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $unneeded_as_bad_kinds (type $funcref_ref?|data|_ref?|i31|_=>_none) (param $func funcref) (param $data (ref null data)) (param $i31 (ref null i31))
+ ;; NOMNL: (func $unneeded_as_bad_kinds (type $funcref_dataref_i31ref_=>_none) (param $func funcref) (param $data dataref) (param $i31 i31ref)
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (block (result (ref func))
;; NOMNL-NEXT: (drop
@@ -633,7 +633,7 @@
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result dataref)
+ ;; NOMNL-NEXT: (block (result (ref data))
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $i31)
;; NOMNL-NEXT: )
@@ -641,7 +641,7 @@
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result i31ref)
+ ;; NOMNL-NEXT: (block (result (ref i31))
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $func)
;; NOMNL-NEXT: )
@@ -657,7 +657,7 @@
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result dataref)
+ ;; NOMNL-NEXT: (block (result (ref data))
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $i31)
;; NOMNL-NEXT: )
@@ -665,7 +665,7 @@
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result i31ref)
+ ;; NOMNL-NEXT: (block (result (ref i31))
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $func)
;; NOMNL-NEXT: )
@@ -2130,7 +2130,7 @@
;; CHECK: (func $consecutive-opts-with-unreachable (param $func funcref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.cast_static $struct
- ;; CHECK-NEXT: (block (result dataref)
+ ;; CHECK-NEXT: (block (result (ref data))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.get $func)
;; CHECK-NEXT: )
@@ -2142,7 +2142,7 @@
;; NOMNL: (func $consecutive-opts-with-unreachable (type $funcref_=>_none) (param $func funcref)
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (ref.cast_static $struct
- ;; NOMNL-NEXT: (block (result dataref)
+ ;; NOMNL-NEXT: (block (result (ref data))
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (local.get $func)
;; NOMNL-NEXT: )
diff --git a/test/lit/passes/precompute-gc-immutable.wast b/test/lit/passes/precompute-gc-immutable.wast
index abee44329..bb627dfa1 100644
--- a/test/lit/passes/precompute-gc-immutable.wast
+++ b/test/lit/passes/precompute-gc-immutable.wast
@@ -735,7 +735,7 @@
;; data that is filled with vtables of different types. On usage, we do a
;; cast of the vtable type.
- ;; CHECK: (type $itable (array_subtype (ref null data) data))
+ ;; CHECK: (type $itable (array_subtype dataref data))
(type $itable (array_subtype (ref null data) data))
;; CHECK: (type $object (struct_subtype (field (ref $itable)) data))
diff --git a/test/lit/passes/remove-unused-brs-gc.wast b/test/lit/passes/remove-unused-brs-gc.wast
index bdbf1bd07..3b7346e3f 100644
--- a/test/lit/passes/remove-unused-brs-gc.wast
+++ b/test/lit/passes/remove-unused-brs-gc.wast
@@ -33,7 +33,7 @@
)
)
)
- ;; CHECK: (func $br_on_non_data-2 (param $data dataref)
+ ;; CHECK: (func $br_on_non_data-2 (param $data (ref data))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block $any (result anyref)
;; CHECK-NEXT: (drop
@@ -57,10 +57,10 @@
)
)
- ;; CHECK: (func $br_on-if (param $0 dataref)
+ ;; CHECK: (func $br_on-if (param $0 (ref data))
;; CHECK-NEXT: (block $label
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (select (result dataref)
+ ;; CHECK-NEXT: (select (result (ref data))
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: (i32.const 0)
diff --git a/test/lit/passes/rse-gc.wast b/test/lit/passes/rse-gc.wast
index e96b06a45..50657cf06 100644
--- a/test/lit/passes/rse-gc.wast
+++ b/test/lit/passes/rse-gc.wast
@@ -2,9 +2,9 @@
;; RUN: wasm-opt %s --rse --enable-gc-nn-locals -all -S -o - | filecheck %s
(module
- ;; CHECK: (type $B (struct (field dataref)))
+ ;; CHECK: (type $B (struct (field (ref data))))
- ;; CHECK: (type $A (struct (field (ref null data))))
+ ;; CHECK: (type $A (struct (field dataref)))
(type $A (struct_subtype (field (ref null data)) data))
;; $B is a subtype of $A, and its field has a more refined type (it is non-
diff --git a/test/lit/passes/signature-refining.wast b/test/lit/passes/signature-refining.wast
index 67d076de7..b4951a387 100644
--- a/test/lit/passes/signature-refining.wast
+++ b/test/lit/passes/signature-refining.wast
@@ -74,14 +74,14 @@
;; CHECK: (type $struct (struct_subtype data))
(type $struct (struct_subtype data))
- ;; CHECK: (type $sig (func_subtype (param (ref null data)) func))
+ ;; CHECK: (type $sig (func_subtype (param dataref) func))
(type $sig (func_subtype (param anyref) func))
;; CHECK: (type $none_=>_none (func_subtype func))
;; CHECK: (elem declare func $func)
- ;; CHECK: (func $func (type $sig) (param $x (ref null data))
+ ;; CHECK: (func $func (type $sig) (param $x dataref)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
(func $func (type $sig) (param $x anyref)
@@ -356,7 +356,7 @@
;; CHECK: (type $struct (struct_subtype data))
(type $struct (struct_subtype data))
- ;; CHECK: (type $sig-1 (func_subtype (param (ref null data) anyref) func))
+ ;; CHECK: (type $sig-1 (func_subtype (param dataref anyref) func))
(type $sig-1 (func_subtype (param anyref) (param anyref) func))
;; CHECK: (type $sig-2 (func_subtype (param eqref (ref $struct)) func))
(type $sig-2 (func_subtype (param anyref) (param anyref) func))
@@ -365,7 +365,7 @@
;; CHECK: (elem declare func $func-2)
- ;; CHECK: (func $func-1 (type $sig-1) (param $x (ref null data)) (param $y anyref)
+ ;; CHECK: (func $func-1 (type $sig-1) (param $x dataref) (param $y anyref)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: )
(func $func-1 (type $sig-1) (param $x anyref) (param $y anyref)
@@ -379,8 +379,8 @@
;; CHECK: (func $caller (type $none_=>_none)
;; CHECK-NEXT: (local $any anyref)
- ;; CHECK-NEXT: (local $data (ref null data))
- ;; CHECK-NEXT: (local $i31 (ref null i31))
+ ;; CHECK-NEXT: (local $data dataref)
+ ;; CHECK-NEXT: (local $i31 i31ref)
;; CHECK-NEXT: (call $func-1
;; CHECK-NEXT: (struct.new_default $struct)
;; CHECK-NEXT: (local.get $data)
@@ -726,14 +726,14 @@
;; Do not modify the types used on imported functions (until the spec and VM
;; support becomes stable).
(module
- ;; CHECK: (type $ref?|data|_=>_none (func_subtype (param (ref null data)) func))
+ ;; CHECK: (type $dataref_=>_none (func_subtype (param dataref) func))
;; CHECK: (type $none_=>_none (func_subtype func))
;; CHECK: (type $struct (struct_subtype data))
(type $struct (struct_subtype data))
- ;; CHECK: (import "a" "b" (func $import (param (ref null data))))
+ ;; CHECK: (import "a" "b" (func $import (param dataref)))
(import "a" "b" (func $import (param (ref null data))))
;; CHECK: (func $test (type $none_=>_none)
diff --git a/test/lit/passes/simplify-locals-gc.wast b/test/lit/passes/simplify-locals-gc.wast
index a930cae08..821f0a862 100644
--- a/test/lit/passes/simplify-locals-gc.wast
+++ b/test/lit/passes/simplify-locals-gc.wast
@@ -13,15 +13,15 @@
;; NOMNL: (type $struct-immutable (struct_subtype (field i32) data))
(type $struct-immutable (struct (field i32)))
- ;; CHECK: (type $B (struct (field dataref)))
+ ;; CHECK: (type $B (struct (field (ref data))))
- ;; CHECK: (type $A (struct (field (ref null data))))
- ;; NOMNL: (type $A (struct_subtype (field (ref null data)) data))
+ ;; CHECK: (type $A (struct (field dataref)))
+ ;; NOMNL: (type $A (struct_subtype (field dataref) data))
(type $A (struct_subtype (field (ref null data)) data))
;; $B is a subtype of $A, and its field has a more refined type (it is non-
;; nullable).
- ;; NOMNL: (type $B (struct_subtype (field dataref) $A))
+ ;; NOMNL: (type $B (struct_subtype (field (ref data)) $A))
(type $B (struct_subtype (field (ref data)) $A))
;; Writes to heap objects cannot be reordered with reads.
diff --git a/test/lit/passes/type-refining-isorecursive.wast b/test/lit/passes/type-refining-isorecursive.wast
index eac3ba4b2..ae68a6dfb 100644
--- a/test/lit/passes/type-refining-isorecursive.wast
+++ b/test/lit/passes/type-refining-isorecursive.wast
@@ -9,7 +9,7 @@
(type $0 (struct_subtype (ref null any) anyref data))
;; CHECK: (type $1 (struct_subtype (field eqref) (field (ref $2)) data))
(type $1 (struct_subtype (ref null eq) anyref data))
- ;; CHECK: (type $2 (struct_subtype (field (ref null i31)) (field (ref $0)) data))
+ ;; CHECK: (type $2 (struct_subtype (field i31ref) (field (ref $0)) data))
(type $2 (struct_subtype (ref null i31) anyref data))
;; CHECK: (type $ref|$0|_ref|$1|_ref|$2|_=>_none (func_subtype (param (ref $0) (ref $1) (ref $2)) func))
@@ -69,7 +69,7 @@
(type $0 (struct_subtype (ref null any) anyref anyref data))
;; CHECK: (type $1 (struct_subtype (field eqref) (field (ref null $all)) (field (ref $0)) $0))
(type $1 (struct_subtype (ref null eq) anyref anyref $0))
- ;; CHECK: (type $2 (struct_subtype (field (ref null i31)) (field (ref null $all)) (field (ref $0)) $1))
+ ;; CHECK: (type $2 (struct_subtype (field i31ref) (field (ref null $all)) (field (ref $0)) $1))
(type $2 (struct_subtype (ref null i31) anyref anyref $1))
;; CHECK: (type $ref|$0|_ref|$1|_ref|$2|_=>_none (func_subtype (param (ref $0) (ref $1) (ref $2)) func))
diff --git a/test/lit/passes/type-refining.wast b/test/lit/passes/type-refining.wast
index ce305e8cc..6b56e56e9 100644
--- a/test/lit/passes/type-refining.wast
+++ b/test/lit/passes/type-refining.wast
@@ -5,7 +5,7 @@
;; A struct with three fields. The first will have no writes, the second one
;; write of the same type, and the last a write of a subtype, which will allow
;; us to specialize that one.
- ;; CHECK: (type $struct (struct_subtype (field (mut anyref)) (field (mut anyref)) (field (mut i31ref)) data))
+ ;; CHECK: (type $struct (struct_subtype (field (mut anyref)) (field (mut anyref)) (field (mut (ref i31))) data))
(type $struct (struct_subtype (field (mut anyref)) (field (mut anyref)) (field (mut anyref)) data))
;; CHECK: (type $ref|$struct|_=>_none (func_subtype (param (ref $struct)) func))
@@ -51,7 +51,7 @@
;; must keep the type nullable, unlike in the previous module, due to the
;; default value being null.
- ;; CHECK: (type $struct (struct_subtype (field (mut (ref null i31))) data))
+ ;; CHECK: (type $struct (struct_subtype (field (mut i31ref)) data))
(type $struct (struct_subtype (field (mut anyref)) data))
;; CHECK: (type $ref|$struct|_=>_none (func_subtype (param (ref $struct)) func))
@@ -655,7 +655,7 @@
)
(module
- ;; CHECK: (type $struct (struct_subtype (field (mut (ref null data))) data))
+ ;; CHECK: (type $struct (struct_subtype (field (mut dataref)) data))
(type $struct (struct_subtype (field (mut (ref null data))) data))
;; CHECK: (type $ref|$struct|_=>_none (func_subtype (param (ref $struct)) func))
diff --git a/test/lit/passes/vacuum-gc.wast b/test/lit/passes/vacuum-gc.wast
index 57b298443..8ec273332 100644
--- a/test/lit/passes/vacuum-gc.wast
+++ b/test/lit/passes/vacuum-gc.wast
@@ -72,8 +72,12 @@
)
)
- ;; CHECK: (func $drop-i31.get (param $ref i31ref) (param $ref-nn i31ref)
- ;; CHECK-NEXT: (nop)
+ ;; CHECK: (func $drop-i31.get (param $ref i31ref) (param $ref-nn (ref i31))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i31.get_s
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $drop-i31.get (param $ref i31ref) (param $ref-nn (ref i31))
;; A nullable get might trap, so only the second item can be removed.
diff --git a/test/passes/Oz_fuzz-exec_all-features.txt b/test/passes/Oz_fuzz-exec_all-features.txt
index 410bf37c1..981e8f8d2 100644
--- a/test/passes/Oz_fuzz-exec_all-features.txt
+++ b/test/passes/Oz_fuzz-exec_all-features.txt
@@ -204,7 +204,7 @@
)
(func $7 (; has Stack IR ;) (param $0 anyref)
(drop
- (block $data (result dataref)
+ (block $data (result (ref data))
(drop
(br_on_data $data
(local.get $0)
diff --git a/test/passes/merge-locals_all-features.txt b/test/passes/merge-locals_all-features.txt
index 8be43b60d..cf11edc91 100644
--- a/test/passes/merge-locals_all-features.txt
+++ b/test/passes/merge-locals_all-features.txt
@@ -459,8 +459,8 @@
)
(func $subtype-test
(local $0 anyref)
- (local $1 (ref null i31))
- (local $2 (ref null i31))
+ (local $1 i31ref)
+ (local $2 i31ref)
(local.set $0
(local.get $1)
)
diff --git a/test/passes/remove-unused-brs_all-features.txt b/test/passes/remove-unused-brs_all-features.txt
index 631c4ffe3..c340519f8 100644
--- a/test/passes/remove-unused-brs_all-features.txt
+++ b/test/passes/remove-unused-brs_all-features.txt
@@ -103,7 +103,7 @@
(i32.const 6)
)
(drop
- (block $i31 (result i31ref)
+ (block $i31 (result (ref i31))
(drop
(br $i31
(i31.new
@@ -136,7 +136,7 @@
)
(func $br_on-to-flow
(drop
- (block $data (result (ref null data))
+ (block $data (result dataref)
(drop
(ref.func $br_on-to-flow)
)
@@ -144,7 +144,7 @@
)
)
(drop
- (block $datab (result (ref null data))
+ (block $datab (result dataref)
(drop
(i31.new
(i32.const 1337)
@@ -174,7 +174,7 @@
)
)
(drop
- (block $i31 (result (ref null i31))
+ (block $i31 (result i31ref)
(drop
(array.new_default $vector
(i32.const 2)
@@ -184,7 +184,7 @@
)
)
(drop
- (block $i31b (result (ref null i31))
+ (block $i31b (result i31ref)
(drop
(ref.func $br_on-to-flow)
)
diff --git a/test/passes/simplify-locals_all-features.txt b/test/passes/simplify-locals_all-features.txt
index 2d84d3a7d..fb51e2fed 100644
--- a/test/passes/simplify-locals_all-features.txt
+++ b/test/passes/simplify-locals_all-features.txt
@@ -1900,11 +1900,11 @@
)
)
(module
- (type $eqref_ref?|i31|_=>_i32 (func (param eqref (ref null i31)) (result i32)))
+ (type $eqref_i31ref_=>_i32 (func (param eqref i31ref) (result i32)))
(export "test" (func $0))
- (func $0 (param $0 eqref) (param $1 (ref null i31)) (result i32)
+ (func $0 (param $0 eqref) (param $1 i31ref) (result i32)
(local $2 eqref)
- (local $3 (ref null i31))
+ (local $3 i31ref)
(local.set $2
(local.get $0)
)
diff --git a/test/passes/simplify-locals_all-features_disable-exception-handling.txt b/test/passes/simplify-locals_all-features_disable-exception-handling.txt
index f206cc42e..78e2804ac 100644
--- a/test/passes/simplify-locals_all-features_disable-exception-handling.txt
+++ b/test/passes/simplify-locals_all-features_disable-exception-handling.txt
@@ -1866,7 +1866,7 @@
(module
(type $none_=>_anyref (func (result anyref)))
(func $subtype-test (result anyref)
- (local $0 (ref null i31))
+ (local $0 i31ref)
(local $1 anyref)
(local $2 anyref)
(block
diff --git a/test/subtypes.wast.from-wast b/test/subtypes.wast.from-wast
index d7114ff20..88bd9b976 100644
--- a/test/subtypes.wast.from-wast
+++ b/test/subtypes.wast.from-wast
@@ -1,17 +1,17 @@
(module
(type $struct-rec-two (struct (field (ref $struct-rec-two)) (field (ref $struct-rec-two))))
(type $vector-i32 (array i32))
- (type $struct-i31 (struct (field i31ref)))
+ (type $struct-i31 (struct (field (ref i31))))
(type $struct-rec-one (struct (field (ref $struct-rec-one))))
(type $ref|$vector-i32|_ref?|$vector-i32|_=>_none (func (param (ref $vector-i32) (ref null $vector-i32))))
(type $ref|$vector-i31|_ref|$vector-any|_=>_none (func (param (ref $vector-i31) (ref $vector-any))))
(type $ref|$struct-i31|_ref|$struct-any|_=>_none (func (param (ref $struct-i31) (ref $struct-any))))
(type $ref|$struct-i31|_ref|$struct-i31_any|_=>_none (func (param (ref $struct-i31) (ref $struct-i31_any))))
(type $ref|$struct-rec-one|_ref|$struct-rec-two|_=>_none (func (param (ref $struct-rec-one) (ref $struct-rec-two))))
- (type $vector-i31 (array i31ref))
+ (type $vector-i31 (array (ref i31)))
(type $vector-any (array (ref any)))
(type $struct-any (struct (field (ref any))))
- (type $struct-i31_any (struct (field i31ref) (field (ref any))))
+ (type $struct-i31_any (struct (field (ref i31)) (field (ref any))))
(func $foo (param $no-null (ref $vector-i32)) (param $yes-null (ref null $vector-i32))
(local.set $yes-null
(local.get $no-null)
diff --git a/test/subtypes.wast.fromBinary b/test/subtypes.wast.fromBinary
index 893628554..6286fb527 100644
--- a/test/subtypes.wast.fromBinary
+++ b/test/subtypes.wast.fromBinary
@@ -1,17 +1,17 @@
(module
(type $struct-rec-two (struct (field (ref $struct-rec-two)) (field (ref $struct-rec-two))))
(type $vector-i32 (array i32))
- (type $struct-i31 (struct (field i31ref)))
+ (type $struct-i31 (struct (field (ref i31))))
(type $struct-rec-one (struct (field (ref $struct-rec-one))))
(type $ref|$vector-i32|_ref?|$vector-i32|_=>_none (func (param (ref $vector-i32) (ref null $vector-i32))))
(type $ref|$vector-i31|_ref|$vector-any|_=>_none (func (param (ref $vector-i31) (ref $vector-any))))
(type $ref|$struct-i31|_ref|$struct-any|_=>_none (func (param (ref $struct-i31) (ref $struct-any))))
(type $ref|$struct-i31|_ref|$struct-i31_any|_=>_none (func (param (ref $struct-i31) (ref $struct-i31_any))))
(type $ref|$struct-rec-one|_ref|$struct-rec-two|_=>_none (func (param (ref $struct-rec-one) (ref $struct-rec-two))))
- (type $vector-i31 (array i31ref))
+ (type $vector-i31 (array (ref i31)))
(type $vector-any (array (ref any)))
(type $struct-any (struct (field (ref any))))
- (type $struct-i31_any (struct (field i31ref) (field (ref any))))
+ (type $struct-i31_any (struct (field (ref i31)) (field (ref any))))
(func $foo (param $no-null (ref $vector-i32)) (param $yes-null (ref null $vector-i32))
(local.set $yes-null
(local.get $no-null)
diff --git a/test/subtypes.wast.fromBinary.noDebugInfo b/test/subtypes.wast.fromBinary.noDebugInfo
index b275da619..210e9ab8c 100644
--- a/test/subtypes.wast.fromBinary.noDebugInfo
+++ b/test/subtypes.wast.fromBinary.noDebugInfo
@@ -1,33 +1,33 @@
(module
(type ${ref|...0|_ref|...0|} (struct (field (ref ${ref|...0|_ref|...0|})) (field (ref ${ref|...0|_ref|...0|}))))
(type $[i32] (array i32))
- (type ${i31ref} (struct (field i31ref)))
+ (type ${ref|i31|} (struct (field (ref i31))))
(type ${ref|...0|} (struct (field (ref ${ref|...0|}))))
(type $ref|[i32]|_ref?|[i32]|_=>_none (func (param (ref $[i32]) (ref null $[i32]))))
- (type $ref|[i31ref]|_ref|[ref|any|]|_=>_none (func (param (ref $[i31ref]) (ref $[ref|any|]))))
- (type $ref|{i31ref}|_ref|{ref|any|}|_=>_none (func (param (ref ${i31ref}) (ref ${ref|any|}))))
- (type $ref|{i31ref}|_ref|{i31ref_ref|any|}|_=>_none (func (param (ref ${i31ref}) (ref ${i31ref_ref|any|}))))
+ (type $ref|[ref|i31|]|_ref|[ref|any|]|_=>_none (func (param (ref $[ref|i31|]) (ref $[ref|any|]))))
+ (type $ref|{ref|i31|}|_ref|{ref|any|}|_=>_none (func (param (ref ${ref|i31|}) (ref ${ref|any|}))))
+ (type $ref|{ref|i31|}|_ref|{ref|i31|_ref|any|}|_=>_none (func (param (ref ${ref|i31|}) (ref ${ref|i31|_ref|any|}))))
(type $ref|{ref|...0|}|_ref|{ref|...0|_ref|...0|}|_=>_none (func (param (ref ${ref|...0|}) (ref ${ref|...0|_ref|...0|}))))
- (type $[i31ref] (array i31ref))
+ (type $[ref|i31|] (array (ref i31)))
(type $[ref|any|] (array (ref any)))
(type ${ref|any|} (struct (field (ref any))))
- (type ${i31ref_ref|any|} (struct (field i31ref) (field (ref any))))
+ (type ${ref|i31|_ref|any|} (struct (field (ref i31)) (field (ref any))))
(func $0 (param $0 (ref $[i32])) (param $1 (ref null $[i32]))
(local.set $1
(local.get $0)
)
)
- (func $1 (param $0 (ref $[i31ref])) (param $1 (ref $[ref|any|]))
+ (func $1 (param $0 (ref $[ref|i31|])) (param $1 (ref $[ref|any|]))
(local.set $1
(local.get $0)
)
)
- (func $2 (param $0 (ref ${i31ref})) (param $1 (ref ${ref|any|}))
+ (func $2 (param $0 (ref ${ref|i31|})) (param $1 (ref ${ref|any|}))
(local.set $1
(local.get $0)
)
)
- (func $3 (param $0 (ref ${i31ref})) (param $1 (ref ${i31ref_ref|any|}))
+ (func $3 (param $0 (ref ${ref|i31|})) (param $1 (ref ${ref|i31|_ref|any|}))
(local.set $0
(local.get $1)
)