summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-01-03 13:36:27 -0800
committerGitHub <noreply@github.com>2024-01-03 13:36:27 -0800
commitc923521a61205dd2358201e311b009886e095381 (patch)
tree4c28cc0bca3b82f74586aa7009d20835a9455a17
parenta6bc9542e98b4164d3a26c67c94b1136b4fc8b86 (diff)
downloadbinaryen-c923521a61205dd2358201e311b009886e095381.tar.gz
binaryen-c923521a61205dd2358201e311b009886e095381.tar.bz2
binaryen-c923521a61205dd2358201e311b009886e095381.zip
Drop support for type annotations on array.len (#6197)
These type annotations were removed during the development of the GC proposal, but we maintained support for parsing them to ease the transition. Now that GC is shipped, remove support for the non-standard annotation and update our tests accordingly.
-rw-r--r--src/wasm/wasm-s-parser.cpp9
-rw-r--r--test/lit/arrays.wast7
-rw-r--r--test/lit/passes/gufa-refs.wast2
-rw-r--r--test/lit/passes/gufa-tnh.wast2
-rw-r--r--test/lit/passes/optimize-instructions-gc.wast2
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.wast4
-rw-r--r--test/spec/array.wast2
7 files changed, 10 insertions, 18 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 42785e40e..9f5f412be 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -3160,14 +3160,7 @@ Expression* SExpressionWasmBuilder::makeArraySet(Element& s) {
}
Expression* SExpressionWasmBuilder::makeArrayLen(Element& s) {
- // There may or may not be a type annotation.
- Index i = 1;
- try {
- parseHeapType(*s[i]);
- ++i;
- } catch (...) {
- }
- auto ref = parseExpression(*s[i]);
+ auto ref = parseExpression(*s[1]);
return Builder(wasm).makeArrayLen(ref);
}
diff --git a/test/lit/arrays.wast b/test/lit/arrays.wast
index 47338fdf1..4dde528cf 100644
--- a/test/lit/arrays.wast
+++ b/test/lit/arrays.wast
@@ -60,8 +60,7 @@
;; ROUNDTRIP-NEXT: )
;; ROUNDTRIP-NEXT: )
(func $len (param $a (ref array)) (result i32)
- ;; TODO: remove the unused type annotation
- (array.len $byte-array
+ (array.len
(local.get $a)
)
)
@@ -77,7 +76,7 @@
;; ROUNDTRIP-NEXT: )
;; ROUNDTRIP-NEXT: )
(func $impossible-len (param $none nullref) (result i32)
- (array.len $byte-array
+ (array.len
(local.get $none)
)
)
@@ -91,7 +90,7 @@
;; ROUNDTRIP-NEXT: (unreachable)
;; ROUNDTRIP-NEXT: )
(func $unreachable-len (param $a arrayref) (result i32)
- (array.len $byte-array
+ (array.len
(unreachable)
)
)
diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast
index a99df47e0..6aa741eb1 100644
--- a/test/lit/passes/gufa-refs.wast
+++ b/test/lit/passes/gufa-refs.wast
@@ -4153,7 +4153,7 @@
;; CHECK-NEXT: )
(func $arrays (param $B (ref $B))
(drop
- (array.len $B
+ (array.len
(array.new_fixed $B 2
(ref.null none)
(ref.null none)
diff --git a/test/lit/passes/gufa-tnh.wast b/test/lit/passes/gufa-tnh.wast
index 3a9c77a30..b3d5b122b 100644
--- a/test/lit/passes/gufa-tnh.wast
+++ b/test/lit/passes/gufa-tnh.wast
@@ -1803,7 +1803,7 @@
(i32.const 3)
)
(drop
- (array.len $B
+ (array.len
(local.get $array.len)
)
)
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast
index cbf44aee4..cb732d68b 100644
--- a/test/lit/passes/optimize-instructions-gc.wast
+++ b/test/lit/passes/optimize-instructions-gc.wast
@@ -366,7 +366,7 @@
)
)
(drop
- (array.len $array
+ (array.len
(ref.as_non_null
(local.get $y)
)
diff --git a/test/passes/Oz_fuzz-exec_all-features.wast b/test/passes/Oz_fuzz-exec_all-features.wast
index 83cee56e8..1d2b106b7 100644
--- a/test/passes/Oz_fuzz-exec_all-features.wast
+++ b/test/passes/Oz_fuzz-exec_all-features.wast
@@ -52,7 +52,7 @@
)
;; The length should be 50
(call $log
- (array.len $bytes (local.get $x))
+ (array.len (local.get $x))
)
;; The value should be 42
(call $log
@@ -281,7 +281,7 @@
)
;; The length should be 2
(call $log
- (array.len $bytes (local.get $x))
+ (array.len (local.get $x))
)
;; The first value should be 42
(call $log
diff --git a/test/spec/array.wast b/test/spec/array.wast
index 6e7b8cddb..d9b75e287 100644
--- a/test/spec/array.wast
+++ b/test/spec/array.wast
@@ -83,7 +83,7 @@
)
(func $len (param $v (ref $vec)) (result i32)
- (array.len $vec (local.get $v))
+ (array.len (local.get $v))
)
(func (export "len") (result i32)
(call $len (array.new_default $vec (i32.const 3)))