Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.
/ wabi Public archive

A WASM runtime written in rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

fisherdarling/wabi

Repository files navigation

WebAssembly Binary Interpreter

Wabi is a highly experimental interpreter of WebAssembly bytecode. Current functionality includes parsing, instantiating, and executing self contained, single-module WebAssembly.

Quick Start

Since the crate is not yet published, clone the repository and add it to your Cargo.toml:

[dependencies]
wabi = { version = "*", path = "path/to/wabi" }

Add some imports:

use wabi::{args, runtime::ModuleInstance};

Load a module from some bytes, create some arguments, and execute a function:

use wabi::{args, runtime::ModuleInstance};

fn main() {
    let input = byte_slice;
    let args = args![5_i32, 5_i32];

    let mut instance = ModuleInstance::builder()
        .bytes(input)
        .build()
        .unwrap();

    let res = instance.invoke("add", &args).unwrap();

    println!("{:?}", res);
}

Running a .wast file:

cargo run --bin run_wast -- -f ./path/to/testsuite/labels.wast

================ ./path/to/testsuite/labels.wast ================
[MODULE] Name: None
[0291] [PASSED] block
[0292] [PASSED] loop1
[0293] [PASSED] loop2
/* snip */
[0308] [PASSED] return
[0313] [PASSED] br
[0314] [PASSED] shadowing
[0315] [PASSED] redefinition

Pass in multiple files to run them all.





License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Highly experimental, do not use!

About

A WASM runtime written in rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published