summaryrefslogtreecommitdiff
path: root/crates/cli/src
diff options
context:
space:
mode:
authorHenry <mail@henrygressmann.de>2026-08-09 16:11:57 +0200
committerHenry <mail@henrygressmann.de>2026-08-09 16:11:57 +0200
commit9893a51d2712f82a2ee57316a66bc26500eb3fdd (patch)
tree55578e887155323c57f05ac1905c552af82f5767 /crates/cli/src
parent8ca9c3580990bc973218d944f2262a7d98a8380e (diff)
feat: add reusable host imports and simplify function calls
- make host definitions reusable across stores with gc-aware import linking - reorganize function calls, resumable execution, and typed value handling - expand typed tuples to arity 20 and update parser and store APIs Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/cli/src')
-rw-r--r--crates/cli/src/wast_runner.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/cli/src/wast_runner.rs b/crates/cli/src/wast_runner.rs
index ad1742e..2ca622d 100644
--- a/crates/cli/src/wast_runner.rs
+++ b/crates/cli/src/wast_runner.rs
@@ -177,20 +177,20 @@ impl WastRunner {
.define("spectest", "global_i64", global_i64)
.define("spectest", "global_f32", global_f32)
.define("spectest", "global_f64", global_f64)
- .define("spectest", "print", HostFunction::from(store, |_ctx: tinywasm::FuncContext, (): ()| Ok(())))
- .define("spectest", "print_i32", HostFunction::from(store, |_ctx: tinywasm::FuncContext, _arg: i32| Ok(())))
- .define("spectest", "print_i64", HostFunction::from(store, |_ctx: tinywasm::FuncContext, _arg: i64| Ok(())))
- .define("spectest", "print_f32", HostFunction::from(store, |_ctx: tinywasm::FuncContext, _arg: f32| Ok(())))
- .define("spectest", "print_f64", HostFunction::from(store, |_ctx: tinywasm::FuncContext, _arg: f64| Ok(())))
+ .define("spectest", "print", HostFunction::from(|_ctx: tinywasm::FuncContext, (): ()| Ok(())))
+ .define("spectest", "print_i32", HostFunction::from(|_ctx: tinywasm::FuncContext, _arg: i32| Ok(())))
+ .define("spectest", "print_i64", HostFunction::from(|_ctx: tinywasm::FuncContext, _arg: i64| Ok(())))
+ .define("spectest", "print_f32", HostFunction::from(|_ctx: tinywasm::FuncContext, _arg: f32| Ok(())))
+ .define("spectest", "print_f64", HostFunction::from(|_ctx: tinywasm::FuncContext, _arg: f64| Ok(())))
.define(
"spectest",
"print_i32_f32",
- HostFunction::from(store, |_ctx: tinywasm::FuncContext, _args: (i32, f32)| Ok(())),
+ HostFunction::from(|_ctx: tinywasm::FuncContext, _args: (i32, f32)| Ok(())),
)
.define(
"spectest",
"print_f64_f64",
- HostFunction::from(store, |_ctx: tinywasm::FuncContext, _args: (f64, f64)| Ok(())),
+ HostFunction::from(|_ctx: tinywasm::FuncContext, _args: (f64, f64)| Ok(())),
);
for (name, module) in modules {
@@ -235,7 +235,7 @@ impl WastRunner {
let (name, bytes) = encode_quote_wat(module);
let module = parse_module_bytes(&bytes).expect("failed to parse module bytes");
let imports = Self::imports(&mut store, module_registry.modules()).unwrap();
- let module_instance = ModuleInstance::instantiate(&mut store, &module, Some(imports))
+ let module_instance = ModuleInstance::instantiate(&mut store, &module, Some(&imports))
.expect("failed to instantiate module");
(name, module_instance)
})
@@ -331,7 +331,7 @@ impl WastRunner {
let module = parse_module_bytes(&wat.encode().expect("failed to encode module"))
.expect("failed to parse module");
let imports = Self::imports(&mut store, module_registry.modules()).unwrap();
- ModuleInstance::instantiate(&mut store, &module, Some(imports))?;
+ ModuleInstance::instantiate(&mut store, &module, Some(&imports))?;
return Ok(());
}
wast::WastExecute::Get { .. } => panic!("get not supported"),
@@ -376,7 +376,7 @@ impl WastRunner {
let module = parse_module_bytes(&module.encode().expect("failed to encode module"))
.expect("failed to parse module");
let imports = Self::imports(&mut store, module_registry.modules()).unwrap();
- ModuleInstance::instantiate(&mut store, &module, Some(imports))
+ ModuleInstance::instantiate(&mut store, &module, Some(&imports))
});
match res {
Err(err) => test_group.add_result(