Skip to content

Commit

Permalink
Update dependencies, wasmtime-19
Browse files Browse the repository at this point in the history
  • Loading branch information
Gentle committed Mar 29, 2024
1 parent 3c0d633 commit 2cac89e
Show file tree
Hide file tree
Showing 12 changed files with 347 additions and 627 deletions.
899 changes: 306 additions & 593 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ name = "uap"
harness = false

[dependencies]
anyhow = "1.0.80"
anyhow = "1.0.81"
cap-std = "3.0.0"
env_logger = { version = "0.11", optional = true }
log = "0.4.21"
rayon = "1.9.0"
rayon = "1.10.0"
structopt = { version = "0.3.26", optional = true }
wasm-encoder = "0.201.0"
wasmparser = "0.201.0"
wasm-encoder = "0.202.0"
wasmparser = "0.202.0"
wasmtime = { workspace = true }
wasmtime-wasi = { workspace = true }
wasi-common = { workspace = true }

# Enable this dependency to get messages with WAT disassemblies when certain
Expand All @@ -46,17 +45,16 @@ workspace = true
optional = true

[workspace.dependencies]
wasmprinter = "0.201.0"
wasmtime = "18"
wasmtime-wasi = "18"
wasi-common = "18"
wasmprinter = "0.202.0"
wasmtime = "19"
wasi-common = "19"


[dev-dependencies]
criterion = "0.5.1"
env_logger = "0.11.3"
wasmprinter = { workspace = true }
wat = "1.201.0"
wat = "1.202.0"

[workspace]
members = [
Expand Down
2 changes: 1 addition & 1 deletion benches/regex-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
regex = "1.10.3"
regex = "1.10.4"

[features]
wizer = []
8 changes: 4 additions & 4 deletions benches/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ fn bench_regex(c: &mut Criterion) {
let mut group = c.benchmark_group("regex");
group.bench_function("control", |b| {
let engine = wasmtime::Engine::default();
let wasi = wasmtime_wasi::WasiCtxBuilder::new().build();
let wasi = wasi_common::sync::WasiCtxBuilder::new().build();
let mut store = wasmtime::Store::new(&engine, wasi);
let module =
wasmtime::Module::new(store.engine(), &include_bytes!("regex_bench.control.wasm"))
.unwrap();
let mut linker = wasmtime::Linker::new(&engine);
wasmtime_wasi::sync::add_to_linker(&mut linker, |s| s).unwrap();
wasi_common::sync::add_to_linker(&mut linker, |s| s).unwrap();

b.iter(|| run_iter(&linker, &module, &mut store));
});
group.bench_function("wizer", |b| {
let engine = wasmtime::Engine::default();
let wasi = wasmtime_wasi::WasiCtxBuilder::new().build();
let wasi = wasi_common::sync::WasiCtxBuilder::new().build();
let mut store = wasmtime::Store::new(&engine, wasi);
let module =
wasmtime::Module::new(store.engine(), &include_bytes!("regex_bench.control.wasm"))
.unwrap();
let mut linker = wasmtime::Linker::new(&engine);
wasmtime_wasi::sync::add_to_linker(&mut linker, |s| s).unwrap();
wasi_common::sync::add_to_linker(&mut linker, |s| s).unwrap();

b.iter(|| run_iter(&linker, &module, &mut store));
});
Expand Down
4 changes: 2 additions & 2 deletions benches/uap-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ crate-type = ["cdylib"]

[dependencies]
serde = { version = "1.0.197", features = ["derive"] }
regex = "1.10.3"
serde_yaml = "0.9.32"
regex = "1.10.4"
serde_yaml = "0.9.34"

[features]
wizer = []
8 changes: 4 additions & 4 deletions benches/uap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@ fn bench_uap(c: &mut Criterion) {
let mut group = c.benchmark_group("uap");
group.bench_function("control", |b| {
let engine = wasmtime::Engine::default();
let wasi = wasmtime_wasi::WasiCtxBuilder::new().build();
let wasi = wasi_common::sync::WasiCtxBuilder::new().build();
let mut store = wasmtime::Store::new(&engine, wasi);
let module =
wasmtime::Module::new(store.engine(), &include_bytes!("uap_bench.control.wasm"))
.unwrap();
let mut linker = wasmtime::Linker::new(&engine);
wasmtime_wasi::sync::add_to_linker(&mut linker, |s| s).unwrap();
wasi_common::sync::add_to_linker(&mut linker, |s| s).unwrap();

b.iter(|| run_iter(&linker, &module, &mut store));
});
group.bench_function("wizer", |b| {
let engine = wasmtime::Engine::default();
let wasi = wasmtime_wasi::WasiCtxBuilder::new().build();
let wasi = wasi_common::sync::WasiCtxBuilder::new().build();
let mut store = wasmtime::Store::new(&engine, wasi);
let module =
wasmtime::Module::new(store.engine(), &include_bytes!("uap_bench.wizer.wasm")).unwrap();
let mut linker = wasmtime::Linker::new(&engine);
wasmtime_wasi::sync::add_to_linker(&mut linker, |s| s).unwrap();
wasi_common::sync::add_to_linker(&mut linker, |s| s).unwrap();

b.iter(|| run_iter(&linker, &module, &mut store));
});
Expand Down
2 changes: 1 addition & 1 deletion fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cargo-fuzz = true
env_logger = "0.11.3"
libfuzzer-sys = "0.4"
log = "0.4.21"
wasm-smith = "0.201.0"
wasm-smith = "0.202.0"
wasmprinter = { workspace = true }
wasmtime = { workspace = true }

Expand Down
13 changes: 11 additions & 2 deletions src/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,17 @@ pub fn dummy_value(val_ty: ValType) -> Val {
ValType::F32 => Val::F32(0),
ValType::F64 => Val::F64(0),
ValType::V128 => Val::V128(0.into()),
ValType::ExternRef => Val::ExternRef(None),
ValType::FuncRef => Val::FuncRef(None),
ValType::Ref(ref_type) => {
if ref_type.matches(&RefType::EXTERNREF) {
Val::ExternRef(None)
} else if ref_type.matches(&RefType::FUNCREF) {
Val::FuncRef(None)
} else if ref_type.matches(&RefType::NULLFUNCREF) {
Val::FuncRef(None)
} else {
panic!("Unknown RefType {:?}", ref_type);
}
}
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mod snapshot;
mod stack_ext;
mod translate;

use wasi_common::sync::WasiCtxBuilder;
/// Re-export wasmtime so users can align with our version. This is
/// especially useful when providing a custom Linker.
pub use wasmtime;
Expand All @@ -31,7 +32,6 @@ use std::rc::Rc;
use structopt::StructOpt;
use wasi_common::WasiCtx;
use wasmtime::{Engine, Extern};
use wasmtime_wasi::WasiCtxBuilder;

const DEFAULT_INHERIT_STDIO: bool = true;
const DEFAULT_INHERIT_ENV: bool = false;
Expand Down Expand Up @@ -776,9 +776,9 @@ impl Wizer {
}
for dir in &self.dirs {
log::debug!("Preopening directory: {}", dir.display());
let preopened = wasmtime_wasi::sync::Dir::open_ambient_dir(
let preopened = wasi_common::sync::Dir::open_ambient_dir(
dir,
wasmtime_wasi::sync::ambient_authority(),
wasi_common::sync::ambient_authority(),
)
.with_context(|| format!("failed to open directory: {}", dir.display()))?;
ctx.preopened_dir(preopened, dir)?;
Expand All @@ -789,9 +789,9 @@ impl Wizer {
guest_dir.display(),
host_dir.display()
);
let preopened = wasmtime_wasi::sync::Dir::open_ambient_dir(
let preopened = wasi_common::sync::Dir::open_ambient_dir(
host_dir,
wasmtime_wasi::sync::ambient_authority(),
wasi_common::sync::ambient_authority(),
)
.with_context(|| format!("failed to open directory: {}", host_dir.display()))?;
ctx.preopened_dir(preopened, guest_dir)?;
Expand Down Expand Up @@ -834,7 +834,7 @@ impl Wizer {
};

if self.allow_wasi {
wasmtime_wasi::add_to_linker(&mut linker, |ctx: &mut Option<WasiCtx>| {
wasi_common::sync::add_to_linker(&mut linker, |ctx: &mut Option<WasiCtx>| {
ctx.as_mut().unwrap()
})?;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/make_linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn run_wasm(args: &[wasmtime::Val], expected: i32, wasm: &[u8]) -> Result<()> {
config.wasm_multi_value(true);

let engine = wasmtime::Engine::new(&config)?;
let wasi_ctx = wasmtime_wasi::WasiCtxBuilder::new().build();
let wasi_ctx = wasi_common::sync::WasiCtxBuilder::new().build();
let mut store = wasmtime::Store::new(&engine, wasi_ctx);
let module =
wasmtime::Module::new(store.engine(), wasm).context("Wasm test case failed to compile")?;
Expand Down
2 changes: 1 addition & 1 deletion tests/regex-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ crate-type = ["cdylib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
regex = "1.10.3"
regex = "1.10.4"
4 changes: 2 additions & 2 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn wizen_and_run_wasm(
config.wasm_multi_value(true);

let engine = wasmtime::Engine::new(&config)?;
let wasi_ctx = wasmtime_wasi::WasiCtxBuilder::new().build();
let wasi_ctx = wasi_common::sync::WasiCtxBuilder::new().build();
let mut store = wasmtime::Store::new(&engine, wasi_ctx);
let module =
wasmtime::Module::new(store.engine(), wasm).context("Wasm test case failed to compile")?;
Expand All @@ -61,7 +61,7 @@ fn wizen_and_run_wasm(
.define_name(&mut store, "f", thunk)?
.define(&mut store, "x", "f", thunk)?;

wasmtime_wasi::add_to_linker(&mut linker, |wasi| wasi)?;
wasi_common::sync::add_to_linker(&mut linker, |wasi| wasi)?;

let instance = linker.instantiate(&mut store, &module)?;

Expand Down

0 comments on commit 2cac89e

Please sign in to comment.