This is a library and CLI for converting any single WASM module into several JVM class files (usually packaged into a JAR).
$ cargo run --bin wasm2jar foo.wasm --output-class 'me/Foo' --jar foo.jar
The usual cargo commands apply for building and unit tests:
$ cargo build # Compile everything
$ cargo test # Run unit testsSince the specification tests for WebAssembly is encoded in .wast files, there
is also a way to run against a bunch of .wast files at once. This assumes that
javac and java are installed.
$ cargo run --bin wast2jar -- tests/loop.wast # Run the tests in `tests/loop.wast`
$ cargo run --bin wast2jar -- tests # Run all `*.wast` tests in `tests`Some handy tools/techniques for debugging
wat2wasmandwasm2wat(from WABT) for inspecting/manipulating WASMjavap(in JDK) for inspecting generated class filesjshell(in JDK 9+) for running the output (jshell --class-path foo.jar)cfrfor decompiling JVM bytecode into Java codehexdumporxxdfor debugging serialized class files