From e105a660721a0e18ca83ae4ea8117c84a4532b06 Mon Sep 17 00:00:00 2001 From: Dmitry Sinyavin Date: Mon, 3 Apr 2023 13:57:22 +0100 Subject: [PATCH 1/3] Expose WASM extensions in executor semantics --- client/executor/src/wasm_runtime.rs | 7 +++++ client/executor/wasmtime/src/runtime.rs | 35 ++++++++++++++++++++----- client/executor/wasmtime/src/tests.rs | 14 ++++++++++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/client/executor/src/wasm_runtime.rs b/client/executor/src/wasm_runtime.rs index 254380dbb3693..c970c88ff0789 100644 --- a/client/executor/src/wasm_runtime.rs +++ b/client/executor/src/wasm_runtime.rs @@ -326,6 +326,13 @@ where deterministic_stack_limit: None, canonicalize_nans: false, parallel_compilation: true, + wasm_multi_value: false, + wasm_bulk_memory: false, + wasm_reference_types: false, + wasm_simd: false, + wasm_threads: false, + wasm_multi_memory: false, + wasm_memory64: false, }, }, ) diff --git a/client/executor/wasmtime/src/runtime.rs b/client/executor/wasmtime/src/runtime.rs index de7a2ea0e73df..b6c39183638de 100644 --- a/client/executor/wasmtime/src/runtime.rs +++ b/client/executor/wasmtime/src/runtime.rs @@ -325,13 +325,13 @@ fn common_config(semantics: &Semantics) -> std::result::Result (true, true), @@ -504,6 +504,27 @@ pub struct Semantics { /// The heap allocation strategy to use. pub heap_alloc_strategy: HeapAllocStrategy, + + /// Enables WASM Multi-Value proposal + pub wasm_multi_value: bool, + + /// Enables WASM Bulk Memory Operations proposal + pub wasm_bulk_memory: bool, + + /// Enables WASM Reference Types proposal + pub wasm_reference_types: bool, + + /// Enables WASM Fixed-Width SIMD proposal + pub wasm_simd: bool, + + /// Enables WASM Threads and Atomics proposal + pub wasm_threads: bool, + + /// Enables WASM Multi-Memory proposal + pub wasm_multi_memory: bool, + + /// Enables WASM Memory64 proposal + pub wasm_memory64: bool, } #[derive(Clone)] diff --git a/client/executor/wasmtime/src/tests.rs b/client/executor/wasmtime/src/tests.rs index 7f222b6cf7c05..d92a610ceefa0 100644 --- a/client/executor/wasmtime/src/tests.rs +++ b/client/executor/wasmtime/src/tests.rs @@ -155,6 +155,13 @@ impl RuntimeBuilder { canonicalize_nans: self.canonicalize_nans, parallel_compilation: true, heap_alloc_strategy: self.heap_pages, + wasm_multi_value: false, + wasm_bulk_memory: false, + wasm_reference_types: false, + wasm_simd: false, + wasm_threads: false, + wasm_multi_memory: false, + wasm_memory64: false, }, }; @@ -474,6 +481,13 @@ fn test_instances_without_reuse_are_not_leaked() { canonicalize_nans: false, parallel_compilation: true, heap_alloc_strategy: HeapAllocStrategy::Static { extra_pages: 2048 }, + wasm_multi_value: false, + wasm_bulk_memory: false, + wasm_reference_types: false, + wasm_simd: false, + wasm_threads: false, + wasm_multi_memory: false, + wasm_memory64: false, }, }, ) From ff2dfd992e99cb7ba669c5d4712e17f8c29d430d Mon Sep 17 00:00:00 2001 From: Dmitry Sinyavin Date: Mon, 3 Apr 2023 14:25:32 +0100 Subject: [PATCH 2/3] Fix benches --- client/executor/benches/bench.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/executor/benches/bench.rs b/client/executor/benches/bench.rs index 10425ea461c21..d5dea4abb3c00 100644 --- a/client/executor/benches/bench.rs +++ b/client/executor/benches/bench.rs @@ -72,6 +72,13 @@ fn initialize( deterministic_stack_limit: None, canonicalize_nans: false, parallel_compilation: true, + wasm_multi_value: false, + wasm_bulk_memory: false, + wasm_reference_types: false, + wasm_simd: false, + wasm_threads: false, + wasm_multi_memory: false, + wasm_memory64: false, }, }; From bd94cb53c99d3b18c41ecc84af007f5a0c058f20 Mon Sep 17 00:00:00 2001 From: Dmitry Sinyavin Date: Mon, 3 Apr 2023 16:04:47 +0100 Subject: [PATCH 3/3] Remove redundant extensions --- client/executor/benches/bench.rs | 3 --- client/executor/src/wasm_runtime.rs | 3 --- client/executor/wasmtime/src/runtime.rs | 15 +++------------ client/executor/wasmtime/src/tests.rs | 6 ------ 4 files changed, 3 insertions(+), 24 deletions(-) diff --git a/client/executor/benches/bench.rs b/client/executor/benches/bench.rs index d5dea4abb3c00..f129ebf64de12 100644 --- a/client/executor/benches/bench.rs +++ b/client/executor/benches/bench.rs @@ -76,9 +76,6 @@ fn initialize( wasm_bulk_memory: false, wasm_reference_types: false, wasm_simd: false, - wasm_threads: false, - wasm_multi_memory: false, - wasm_memory64: false, }, }; diff --git a/client/executor/src/wasm_runtime.rs b/client/executor/src/wasm_runtime.rs index c970c88ff0789..fb3dd0f38006c 100644 --- a/client/executor/src/wasm_runtime.rs +++ b/client/executor/src/wasm_runtime.rs @@ -330,9 +330,6 @@ where wasm_bulk_memory: false, wasm_reference_types: false, wasm_simd: false, - wasm_threads: false, - wasm_multi_memory: false, - wasm_memory64: false, }, }, ) diff --git a/client/executor/wasmtime/src/runtime.rs b/client/executor/wasmtime/src/runtime.rs index b6c39183638de..e01a51f6cf2a7 100644 --- a/client/executor/wasmtime/src/runtime.rs +++ b/client/executor/wasmtime/src/runtime.rs @@ -329,9 +329,9 @@ fn common_config(semantics: &Semantics) -> std::result::Result (true, true), @@ -516,15 +516,6 @@ pub struct Semantics { /// Enables WASM Fixed-Width SIMD proposal pub wasm_simd: bool, - - /// Enables WASM Threads and Atomics proposal - pub wasm_threads: bool, - - /// Enables WASM Multi-Memory proposal - pub wasm_multi_memory: bool, - - /// Enables WASM Memory64 proposal - pub wasm_memory64: bool, } #[derive(Clone)] diff --git a/client/executor/wasmtime/src/tests.rs b/client/executor/wasmtime/src/tests.rs index d92a610ceefa0..0ca6095165572 100644 --- a/client/executor/wasmtime/src/tests.rs +++ b/client/executor/wasmtime/src/tests.rs @@ -159,9 +159,6 @@ impl RuntimeBuilder { wasm_bulk_memory: false, wasm_reference_types: false, wasm_simd: false, - wasm_threads: false, - wasm_multi_memory: false, - wasm_memory64: false, }, }; @@ -485,9 +482,6 @@ fn test_instances_without_reuse_are_not_leaked() { wasm_bulk_memory: false, wasm_reference_types: false, wasm_simd: false, - wasm_threads: false, - wasm_multi_memory: false, - wasm_memory64: false, }, }, )