Enable reference types and bulk memory operations by default
This commit is contained in:
@@ -94,8 +94,8 @@ impl Config {
|
||||
memory_creator: None,
|
||||
max_wasm_stack: 1 << 20,
|
||||
wasm_threads: false,
|
||||
wasm_reference_types: false,
|
||||
wasm_bulk_memory: false,
|
||||
wasm_reference_types: cfg!(target_arch = "x86_64"),
|
||||
wasm_bulk_memory: true,
|
||||
wasm_simd: false,
|
||||
wasm_multi_value: true,
|
||||
}
|
||||
@@ -170,25 +170,17 @@ impl Config {
|
||||
self
|
||||
}
|
||||
|
||||
/// Configures whether the WebAssembly reference types proposal will be
|
||||
/// enabled for compilation.
|
||||
/// Configures whether the [WebAssembly reference types proposal][proposal]
|
||||
/// will be enabled for compilation.
|
||||
///
|
||||
/// The [WebAssembly reference types 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 `externref` and `funcref` types as
|
||||
/// well as allowing a module to define multiple tables.
|
||||
///
|
||||
/// This feature gates items such as the `externref` type and multiple tables
|
||||
/// being in a module. Note that enabling the reference types feature will
|
||||
/// also enable the bulk memory feature.
|
||||
/// Note that enabling the reference types feature will also enable the bulk
|
||||
/// memory feature.
|
||||
///
|
||||
/// This is `false` by default.
|
||||
///
|
||||
/// > **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.
|
||||
/// This is `true` by default on x86-64, and `false` by default on other
|
||||
/// architectures.
|
||||
///
|
||||
/// [proposal]: https://github.com/webassembly/reference-types
|
||||
pub fn wasm_reference_types(&mut self, enable: bool) -> &mut Self {
|
||||
@@ -235,19 +227,13 @@ impl Config {
|
||||
self
|
||||
}
|
||||
|
||||
/// Configures whether the WebAssembly bulk memory operations 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.
|
||||
/// Configures whether the [WebAssembly bulk memory operations
|
||||
/// proposal][proposal] will be enabled for compilation.
|
||||
///
|
||||
/// This feature gates items such as the `memory.copy` instruction, passive
|
||||
/// 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
|
||||
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
|
||||
#[structopt(long)]
|
||||
enable_reference_types: bool,
|
||||
enable_reference_types: Option<bool>,
|
||||
|
||||
/// Enable support for multi-value functions
|
||||
#[structopt(long)]
|
||||
@@ -122,7 +122,7 @@ struct CommonOptions {
|
||||
|
||||
/// Enable support for bulk memory instructions
|
||||
#[structopt(long)]
|
||||
enable_bulk_memory: bool,
|
||||
enable_bulk_memory: Option<bool>,
|
||||
|
||||
/// Enable all experimental Wasm features
|
||||
#[structopt(long)]
|
||||
@@ -185,9 +185,13 @@ impl CommonOptions {
|
||||
config
|
||||
.cranelift_debug_verifier(self.enable_cranelift_debug_verifier)
|
||||
.debug_info(self.debug_info)
|
||||
.wasm_bulk_memory(self.enable_bulk_memory || 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_threads(self.enable_threads || self.enable_all)
|
||||
.cranelift_opt_level(self.opt_level())
|
||||
|
||||
Reference in New Issue
Block a user