Skip to content

Commit

Permalink
update to wasi-cli 0.2.0-rc-2023-12-05 snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Jan 21, 2024
1 parent bc70287 commit 65ceb08
Show file tree
Hide file tree
Showing 36 changed files with 408 additions and 574 deletions.
Binary file modified lib/virtual_adapter.debug.wasm
Binary file not shown.
Binary file modified lib/virtual_adapter.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

0 comments on commit 65ceb08

Please sign in to comment.