Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Jan 18, 2023
1 parent 8183474 commit a483d04
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 50 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ engine = ["universal"]
universal = []
cache = ["wasmer-cache"]
wast = ["wasmer-wast"]
wasi = ["wasmer-wasi", "wasmer-wasi/emscripten_cranelift", "wasmer-wasi/wasi_cranelift"]
wasi = ["wasmer-wasi"]
emscripten = ["wasmer-emscripten"]
wat = ["wasmer/wat"]
compiler = [
"wasmer/compiler",
"wasmer-compiler/translator",
]
singlepass = ["wasmer-compiler-singlepass", "compiler", "wasmer-wasi/emscripten_singlepass", "wasmer-wasi/wasi_singlepass"]
cranelift = ["wasmer-compiler-cranelift", "compiler", "wasmer-wasi/emscripten_cranelift", "wasmer-wasi/wasi_cranelift"]
llvm = ["wasmer-compiler-llvm", "compiler", "wasmer-wasi/emscripten_llvm", "wasmer-wasi/wasi_llvm"]
singlepass = ["wasmer-compiler-singlepass", "compiler"]
cranelift = ["wasmer-compiler-cranelift", "compiler"]
llvm = ["wasmer-compiler-llvm", "compiler"]
middlewares = ["wasmer-middlewares"]
wasmer-artifact-load = ["wasmer-compiler/wasmer-artifact-load"]
wasmer-artifact-create = ["wasmer-compiler/wasmer-artifact-create"]
Expand Down
6 changes: 0 additions & 6 deletions lib/c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,14 @@ compiler-headless = [
]
singlepass = [
"wasmer-compiler-singlepass",
"wasmer-wasi/emscripten_singlepass",
"wasmer-wasi/wasi_singlepass",
"compiler",
]
cranelift = [
"wasmer-compiler-cranelift",
"wasmer-wasi/emscripten_cranelift",
"wasmer-wasi/wasi_cranelift",
"compiler",
]
llvm = [
"wasmer-compiler-llvm",
"wasmer-wasi/emscripten_llvm",
"wasmer-wasi/wasi_llvm",
"compiler",
]
wasmer-artifact-load = ["wasmer-compiler/wasmer-artifact-load"]
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ wasmer-compiler-singlepass = { version = "=3.1.0", path = "../compiler-singlepas
wasmer-compiler-llvm = { version = "=3.1.0", path = "../compiler-llvm", optional = true }
wasmer-emscripten = { version = "=3.1.0", path = "../emscripten", optional = true }
wasmer-vm = { version = "=3.1.0", path = "../vm" }
wasmer-wasi = { version = "=3.1.0", path = "../wasi", features = ["emscripten_cranelift", "wasi_cranelift"], optional = true }
wasmer-wasi = { version = "=3.1.0", path = "../wasi", optional = true }
wasmer-wasi-experimental-io-devices = { version = "=3.1.0", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] }
wasmer-wast = { version = "=3.1.0", path = "../../tests/lib/wast", optional = true }
wasmer-cache = { version = "=3.1.0", path = "../cache", optional = true }
Expand Down
3 changes: 3 additions & 0 deletions lib/cli/src/commands/run.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(feature = "cache")]
use crate::common::get_cache_dir;
#[cfg(feature = "debug")]
use crate::logging;
Expand All @@ -10,7 +11,9 @@ use clap::Parser;
use std::collections::HashMap;
use std::ops::Deref;
use std::path::PathBuf;
#[cfg(feature = "cache")]
use std::str::FromStr;
#[cfg(feature = "emscripten")]
use wasmer::FunctionEnv;
use wasmer::*;
#[cfg(feature = "cache")]
Expand Down
2 changes: 1 addition & 1 deletion lib/wasi-experimental-io-devices/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ edition = "2018"
maintenance = { status = "experimental" }

[dependencies]
wasmer-wasi = { version = "=3.1.0", path = "../wasi", default-features=false, features = ["emscripten_cranelift", "wasi_cranelift"] }
wasmer-wasi = { version = "=3.1.0", path = "../wasi", default-features=false }
tracing = "0.1"
minifb = { version = "0.23", optional = true }
nix = "0.25.0"
Expand Down
6 changes: 0 additions & 6 deletions lib/wasi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ wasix = []
webc_runner = ["webc", "serde_cbor", "anyhow", "serde", "wasmer-vfs/webc-fs"]
webc_runner_rt_emscripten = ["wasmer-emscripten"]
webc_runner_rt_wasi = []
emscripten_cranelift = ["wasmer/cranelift"]
wasi_cranelift = ["wasmer/cranelift"]
emscripten_singlepass = ["wasmer/singlepass"]
wasi_singlepass = ["wasmer/singlepass"]
emscripten_llvm = ["wasmer/llvm"]
wasi_llvm = ["wasmer/llvm"]

sys = ["wasmer/sys", "wasix", "wasmer-wasi-types/sys"]
sys-default = ["wasmer/wat", "wasmer/compiler", "sys", "logging", "host-fs", "sys-poll", "host-vnet" ]
Expand Down
18 changes: 2 additions & 16 deletions lib/wasi/src/runners/emscripten.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg(feature = "webc_runner_rt_wasi")]
#![cfg(feature = "webc_runner_rt_emscripten")]
//! WebC container support for running Emscripten modules
use crate::runners::WapmContainer;
Expand Down Expand Up @@ -44,21 +44,7 @@ impl crate::runners::Runner for EmscriptenRunner {
let main_args = container.get_main_args_for_command(command_name);
let atom_bytes = container.get_atom(&container.get_package_name(), &atom_name)?;

#[cfg(feature = "emscripten_cranelift")]
let mut store = Store::new(wasmer::Cranelift::default());
#[cfg(feature = "emscripten_llvm")]
let mut store = Store::new(wasmer::Llvm::default());
#[cfg(feature = "emscripten_singlepass")]
let mut store = Store::new(wasmer::Singlepass::default());
#[cfg(not(any(
feature = "emscripten_cranelift",
feature = "emscripten_llvm",
feature = "emscripten_singlepass"
)))]
let mut store = {
return Err(anyhow::anyhow!("wasmer-wasi needs one of emscripten_cranelift or emscripten_llvm or emscripten_singlepass features enabled").into());
};

let mut store = Store::default();
let mut module = Module::new(&store, atom_bytes)?;
module.set_name(&atom_name);

Expand Down
17 changes: 2 additions & 15 deletions lib/wasi/src/runners/wasi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg(feature = "webc_runner_rt_emscripten")]
#![cfg(feature = "webc_runner_rt_wasi")]
//! WebC container support for running WASI modules
use crate::runners::WapmContainer;
Expand Down Expand Up @@ -43,20 +43,7 @@ impl crate::runners::Runner for WasiRunner {
let atom_name = container.get_atom_name_for_command("wasi", command_name)?;
let atom_bytes = container.get_atom(&container.get_package_name(), &atom_name)?;

#[cfg(feature = "wasi_cranelift")]
let mut store = Store::new(wasmer::Cranelift::default());
#[cfg(feature = "wasi_llvm")]
let mut store = Store::new(wasmer::Llvm::default());
#[cfg(feature = "wasi_singlepass")]
let mut store = Store::new(wasmer::Singlepass::default());
#[cfg(not(any(
feature = "wasi_cranelift",
feature = "wasi_llvm",
feature = "wasi_singlepass"
)))]
let mut store = {
return Err(anyhow::anyhow!("wasmer-wasi needs one of wasi_cranelift or wasi_llvm or wasi_singlepass features enabled").into());
};
let mut store = Store::default();
let mut module = Module::new(&store, atom_bytes)?;
module.set_name(&atom_name);

Expand Down
2 changes: 1 addition & 1 deletion tests/lib/wast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = "2018"
[dependencies]
anyhow = "1.0"
wasmer = { path = "../../../lib/api", version = "=3.1.0", default-features = false }
wasmer-wasi = { path = "../../../lib/wasi", version = "=3.1.0", features = ["emscripten_cranelift", "wasi_cranelift"] }
wasmer-wasi = { path = "../../../lib/wasi", version = "=3.1.0" }
wasmer-vfs = { path = "../../../lib/vfs", version = "=3.1.0" }
wast = "38.0"
serde = "1"
Expand Down
1 change: 1 addition & 0 deletions tests/lib/wast/src/spectest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use wasmer::*;

/// Return an instance implementing the "spectest" interface used in the
/// spec testsuite.
#[allow(clippy::print_stdout)]
pub fn spectest_importobject(store: &mut Store) -> Imports {
let print = Function::new_typed(store, || {});
let print_i32 = Function::new_typed(store, |val: i32| println!("{}: i32", val));
Expand Down

0 comments on commit a483d04

Please sign in to comment.