#portable #run #everywhere #intended #llvm

nightly no-std wasm-core

Portable WebAssembly implementation

19 releases

Uses old Rust 2015

0.2.15 May 3, 2018
0.2.14 May 3, 2018
0.2.13 Apr 29, 2018
0.2.2 Mar 31, 2018
0.0.0 Mar 11, 2018

#6 in #everywhere

28 downloads per month
Used in 3 crates

LGPL-3.0

455KB
11K SLoC

wasm-core

Crates.io

Portable WebAssembly implementation intended to run everywhere.


Features

Efficient

wasm-core includes two execution engines, an interpreter and a JIT based on LLVM. While the former one is mainly for use on platforms with constrained resources or not supported by LLVM MCJIT, the latter one is designed for high performance and should be used whenever possible.

With LLVM optimizations and on-demand compilation, the JIT engine of wasm-core is able to achieve near-native performance on x86-64.

Portable

wasm-core supports no_std. This means that it can run on any platforms with libcore and liballoc available, which include a lot of embedded devices and even OS kernels.

Secure

The default execution environment is fully sandboxed, which means that user code cannot access the outside environment without explicit native imports.

Easy integration

External functions can be easily imported by implementing the NativeResolver trait and exported WebAssembly functions can be easily called from outside. See Ice Core as an example.

How to use

Instead of loading WebAssembly files directly, wasm-core takes code in an IR format generated from the raw WebAssembly code by the wasm-translator crate under translator/.

See Ice Core as an example for executing pure-wasm code and wa/ as an example for executing wasm generated by Emscripten. (note: support for Emscripten-generated code may be removed in the future once the WebAssembly backend of LLVM becomes stable and fully usable from clang. )

Bugs

See issues with the bug tag.

Contribute

Contribution to this project is always welcomed! Open a pull request directly if you've fixed a bug and open a issue for discussion first if you want to add new features.

Dependencies

~0.3–8.5MB
~130K SLoC