Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to wasi-cli 0.2.0-rc-2023-12-05 snapshot #41

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
566 changes: 277 additions & 289 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ anyhow = "1"
clap = { version = "4", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
toml = "0.7"
# TODO: use published version of walrus
walrus = { git = "https://github.com/rustwasm/walrus", rev = "db5d437b91e80c564f5e45204b8b165027d2a870" }
# TODO: switch to upstream once https://github.com/bytecodealliance/wasm-tools/pull/1261 is merged
wasm-compose = { git = "https://github.com/bytecodealliance/wasm-tools", rev="8b9ba68a18f1bac2f31c4889cc6c462cde3f13a0" }
walrus = "0.20.3"
wasm-compose = "0.4.16"
wasm-metadata = "0.10.15"
wasm-opt = "0.114.1"
wit-component = "0.19.1"
Expand All @@ -49,11 +47,10 @@ anyhow = "1"
cap-std = "1.0.12"
heck = { version = "0.4" }
tokio = { version = "1.30.0", features = ["macros"] }
wasmtime = { version = "14.0.4", features = ["component-model"] }
wasmtime-wasi = "14.0.4"
wasmtime = { version = "16.0.0", features = ["component-model"] }
wasmtime-wasi = "16.0.0"
wasmparser = "0.119.0"

[workspace.dependencies]
anyhow = "1"
# TODO: switch to upstream once https://github.com/bytecodealliance/wit-bindgen/pull/753 is merged
wit-bindgen = { git = "https://github.com/dicej/wit-bindgen", branch = "resource-take" }
wit-bindgen = "0.16.0"
Binary file modified lib/virtual_adapter.debug.wasm
Binary file not shown.
Binary file modified lib/virtual_adapter.wasm
Binary file not shown.
Binary file modified lib/wasi_snapshot_preview1.reactor.wasm
Binary file not shown.
31 changes: 8 additions & 23 deletions src/virt_deny/clocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,33 @@ fn get_wasi_clock_fns() -> &'static Vec<(&'static str, FuncParams, FuncResults)>
WASI_CLOCK_FNS.get_or_init(|| {
Vec::from([
(
"wasi:clocks/[email protected]10-18#now",
"wasi:clocks/[email protected]11-10#now",
vec![],
vec![ValType::I64],
),
(
"wasi:clocks/[email protected]10-18#resolution",
"wasi:clocks/[email protected]11-10#resolution",
vec![],
vec![ValType::I64],
),
(
"wasi:clocks/[email protected]10-18#subscribe",
vec![ValType::I64, ValType::I32],
"wasi:clocks/[email protected]11-10#subscribe-instant",
vec![ValType::I64],
vec![ValType::I32],
),
(
"wasi:clocks/wall[email protected]10-18#now",
vec![],
"wasi:clocks/monotonic[email protected]11-10#subscribe-duration",
vec![ValType::I64],
vec![ValType::I32],
),
(
"wasi:clocks/[email protected]10-18#resolution",
"wasi:clocks/[email protected]11-10#now",
vec![],
vec![ValType::I32],
),
(
"wasi:clocks/[email protected]#subscribe",
vec![ValType::I64, ValType::I32],
vec![ValType::I32],
),
(
"wasi:clocks/[email protected]#display",
vec![ValType::I64, ValType::I32],
vec![ValType::I32],
),
(
"cabi_post_wasi:clocks/[email protected]#display",
vec![ValType::I32],
"wasi:clocks/[email protected]#resolution",
vec![],
),
(
"wasi:clocks/[email protected]#utc-offset",
vec![ValType::I64, ValType::I32],
vec![ValType::I32],
),
])
Expand Down
2 changes: 1 addition & 1 deletion src/virt_deny/exit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static WASI_EXIT_FNS: OnceLock<Vec<(&str, FuncParams, FuncResults)>> = OnceLock:
fn get_wasi_exit_fns() -> &'static Vec<(&'static str, FuncParams, FuncResults)> {
WASI_EXIT_FNS.get_or_init(|| {
Vec::from([(
"wasi:cli/[email protected]10-18#exit",
"wasi:cli/[email protected]12-05#exit",
vec![ValType::I32],
vec![],
)])
Expand Down
14 changes: 7 additions & 7 deletions src/virt_deny/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ fn get_wasi_random_fns() -> &'static Vec<(&'static str, FuncParams, FuncResults)
WASI_RANDOM_FNS.get_or_init(|| {
Vec::from([
(
"wasi:random/[email protected]10-18#get-random-bytes",
"wasi:random/[email protected]11-10#get-random-bytes",
vec![ValType::I64],
vec![ValType::I32],
),
(
"cabi_post_wasi:random/[email protected]10-18#get-random-bytes",
"cabi_post_wasi:random/[email protected]11-10#get-random-bytes",
vec![ValType::I32],
vec![],
),
(
"wasi:random/[email protected]10-18#get-random-u64",
"wasi:random/[email protected]11-10#get-random-u64",
vec![],
vec![ValType::I64],
),
(
"wasi:random/[email protected]10-18#get-insecure-random-bytes",
"wasi:random/[email protected]11-10#get-insecure-random-bytes",
vec![ValType::I64],
vec![ValType::I32],
),
(
"cabi_post_wasi:random/[email protected]10-18#get-insecure-random-bytes",
"cabi_post_wasi:random/[email protected]11-10#get-insecure-random-bytes",
vec![ValType::I32],
vec![],
),
(
"wasi:random/[email protected]10-18#get-insecure-random-u64",
"wasi:random/[email protected]11-10#get-insecure-random-u64",
vec![],
vec![ValType::I64],
),
(
"wasi:random/[email protected]10-18#insecure-seed",
"wasi:random/[email protected]11-10#insecure-seed",
vec![],
vec![ValType::I32],
),
Expand Down
4 changes: 2 additions & 2 deletions src/virt_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pub(crate) fn stub_env_virt(module: &mut Module) -> Result<()> {
module.replace_imported_func(
module
.imports
.get_func("wasi:cli/[email protected]10-18", fn_name)?,
.get_func("wasi:cli/[email protected]12-05", fn_name)?,
|(body, _)| {
body.unreachable();
},
Expand All @@ -240,7 +240,7 @@ pub(crate) fn strip_env_virt(module: &mut Module) -> Result<()> {

for fn_name in WASI_ENV_FNS {
if let Ok(fid) = module.exports.get_func(format!(
"wasi:cli/[email protected]10-18#{fn_name}"
"wasi:cli/[email protected]12-05#{fn_name}"
)) {
module.replace_exported_func(fid, |(body, _)| {
body.unreachable();
Expand Down
24 changes: 15 additions & 9 deletions src/virt_io/clocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,25 @@ use walrus::Module;
use super::StubRequirement;

/// Imports exposed by WASI for clocks functionality which are allowed to be
const WASI_CLOCKS_IMPORTS: [(&str, &str, &StubRequirement); 3] = [
const WASI_CLOCKS_IMPORTS: [(&str, &str, &StubRequirement); 4] = [
(
"wasi:clocks/[email protected]10-18",
"wasi:clocks/[email protected]11-10",
"now",
&StubRequirement::Required,
),
(
"wasi:clocks/[email protected]10-18",
"wasi:clocks/[email protected]11-10",
"resolution",
&StubRequirement::Required,
),
(
"wasi:clocks/[email protected]",
"subscribe",
"wasi:clocks/[email protected]",
"subscribe-instant",
&StubRequirement::Required,
),
(
"wasi:clocks/[email protected]",
"subscribe-duration",
&StubRequirement::Required,
),
];
Expand Down Expand Up @@ -50,10 +55,11 @@ pub(crate) fn stub_clocks_virt(module: &mut Module) -> Result<()> {
}

/// Exported functions related to WASI clocks
const WASI_CLOCK_EXPORTS: [&str; 3] = [
"wasi:clocks/[email protected]#now",
"wasi:clocks/[email protected]#resolution",
"wasi:clocks/[email protected]#subscribe",
const WASI_CLOCK_EXPORTS: [&str; 4] = [
"wasi:clocks/[email protected]#now",
"wasi:clocks/[email protected]#resolution",
"wasi:clocks/[email protected]#subscribe-instant",
"wasi:clocks/[email protected]#subscribe-duration",
];

/// Strip exported WASI functions that implement clock access
Expand Down
Loading
Loading