Enable reference types and bulk memory operations by default
This commit is contained in:
@@ -94,8 +94,8 @@ impl Config {
|
|||||||
memory_creator: None,
|
memory_creator: None,
|
||||||
max_wasm_stack: 1 << 20,
|
max_wasm_stack: 1 << 20,
|
||||||
wasm_threads: false,
|
wasm_threads: false,
|
||||||
wasm_reference_types: false,
|
wasm_reference_types: cfg!(target_arch = "x86_64"),
|
||||||
wasm_bulk_memory: false,
|
wasm_bulk_memory: true,
|
||||||
wasm_simd: false,
|
wasm_simd: false,
|
||||||
wasm_multi_value: true,
|
wasm_multi_value: true,
|
||||||
}
|
}
|
||||||
@@ -170,25 +170,17 @@ impl Config {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Configures whether the WebAssembly reference types proposal will be
|
/// Configures whether the [WebAssembly reference types proposal][proposal]
|
||||||
/// enabled for compilation.
|
/// will be enabled for compilation.
|
||||||
///
|
///
|
||||||
/// The [WebAssembly reference types proposal][proposal] is not currently
|
/// This feature gates items such as the `externref` and `funcref` types as
|
||||||
/// fully standardized and is undergoing development. Additionally the
|
/// well as allowing a module to define multiple tables.
|
||||||
/// support in wasmtime itself is still being worked on. Support for this
|
|
||||||
/// feature can be enabled through this method for appropriate wasm
|
|
||||||
/// modules.
|
|
||||||
///
|
///
|
||||||
/// This feature gates items such as the `externref` type and multiple tables
|
/// Note that enabling the reference types feature will also enable the bulk
|
||||||
/// being in a module. Note that enabling the reference types feature will
|
/// memory feature.
|
||||||
/// also enable the bulk memory feature.
|
|
||||||
///
|
///
|
||||||
/// This is `false` by default.
|
/// This is `true` by default on x86-64, and `false` by default on other
|
||||||
///
|
/// architectures.
|
||||||
/// > **Note**: Wasmtime does not implement everything for the reference
|
|
||||||
/// > types proposal spec at this time, so bugs, panics, and possibly
|
|
||||||
/// > segfaults should be expected. This should not be enabled in a
|
|
||||||
/// > production setting right now.
|
|
||||||
///
|
///
|
||||||
/// [proposal]: https://github.com/webassembly/reference-types
|
/// [proposal]: https://github.com/webassembly/reference-types
|
||||||
pub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self {
|
pub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self {
|
||||||
@@ -235,19 +227,13 @@ impl Config {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Configures whether the WebAssembly bulk memory operations proposal will
|
/// Configures whether the [WebAssembly bulk memory operations
|
||||||
/// be enabled for compilation.
|
/// proposal][proposal] will be enabled for compilation.
|
||||||
///
|
|
||||||
/// The [WebAssembly bulk memory operations proposal][proposal] is not
|
|
||||||
/// currently fully standardized and is undergoing development.
|
|
||||||
/// Additionally the support in wasmtime itself is still being worked on.
|
|
||||||
/// Support for this feature can be enabled through this method for
|
|
||||||
/// appropriate wasm modules.
|
|
||||||
///
|
///
|
||||||
/// This feature gates items such as the `memory.copy` instruction, passive
|
/// This feature gates items such as the `memory.copy` instruction, passive
|
||||||
/// data/table segments, etc, being in a module.
|
/// data/table segments, etc, being in a module.
|
||||||
///
|
///
|
||||||
/// This is `false` by default.
|
/// This is `true` by default.
|
||||||
///
|
///
|
||||||
/// [proposal]: https://github.com/webassembly/bulk-memory-operations
|
/// [proposal]: https://github.com/webassembly/bulk-memory-operations
|
||||||
pub fn wasm_bulk_memory(&mut self, enable: bool) -> &mut Self {
|
pub fn wasm_bulk_memory(&mut self, enable: bool) -> &mut Self {
|
||||||
|
|||||||
12
src/lib.rs
12
src/lib.rs
@@ -110,7 +110,7 @@ struct CommonOptions {
|
|||||||
|
|
||||||
/// Enable support for reference types
|
/// Enable support for reference types
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
enable_reference_types: bool,
|
enable_reference_types: Option<bool>,
|
||||||
|
|
||||||
/// Enable support for multi-value functions
|
/// Enable support for multi-value functions
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
@@ -122,7 +122,7 @@ struct CommonOptions {
|
|||||||
|
|
||||||
/// Enable support for bulk memory instructions
|
/// Enable support for bulk memory instructions
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
enable_bulk_memory: bool,
|
enable_bulk_memory: Option<bool>,
|
||||||
|
|
||||||
/// Enable all experimental Wasm features
|
/// Enable all experimental Wasm features
|
||||||
#[structopt(long)]
|
#[structopt(long)]
|
||||||
@@ -185,9 +185,13 @@ impl CommonOptions {
|
|||||||
config
|
config
|
||||||
.cranelift_debug_verifier(self.enable_cranelift_debug_verifier)
|
.cranelift_debug_verifier(self.enable_cranelift_debug_verifier)
|
||||||
.debug_info(self.debug_info)
|
.debug_info(self.debug_info)
|
||||||
.wasm_bulk_memory(self.enable_bulk_memory || self.enable_all)
|
|
||||||
.wasm_simd(self.enable_simd || self.enable_all)
|
.wasm_simd(self.enable_simd || self.enable_all)
|
||||||
.wasm_reference_types(self.enable_reference_types || self.enable_all)
|
.wasm_bulk_memory(self.enable_bulk_memory.unwrap_or(true) || self.enable_all)
|
||||||
|
.wasm_reference_types(
|
||||||
|
self.enable_reference_types
|
||||||
|
.unwrap_or(cfg!(target_arch = "x86_64"))
|
||||||
|
|| self.enable_all,
|
||||||
|
)
|
||||||
.wasm_multi_value(self.enable_multi_value.unwrap_or(true) || self.enable_all)
|
.wasm_multi_value(self.enable_multi_value.unwrap_or(true) || self.enable_all)
|
||||||
.wasm_threads(self.enable_threads || self.enable_all)
|
.wasm_threads(self.enable_threads || self.enable_all)
|
||||||
.cranelift_opt_level(self.opt_level())
|
.cranelift_opt_level(self.opt_level())
|
||||||
|
|||||||
Reference in New Issue
Block a user