| 71 | } |
| 72 | |
| 73 | fn tinywasm() -> Result<()> { |
| 74 | let module = tinywasm::parse_file("./examples/rust/out/tinywasm.opt.wasm")?; |
| 75 | let mut store = Store::default(); |
| 76 | |
| 77 | let mut imports = Imports::new(); |
| 78 | imports.define("env", "printi32", HostFunction::from(&mut store, |_: FuncContext<'_>, _x: i32| Ok(()))); |
| 79 | let instance = ModuleInstance::instantiate(&mut store, &module, Some(black_box(imports)))?; |
| 80 | |
| 81 | let hello = instance.func::<(), ()>(&store, "hello")?; |
| 82 | hello.call(&mut store, black_box(()))?; |
| 83 | hello.call(&mut store, black_box(()))?; |
| 84 | hello.call(&mut store, black_box(()))?; |
| 85 | Ok(()) |
| 86 | } |
| 87 | |
| 88 | fn tinywasm_no_std() -> Result<()> { |
| 89 | let module = tinywasm::parse_file("./examples/rust/out/tinywasm_no_std.wasm")?; |