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

@@ -2,7 +2,7 @@ use std::path::Path;
use wasmtime::{Config, Engine, HostRef, Store};
use wasmtime_environ::settings;
use wasmtime_environ::settings::Configurable;
use wasmtime_jit::{CompilationStrategy, Features};
use wasmtime_jit::CompilationStrategy;
use wasmtime_wast::WastContext;
include!(concat!(env!("OUT_DIR"), "/wast_testsuite_tests.rs"));
@@ -12,11 +12,6 @@ include!(concat!(env!("OUT_DIR"), "/wast_testsuite_tests.rs"));
// to compile it.
fn run_wast(wast: &str, strategy: CompilationStrategy) -> anyhow::Result<()> {
let wast = Path::new(wast);
let features = Features {
simd: wast.iter().any(|s| s == "simd"),
multi_value: wast.iter().any(|s| s == "multi-value"),
..Default::default()
};
let mut flag_builder = settings::builder();
flag_builder.enable("enable_verifier").unwrap();
@@ -24,9 +19,10 @@ fn run_wast(wast: &str, strategy: CompilationStrategy) -> anyhow::Result<()> {
flag_builder.enable("enable_simd").unwrap();
let mut cfg = Config::new();
cfg.strategy(strategy)
.flags(settings::Flags::new(flag_builder))
.features(features);
cfg.wasm_simd(wast.iter().any(|s| s == "simd"))
.wasm_multi_value(wast.iter().any(|s| s == "multi-value"))
.strategy(strategy)
.flags(settings::Flags::new(flag_builder));
let store = HostRef::new(Store::new(&Engine::new(&cfg)));
let mut wast_context = WastContext::new(store);
wast_context.register_spectest()?;