Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit f6f7ced

Browse files
s0me0ne-unkn0wngpestana
authored andcommitted
Expose WASM extensions in executor semantics (#13811)
* Expose WASM extensions in executor semantics * Fix benches * Remove redundant extensions
1 parent ee40229 commit f6f7ced

4 files changed

Lines changed: 32 additions & 4 deletions

File tree

client/executor/benches/bench.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ fn initialize(
7272
deterministic_stack_limit: None,
7373
canonicalize_nans: false,
7474
parallel_compilation: true,
75+
wasm_multi_value: false,
76+
wasm_bulk_memory: false,
77+
wasm_reference_types: false,
78+
wasm_simd: false,
7579
},
7680
};
7781

client/executor/src/wasm_runtime.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ where
326326
deterministic_stack_limit: None,
327327
canonicalize_nans: false,
328328
parallel_compilation: true,
329+
wasm_multi_value: false,
330+
wasm_bulk_memory: false,
331+
wasm_reference_types: false,
332+
wasm_simd: false,
329333
},
330334
},
331335
)

client/executor/wasmtime/src/runtime.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,10 @@ fn common_config(semantics: &Semantics) -> std::result::Result<wasmtime::Config,
325325

326326
// Be clear and specific about the extensions we support. If an update brings new features
327327
// they should be introduced here as well.
328-
config.wasm_reference_types(false);
329-
config.wasm_simd(false);
330-
config.wasm_bulk_memory(false);
331-
config.wasm_multi_value(false);
328+
config.wasm_reference_types(semantics.wasm_reference_types);
329+
config.wasm_simd(semantics.wasm_simd);
330+
config.wasm_bulk_memory(semantics.wasm_bulk_memory);
331+
config.wasm_multi_value(semantics.wasm_multi_value);
332332
config.wasm_multi_memory(false);
333333
config.wasm_threads(false);
334334
config.wasm_memory64(false);
@@ -504,6 +504,18 @@ pub struct Semantics {
504504

505505
/// The heap allocation strategy to use.
506506
pub heap_alloc_strategy: HeapAllocStrategy,
507+
508+
/// Enables WASM Multi-Value proposal
509+
pub wasm_multi_value: bool,
510+
511+
/// Enables WASM Bulk Memory Operations proposal
512+
pub wasm_bulk_memory: bool,
513+
514+
/// Enables WASM Reference Types proposal
515+
pub wasm_reference_types: bool,
516+
517+
/// Enables WASM Fixed-Width SIMD proposal
518+
pub wasm_simd: bool,
507519
}
508520

509521
#[derive(Clone)]

client/executor/wasmtime/src/tests.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ impl RuntimeBuilder {
155155
canonicalize_nans: self.canonicalize_nans,
156156
parallel_compilation: true,
157157
heap_alloc_strategy: self.heap_pages,
158+
wasm_multi_value: false,
159+
wasm_bulk_memory: false,
160+
wasm_reference_types: false,
161+
wasm_simd: false,
158162
},
159163
};
160164

@@ -474,6 +478,10 @@ fn test_instances_without_reuse_are_not_leaked() {
474478
canonicalize_nans: false,
475479
parallel_compilation: true,
476480
heap_alloc_strategy: HeapAllocStrategy::Static { extra_pages: 2048 },
481+
wasm_multi_value: false,
482+
wasm_bulk_memory: false,
483+
wasm_reference_types: false,
484+
wasm_simd: false,
477485
},
478486
},
479487
)

0 commit comments

Comments
 (0)