Skip to content

Commit 0afab1e

Browse files
committed
Drop support for type annotations on array.len
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.
1 parent a6bc954 commit 0afab1e

File tree

7 files changed

+10
-18
lines changed

7 files changed

+10
-18
lines changed

src/wasm/wasm-s-parser.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,14 +3160,7 @@ Expression* SExpressionWasmBuilder::makeArraySet(Element& s) {
31603160
}
31613161

31623162
Expression* SExpressionWasmBuilder::makeArrayLen(Element& s) {
3163-
// There may or may not be a type annotation.
3164-
Index i = 1;
3165-
try {
3166-
parseHeapType(*s[i]);
3167-
++i;
3168-
} catch (...) {
3169-
}
3170-
auto ref = parseExpression(*s[i]);
3163+
auto ref = parseExpression(*s[1]);
31713164
return Builder(wasm).makeArrayLen(ref);
31723165
}
31733166

test/lit/arrays.wast

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@
6060
;; ROUNDTRIP-NEXT: )
6161
;; ROUNDTRIP-NEXT: )
6262
(func $len (param $a (ref array)) (result i32)
63-
;; TODO: remove the unused type annotation
64-
(array.len $byte-array
63+
(array.len
6564
(local.get $a)
6665
)
6766
)
@@ -77,7 +76,7 @@
7776
;; ROUNDTRIP-NEXT: )
7877
;; ROUNDTRIP-NEXT: )
7978
(func $impossible-len (param $none nullref) (result i32)
80-
(array.len $byte-array
79+
(array.len
8180
(local.get $none)
8281
)
8382
)
@@ -91,7 +90,7 @@
9190
;; ROUNDTRIP-NEXT: (unreachable)
9291
;; ROUNDTRIP-NEXT: )
9392
(func $unreachable-len (param $a arrayref) (result i32)
94-
(array.len $byte-array
93+
(array.len
9594
(unreachable)
9695
)
9796
)

test/lit/passes/gufa-refs.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4153,7 +4153,7 @@
41534153
;; CHECK-NEXT: )
41544154
(func $arrays (param $B (ref $B))
41554155
(drop
4156-
(array.len $B
4156+
(array.len
41574157
(array.new_fixed $B 2
41584158
(ref.null none)
41594159
(ref.null none)

test/lit/passes/gufa-tnh.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@
18031803
(i32.const 3)
18041804
)
18051805
(drop
1806-
(array.len $B
1806+
(array.len
18071807
(local.get $array.len)
18081808
)
18091809
)

test/lit/passes/optimize-instructions-gc.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@
366366
)
367367
)
368368
(drop
369-
(array.len $array
369+
(array.len
370370
(ref.as_non_null
371371
(local.get $y)
372372
)

test/passes/Oz_fuzz-exec_all-features.wast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
)
5353
;; The length should be 50
5454
(call $log
55-
(array.len $bytes (local.get $x))
55+
(array.len (local.get $x))
5656
)
5757
;; The value should be 42
5858
(call $log
@@ -281,7 +281,7 @@
281281
)
282282
;; The length should be 2
283283
(call $log
284-
(array.len $bytes (local.get $x))
284+
(array.len (local.get $x))
285285
)
286286
;; The first value should be 42
287287
(call $log

test/spec/array.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
)
8484

8585
(func $len (param $v (ref $vec)) (result i32)
86-
(array.len $vec (local.get $v))
86+
(array.len (local.get $v))
8787
)
8888
(func (export "len") (result i32)
8989
(call $len (array.new_default $vec (i32.const 3)))

0 commit comments

Comments
 (0)