A small Wasm Runtime
This repository was created for the purpose of learning how Wasm works. Please do not use it in production.
If you want to learn how Wasm runtime works, I recommend this book :)
https://skanehira.github.io/writing-a-wasm-runtime-in-rust/
$ cat
(module
(func $add (export "add") (param i32 i32) (result i32)
(local.get 0)
(local.get 1)
(i32.add)
)
)
$ wat2wasm add.wat
$ cargo run -- add.wasm add 1 2
Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Running `target/debug/chibiwasm add.wasm add 1 2`
3use chibiwasm::{Runtime, Value};
fn main() -> anyhow::Result {
let mut runtime = Runtime::from_file("examples/fib.wasm", None)?;
if let Some(output) = runtime.call("fib".into(), vec![Value::I32(10)])? {
println!("output: {}", output);
}
Ok(())
}$ cargo run -q --example fib
output: 89$ cargo make testBase on core 1.
https://www.w3.org/TR/wasm-core-1/
The list is base on https://github.com/WebAssembly/spec/tree/wg-1.0/test/core
NOTE: Checking only the test cases that have passed both assert_return and assert_trap.
This software includes the work that is distributed in the Apache License 2.0.
No open issues yet, or sync has not completed.