From 36bb145c5f50d0b39453f4297a1ac80bedac5a91 Mon Sep 17 00:00:00 2001 From: Rikito Taniguchi Date: Fri, 31 May 2024 17:04:18 +0900 Subject: [PATCH] Test binary parser parses declarative element segment with `init` as `vec(expr)` This commit adds a binary for `wasm-dis` that is generated from the following WAT file with a reference-interpreter from the `wasm-3.0+exn` branch: https://github.com/WebAssembly/spec/commit/b16745e41a20024ee5446574da52a22849177596 ```wat (module (elem declare funcref (item ref.func $f)) (func $f (block (ref.func $f) (drop) )) ) ``` The generated `.fromBinary` contains `(elem declare func $f)` instead of `(elem declare funcref (item ref.func $f))` because the parser doesn't preserve declarative segments. This is fine, as we test that the binary parser can parse the declarative element segment whose `init` is `vec(expr)` without trapping. --- test/declarative-element-use-expr.wasm | Bin 0 -> 59 bytes test/declarative-element-use-expr.wasm.fromBinary | 11 +++++++++++ 2 files changed, 11 insertions(+) create mode 100644 test/declarative-element-use-expr.wasm create mode 100644 test/declarative-element-use-expr.wasm.fromBinary diff --git a/test/declarative-element-use-expr.wasm b/test/declarative-element-use-expr.wasm new file mode 100644 index 0000000000000000000000000000000000000000..54ebc37d4524bc37d93fe0fd2b046e67cf1c677d GIT binary patch literal 59 zcmZQbEY4+QU|?WuX=rF*U`$|OU~U4l7&zO(GPL^3crTw;*o<^}+% CiVk`J literal 0 HcmV?d00001 diff --git a/test/declarative-element-use-expr.wasm.fromBinary b/test/declarative-element-use-expr.wasm.fromBinary new file mode 100644 index 00000000000..974faafe299 --- /dev/null +++ b/test/declarative-element-use-expr.wasm.fromBinary @@ -0,0 +1,11 @@ +(module + (type $0 (func)) + (func $0 + (block $label$1 + (drop + (ref.func $0) + ) + ) + ) +) +