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

Expose WASM extensions in executor semantics #13811

Merged
merged 3 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Comment on lines 332 to 334
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these not exposed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. A comment would have been nice, but it's too late now for my nits. 😛

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