0.1.1 — first Maven Central release
First Maven Central release. Cross-built on JVM, Scala.js, and Scala Native; zero external runtime dependencies on the interpreter, one (the interpreter) on the WASI shim.
Install
libraryDependencies ++= Seq(
"io.github.edadma" %%% "wasm" % "0.1.1",
"io.github.edadma" %%% "wasm-wasi" % "0.1.1", // optional — only if you want the WASI shim
)| Coordinate | What you get |
|---|---|
io.github.edadma:wasm:0.1.1 |
The interpreter — Runtime.instantiate, ModuleInstance |
io.github.edadma:wasm-wasi:0.1.1 |
The WASI Preview 1 host shim — depends on wasm |
The wasm-cli runner is built from this repo but not published; it's a runnable example, not a library.
What's in the box
WebAssembly support: the Core MVP plus five post-MVP proposals — ~250 opcodes total.
- Core MVP — every numeric opcode (i32 / i64 / f32 / f64 arithmetic, comparisons, conversions), the full control-flow surface (block / loop / if / br / br_if / br_table / call / call_indirect / return), memory load / store at every width, linear-memory grow, globals (mutable + immutable), tables, element + data segments, function imports + exports, the
startfunction, and multi-value blocks / functions. - Sign-extension —
i32.extend8_s,i32.extend16_s,i64.extend8_s,i64.extend16_s,i64.extend32_s. - Non-trapping float-to-int (Phase 8.A) —
*.trunc_sat_f*_*for every shape. - Bulk-memory (Phase 8.B) —
memory.init,memory.copy,memory.fill,data.drop,table.init,table.copy,elem.drop. - Reference types (Phase 8.C) —
funcref+externrefvalue types,ref.null/ref.is_null/ref.func,table.get/table.set/table.grow/table.size/table.fill, typedselect t*(0x1C). - Multi-memory (Phase 8.D) — the memarg
memidxflag, a vector of memories per module, multi-memory imports/exports, plus aHostFuncMultihost surface for hosts that need to look at the called memidx. - Fixed-width SIMD (Phase 8.E) — the complete SIMD proposal:
V128value type,v128.const, every load + store (includingv128.load{8,16,32,64}_splat,v128.load*_zero,v128.load*x*_s/u,v128.load*_lane,v128.store*_lane), full lane access (splat / extract_lane / replace_lane / shuffle / swizzle), integer + float arithmetic, shifts, min/max, bitwise + reductions, comparisons, narrow / extend / extadd_pairwise / extmul, float ↔ int conversions, demote / promote, andi32x4.dot_i16x8_s.
WASI Preview 1: 24 syscalls implemented end-to-end against either an in-memory FS, a name-only stub preopen, or a real on-disk directory via HostPreopen.fromDir. Real rustc-built wasm32-wasip1 binaries run unchanged — println!, std::fs::read_to_string, and std::fs::write are committed as test fixtures and pass in CI.
Validation up front. Every imported module runs through a separate validator before any code executes. Bad binaries fail at Runtime.instantiate with a function <N>: byte offset 0x<hex>: <details> error, not at run time.
Numbers
- 687 tests on the JVM (521 interpreter + 157 WASI + 9 CLI), all green.
- 521 + 157 also green on Scala.js (Node 20+) and Scala Native (0.5.11).
- Deterministic across all three platforms: every
i32/i64/f32/f64opcode produces bit-identical results, including IEEE-754 edge cases.
External validation: the sysl compiler ships seven backends; one of them (wasm32-WASI) targets this interpreter through the WASI shim. sysl's full standard-library test suite — 973 cases across a large mixed workload — runs end-to-end on wasm 0.1.1 with zero divergence from the reference run on wasmtime.
Cross-build matrix
| Target | Version | Runtime requirement |
|---|---|---|
| Scala | 3.8.3 | — |
| JVM | — | Java 17 or newer |
| Scala.js | 1.21.0 | Node.js 20+ |
| Scala Native | 0.5.11 | Clang |
Try it
git clone https://github.com/edadma/wasm
cd wasm
sbt 'cliJVM/run examples/hello.wasm'
# Hello, world!Or against a real WASI binary with a host preopen:
mkdir -p /tmp/sandbox
echo "Hello from the host filesystem" > /tmp/sandbox/hello.txt
sbt 'cliJVM/run --preopen /tmp/sandbox:/sandbox \
wasi/shared/src/test/resources/fixtures/real_rust_fileread.wasm'
# Hello from the host filesystemDocumentation
Full docs at https://edadma.github.io/wasm/:
- Getting Started — install + run your first module
- Concepts — the validator, host imports, traps and errors
- WASI — the 24 syscalls implemented and the three preopen flavours
- CLI —
--preopen,--invoke,--args, dispatch rules - Reference — supported opcodes, binary sections, error variants
License
ISC.