Happy New Moon with Report is an open-source implementation of WebAssembly written entirely in Java for the JVM environment. The goal is to run wasm code on the command line or embedded in a larger application.
Happy New Moon with Report doesn't concern itself with the production of the WASM binary files; these files are produced with another tools such as Emscripten, wabt or binaryen or any of the number of languages that can output to WebAssembly such as Rust.
Happy New Moon With Report fills the same goals as WasmTime for the JVM environment.
Think of Happy New Moon With Report as the Rhino of Web Assembly. Rhino runs JavaScript in Java; Happy New Moon with Report runs WebAssembly in Java.
Happy New Moon With Report has nothing to do with reporting or fireworks.
For a list of Web Assembly languages see: Awesome WASM languages.
Wasm wasm = new Wasm("your Web Assembly Module.wasm");
wasm.exports().yourFunction();
Load HelloWorld.wasm
file and call the HelloWorld()
function in Java;
Wasm wasm = new Wasm("HelloWorld.wasm");
System.out.println(wasm.exports().HelloWorld());
The main object is in Wasm.java.
This opens the wasm module(*.wasm), parses the web assembly sections such as
The main loop of the interpreter is in WasmInstance.Java.
In the execute(BytesFile)
function an opcode is decoded and executed.
See WasmAdd32Test.Java This will need to be simplified in future revisions, It is currently a bit of a mess.
The wasm module is in the add32 folder.
This folder also contains the wasm text files and notes on the bytes in the wasm module.
@Test
public void testHelloWorld throws Exception {
Wasm wasm = new Wasm("HelloWorld.wasm");
assertEquals("Hello World", wasm.exports().HelloWorld());
}
WasmTime is same for the Rust language.
For the 'Go' language: Wagon (https://github.com/go-interpreter/wagon).
A Web Assembly virtual Machine written in C/C++: WAVM (https://github.com/WAVM/WAVM).
'Life' is a secure & fast WebAssembly VM built for decentralized applications, written in Go (https://github.com/perlin-network/life).
For a list of Web Assembly Run times at Awesome WASM runtimes.
To compile Java to WebAssembly use ByteCoder
All I32 and I64 instruction are complete.
F32 Math, Bitwise, and Comparison opcodes completed. Only Conversions remain.
F64 Bitwise, Comparison opcodes completed. Math and Conversions remain.
128 opcodes completed.
Branching opcodes: 9 remaining. Other opcodes: 5 remaining; Floating point opcodes: 42 remaining.
[Source] (http://webassembly.org/docs/binary-encoding/#module-structure)
Custom (a.k.a Name) section : Completed
Type Section : Completed
Import Section: To Do
Function Section: Completed
Table Section: Completed
Memory Section: Completed
Global Section: Completed
Export Section: Completed
Start Section: Completed
Code Section: See Opcodes list below.
Data Section: To Do
[Source] (https://webassembly.github.io/spec/core/appendix/index-instructions.html)