Add more CLI flags for wasm features (#917)
* Add more CLI flags for wasm features This commit adds a few more flags to enable wasm features via the CLI, mirroring the existing `--enable-simd` flag: * `--enable-reference-types` * `--enable-multi-value` * `--enable-threads` * `--enable-bulk-memory` Additionally the bulk memory feature is now automatically enabled if `reference-types` or `threads` are enabled since those two proposals largely depend on `bulk-memory`. * Add --enable-all to enable all wasm features * Update src/lib.rs Co-Authored-By: Peter Huene <peterhuene@protonmail.com> * Apply suggestions from code review Co-Authored-By: Peter Huene <peterhuene@protonmail.com> Co-authored-by: Peter Huene <peterhuene@protonmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//! The module that implements the `wasmtime run` command.
|
||||
|
||||
use crate::{init_file_per_thread_logger, pick_compilation_strategy, CommonOptions};
|
||||
use crate::{init_file_per_thread_logger, CommonOptions};
|
||||
use anyhow::{bail, Context as _, Result};
|
||||
use std::{
|
||||
ffi::{OsStr, OsString},
|
||||
@@ -9,7 +9,7 @@ use std::{
|
||||
};
|
||||
use structopt::{clap::AppSettings, StructOpt};
|
||||
use wasi_common::preopen_dir;
|
||||
use wasmtime::{Config, Engine, Instance, Module, Store};
|
||||
use wasmtime::{Engine, Instance, Module, Store};
|
||||
use wasmtime_interface_types::ModuleData;
|
||||
use wasmtime_wasi::{old::snapshot_0::Wasi as WasiSnapshot0, Wasi};
|
||||
|
||||
@@ -96,21 +96,7 @@ impl RunCommand {
|
||||
init_file_per_thread_logger(prefix);
|
||||
}
|
||||
|
||||
let mut config = Config::new();
|
||||
config
|
||||
.cranelift_debug_verifier(cfg!(debug_assertions))
|
||||
.debug_info(self.common.debug_info)
|
||||
.wasm_simd(self.common.enable_simd)
|
||||
.strategy(pick_compilation_strategy(
|
||||
self.common.cranelift,
|
||||
self.common.lightbeam,
|
||||
)?)?;
|
||||
self.common.configure_cache(&mut config)?;
|
||||
|
||||
if self.common.optimize {
|
||||
config.cranelift_opt_level(wasmtime::OptLevel::Speed);
|
||||
}
|
||||
|
||||
let config = self.common.config()?;
|
||||
let engine = Engine::new(&config);
|
||||
let store = Store::new(&engine);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! The module that implements the `wasmtime wast` command.
|
||||
|
||||
use crate::{init_file_per_thread_logger, pick_compilation_strategy, CommonOptions};
|
||||
use crate::{init_file_per_thread_logger, CommonOptions};
|
||||
use anyhow::{Context as _, Result};
|
||||
use std::path::PathBuf;
|
||||
use structopt::{clap::AppSettings, StructOpt};
|
||||
use wasmtime::{Config, Engine, Store};
|
||||
use wasmtime::{Engine, Store};
|
||||
use wasmtime_wast::WastContext;
|
||||
|
||||
/// Runs a WebAssembly test script file
|
||||
@@ -33,21 +33,7 @@ impl WastCommand {
|
||||
init_file_per_thread_logger(prefix);
|
||||
}
|
||||
|
||||
let mut config = Config::new();
|
||||
config
|
||||
.cranelift_debug_verifier(cfg!(debug_assertions))
|
||||
.debug_info(self.common.debug_info)
|
||||
.wasm_simd(self.common.enable_simd)
|
||||
.strategy(pick_compilation_strategy(
|
||||
self.common.cranelift,
|
||||
self.common.lightbeam,
|
||||
)?)?;
|
||||
self.common.configure_cache(&mut config)?;
|
||||
|
||||
if self.common.optimize {
|
||||
config.cranelift_opt_level(wasmtime::OptLevel::Speed);
|
||||
}
|
||||
|
||||
let config = self.common.config()?;
|
||||
let store = Store::new(&Engine::new(&config));
|
||||
let mut wast_context = WastContext::new(store);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user