Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for type annotations on array.len #6197

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/wasm/wasm-s-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
7 changes: 3 additions & 4 deletions test/lit/arrays.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
)
Expand All @@ -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)
)
)
Expand All @@ -91,7 +90,7 @@
;; ROUNDTRIP-NEXT: (unreachable)
;; ROUNDTRIP-NEXT: )
(func $unreachable-len (param $a arrayref) (result i32)
(array.len $byte-array
(array.len
(unreachable)
)
)
Expand Down
2 changes: 1 addition & 1 deletion test/lit/passes/gufa-refs.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/lit/passes/gufa-tnh.wast
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,7 @@
(i32.const 3)
)
(drop
(array.len $B
(array.len
(local.get $array.len)
)
)
Expand Down
2 changes: 1 addition & 1 deletion test/lit/passes/optimize-instructions-gc.wast
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
)
)
(drop
(array.len $array
(array.len
(ref.as_non_null
(local.get $y)
)
Expand Down
4 changes: 2 additions & 2 deletions test/passes/Oz_fuzz-exec_all-features.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/spec/array.wast
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
Loading