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

@@ -19,7 +19,6 @@ test = false
wasmtime = { path = "../../api" }
wasmtime-environ = { path = "../../environ" }
wasmtime-interface-types = { path = "../../interface-types" }
wasmtime-jit = { path = "../../jit" }
wasmtime-runtime = { path = "../../runtime" }
wasmtime-wasi = { path = "../../wasi" }
target-lexicon = { version = "0.9.0", default-features = false }

View File

@@ -10,7 +10,6 @@ use pyo3::types::{PyAny, PyBytes, PyDict, PySet};
use pyo3::wrap_pyfunction;
use std::rc::Rc;
use wasmtime_interface_types::ModuleData;
use wasmtime_jit::Features;
mod function;
mod instance;
@@ -86,13 +85,7 @@ pub fn instantiate(
) -> PyResult<Py<InstantiateResultObject>> {
let wasm_data = buffer_source.as_bytes();
let mut config = wasmtime::Config::new();
config.features(Features {
multi_value: true,
..Default::default()
});
let engine = wasmtime::Engine::new(&config);
let engine = wasmtime::Engine::new(&wasmtime::Config::new().wasm_multi_value(true));
let store = wasmtime::HostRef::new(wasmtime::Store::new(&engine));
let module = wasmtime::HostRef::new(wasmtime::Module::new(&store, wasm_data).map_err(err2py)?);

View File

@@ -16,7 +16,6 @@ doctest = false
[dependencies]
wasmtime-interface-types = { path = "../../interface-types" }
wasmtime-jit = { path = "../../jit" }
wasmtime-rust-macro = { path = "./macro" }
wasmtime-wasi = { path = "../../wasi" }
wasmtime = { path = "../../api" }

View File

@@ -51,12 +51,7 @@ fn generate_load(item: &syn::ItemTrait) -> syn::Result<TokenStream> {
use #root::wasmtime::{HostRef, Config, Extern, Engine, Store, Instance, Module};
use #root::anyhow::{bail, format_err};
let mut config = Config::new();
config.features(#root::wasmtime_jit::Features {
multi_value: true,
..Default::default()
});
let engine = Engine::new(&config);
let engine = Engine::new(Config::new().wasm_multi_value(true));
let store = HostRef::new(Store::new(&engine));
let global_exports = store.borrow().global_exports().clone();

View File

@@ -6,7 +6,6 @@ pub mod __rt {
pub use anyhow;
pub use wasmtime;
pub use wasmtime_interface_types;
pub use wasmtime_jit;
pub use wasmtime_wasi;
use std::convert::{TryFrom, TryInto};