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

Commit

Permalink
Expose WASM extensions in executor semantics (#13811)
Browse files Browse the repository at this point in the history
* Expose WASM extensions in executor semantics

* Fix benches

* Remove redundant extensions
  • Loading branch information
s0me0ne-unkn0wn authored and gpestana committed Apr 20, 2023
1 parent ee40229 commit f6f7ced
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
4 changes: 4 additions & 0 deletions client/executor/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ 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,
},
};

Expand Down
4 changes: 4 additions & 0 deletions client/executor/src/wasm_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ 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,
},
},
)
Expand Down
20 changes: 16 additions & 4 deletions client/executor/wasmtime/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ fn common_config(semantics: &Semantics) -> std::result::Result<wasmtime::Config,

// Be clear and specific about the extensions we support. If an update brings new features
// they should be introduced here as well.
config.wasm_reference_types(false);
config.wasm_simd(false);
config.wasm_bulk_memory(false);
config.wasm_multi_value(false);
config.wasm_reference_types(semantics.wasm_reference_types);
config.wasm_simd(semantics.wasm_simd);
config.wasm_bulk_memory(semantics.wasm_bulk_memory);
config.wasm_multi_value(semantics.wasm_multi_value);
config.wasm_multi_memory(false);
config.wasm_threads(false);
config.wasm_memory64(false);
Expand Down Expand Up @@ -504,6 +504,18 @@ 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,
}

#[derive(Clone)]
Expand Down
8 changes: 8 additions & 0 deletions client/executor/wasmtime/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ 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,
},
};

Expand Down Expand Up @@ -474,6 +478,10 @@ 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,
},
},
)
Expand Down

0 comments on commit f6f7ced

Please sign in to comment.