54 releases (breaking)

new 0.39.1 Nov 6, 2024
0.38.0 Oct 6, 2024
0.36.0 Jul 24, 2024
0.32.0-beta.8 Mar 23, 2024
0.1.1 Mar 24, 2018

#2 in WebAssembly

Download history 95725/week @ 2024-07-17 98590/week @ 2024-07-24 77304/week @ 2024-07-31 111319/week @ 2024-08-07 104608/week @ 2024-08-14 90317/week @ 2024-08-21 107005/week @ 2024-08-28 108660/week @ 2024-09-04 108601/week @ 2024-09-11 108768/week @ 2024-09-18 97675/week @ 2024-09-25 117783/week @ 2024-10-02 116861/week @ 2024-10-09 118444/week @ 2024-10-16 113846/week @ 2024-10-23 119099/week @ 2024-10-30

488,642 downloads per month
Used in 349 crates (45 directly)

MIT/Apache

2.5MB
58K SLoC

Continuous Integration Test Coverage Documentation Crates.io
ci codecov docs crates

Wasmi - WebAssembly (Wasm) Interpreter

Wasmi is an efficient and lightweight WebAssembly interpreter with a focus on constrained and embedded systems.

Version 0.31.0 has been audited by SRLabs.

Distinct Features

The following list states some of the distinct features of Wasmi.

  • Simple, correct and deterministic execution of WebAssembly.
  • Low-overhead and cross-platform WebAssembly runtime for embedded environments.
  • JIT bomb resisting translation.
  • Loosely mirrors the Wasmtime API.
  • 100% WebAssembly spec testsuite compliance.
  • Built-in support for fuel metering.
  • Supports the official Wasm C-API.

Usage

Refer to the Wasmi usage guide to learn how properly to use Wasmi.

WebAssembly Proposals

The new Wasmi engine supports a variety of WebAssembly proposals and will support even more of them in the future.

WebAssembly Proposal Status Comment
mutable-global 0.14.0.
saturating-float-to-int 0.14.0.
sign-extension 0.14.0.
multi-value 0.14.0.
bulk-memory 0.24.0. (#628)
reference-types 0.24.0. (#635)
tail-calls 0.28.0. (#683)
extended-const 0.29.0. (#707)
multi-memory 0.37.0. (#1191)
simd Unlikely to be supported.
relaxed-simd Unlikely to be supported. Depends on simd.
function-references 📅 Not yet implemented. (#774)
gc 📅 Not yet implemented. (#775)
threads 📅 Not yet implemented. (#777)
exception-handling 📅 Not yet implemented. (#1037)
custom-page-sizes 📅 Not yet implemented. (#1197)
WASI 👨‍🔬 Experimental support for WASI (wasip1) via the wasmi_wasi crate.
C-API 👨‍🔬 Experimental support for the official Wasm C-API via the wasmi_c_api_impl crate.

Development

Build & Test

Clone the Wasmi repository and build using cargo:

git clone https://github.com/wasmi-labs/wasmi.git --recursive
cd wasmi
cargo build
cargo test

Benchmarks

In order to benchmark Wasmi use the following command:

cargo bench

Use translate, instantiate, execute or overhead filters to only run benchmarks that test performance of Wasm translation, instantiation, execution or miscellaneous overhead respectively, e.g. cargo bench execute.

Supported Platforms

Wasmi supports a wide variety of architectures and platforms.

  • Fore more details see this list of supported platforms for Rust.
  • Note: Wasmi can be used in no_std embedded environments, thus not requiring the standard library (std).
  • Only some platforms are checked in CI and guaranteed to be fully working by the Wasmi maintainers.

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.

Dependencies

~2MB
~35K SLoC