Remove usage of Features from wasmtime::Config API (#763)

Instead expose a number of boolean accessors which doesn't require users
to construct a foreign `Features` type and allows us to decouple the API
of the `wasmtime` crate from the underlying implementation detail.
This commit is contained in:
Alex Crichton
2020-01-06 17:34:48 -06:00
committed by GitHub
parent b9dc38f4e1
commit 787f50e107
11 changed files with 109 additions and 56 deletions

View File

@@ -32,7 +32,6 @@ use wasmtime_cli::pick_compilation_strategy;
use wasmtime_environ::settings;
use wasmtime_environ::settings::Configurable;
use wasmtime_environ::{cache_create_new_config, cache_init};
use wasmtime_jit::Features;
use wasmtime_wast::WastContext;
const USAGE: &str = "
@@ -125,8 +124,8 @@ fn main() {
process::exit(1);
}
let mut cfg = Config::new();
let mut flag_builder = settings::builder();
let mut features: Features = Default::default();
// There are two possible traps for division, and this way
// we get the proper one if code traps.
@@ -145,15 +144,13 @@ fn main() {
// Enable SIMD if requested
if args.flag_enable_simd {
flag_builder.enable("enable_simd").unwrap();
features.simd = true;
cfg.wasm_simd(true);
}
// Decide how to compile.
let strategy = pick_compilation_strategy(args.flag_cranelift, args.flag_lightbeam);
let mut cfg = Config::new();
cfg.strategy(strategy)
.flags(settings::Flags::new(flag_builder))
.features(features);
.flags(settings::Flags::new(flag_builder));
let store = HostRef::new(Store::new(&Engine::new(&cfg)));
let mut wast_context = WastContext::new(store);