From 5ca47ee97a06c1b76bbdd58b50efd7016da2b020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 22 Nov 2024 00:46:23 +0000 Subject: [PATCH] fix: support non-function exports in Wasm modules (#26992) Closes https://github.com/denoland/deno/issues/26986 --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- .../wasm_module/table_global_memory/__test__.jsonc | 4 ++++ .../run/wasm_module/table_global_memory/main.js | 2 ++ .../run/wasm_module/table_global_memory/main.out | 7 +++++++ .../run/wasm_module/table_global_memory/mod.wasm | Bin 0 -> 80 bytes .../run/wasm_module/table_global_memory/mod.wat | 6 ++++++ 7 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 tests/specs/run/wasm_module/table_global_memory/__test__.jsonc create mode 100644 tests/specs/run/wasm_module/table_global_memory/main.js create mode 100644 tests/specs/run/wasm_module/table_global_memory/main.out create mode 100644 tests/specs/run/wasm_module/table_global_memory/mod.wasm create mode 100644 tests/specs/run/wasm_module/table_global_memory/mod.wat diff --git a/Cargo.lock b/Cargo.lock index 798bb24057..7947106e66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1466,9 +1466,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.321.0" +version = "0.322.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd2a54cda74cdc187d5fc2d23370a45cf09f912caf566dd1cd24a50157d809c7" +checksum = "2f593ef2b8acab8cd3ace9d50052edc65a3654fdbde808070cfa5da5cf7aaae6" dependencies = [ "anyhow", "bincode", @@ -1983,9 +1983,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.197.0" +version = "0.198.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a8825d92301cf445727c43f17fee2a20fcdf4370004339965156ae7c56c97e" +checksum = "870826735cd9aa0376d2aadca14365b753e830e3cc16891efb9232845a6982a4" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -6666,9 +6666,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.230.0" +version = "0.231.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a783242d2af51d6955cc04bf2b64adb643ab588b61e9573c908a69dabf8c2f" +checksum = "1a0c48b8842ebae21c52da1d978fba5c2be5991680bddfdc1a36ee0ccbc60114" dependencies = [ "num-bigint", "serde", diff --git a/Cargo.toml b/Cargo.toml index 987c291fcf..f72d3c80d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ repository = "https://github.com/denoland/deno" [workspace.dependencies] deno_ast = { version = "=0.43.3", features = ["transpiling"] } -deno_core = { version = "0.321.0" } +deno_core = { version = "0.322.0" } deno_bench_util = { version = "0.173.0", path = "./bench_util" } deno_config = { version = "=0.39.2", features = ["workspace", "sync"] } diff --git a/tests/specs/run/wasm_module/table_global_memory/__test__.jsonc b/tests/specs/run/wasm_module/table_global_memory/__test__.jsonc new file mode 100644 index 0000000000..1dbb89a020 --- /dev/null +++ b/tests/specs/run/wasm_module/table_global_memory/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "run --check main.js", + "output": "main.out" +} diff --git a/tests/specs/run/wasm_module/table_global_memory/main.js b/tests/specs/run/wasm_module/table_global_memory/main.js new file mode 100644 index 0000000000..a5ff412a92 --- /dev/null +++ b/tests/specs/run/wasm_module/table_global_memory/main.js @@ -0,0 +1,2 @@ +import * as wasm from "./mod.wasm"; +console.log(wasm); diff --git a/tests/specs/run/wasm_module/table_global_memory/main.out b/tests/specs/run/wasm_module/table_global_memory/main.out new file mode 100644 index 0000000000..81a5b4b47c --- /dev/null +++ b/tests/specs/run/wasm_module/table_global_memory/main.out @@ -0,0 +1,7 @@ +Check [WILDCARD] +[Module: null prototype] { + func: [Function: 0], + global: Global [WebAssembly.Global] {}, + memory: Memory [WebAssembly.Memory] {}, + table: Table [WebAssembly.Table] {} +} diff --git a/tests/specs/run/wasm_module/table_global_memory/mod.wasm b/tests/specs/run/wasm_module/table_global_memory/mod.wasm new file mode 100644 index 0000000000000000000000000000000000000000..a99e01c5dc23e9d59fbc0c399fe5343f233dde95 GIT binary patch literal 80 zcmWN_yAgmO5Cy>ZyyKjaF6_ik1P4t(96y1Pt;>dsa1{ceat5R$RCxeS+M4mh1mBOU b>$5Md?+|k$tfW%Uw}WlD#*hVrqX7N~p~ws^ literal 0 HcmV?d00001 diff --git a/tests/specs/run/wasm_module/table_global_memory/mod.wat b/tests/specs/run/wasm_module/table_global_memory/mod.wat new file mode 100644 index 0000000000..d2a92f0ac1 --- /dev/null +++ b/tests/specs/run/wasm_module/table_global_memory/mod.wat @@ -0,0 +1,6 @@ +(module + (func (export "func") unreachable) + (table (export "table") 0 funcref) + (memory (export "memory") 0) + (global (export "global") i32 i32.const 0) +)