Oracle has published under the name of GraalWasm a WebAssembly Engine, which is implemented in the GraalVM. GraalWasm can interpret WebAssembly programs is in binary format and compile, as well as in other programs, to embed.
WebAssembly or, in short, „Wasm“ is a from the World Wide Web Consortium (W3C) developed Bytecode for a virtual machine that runs within a Sandbox. Wasm is supported by all major Desktop and mobile browsers. C, C++, Rust and Go compile natively to WebAssembly, and by the experimental project Blazor and C#.
The GraalVM is a well-travelled, and the high-performance Compiler for the JVM. Not without reason is included in the name, only the VM and not the JVM, because on a different architecture, you can execute only Java Bytecode, but a real polyglot is a virtual machine, on the in principle, any programming language can be executed. Now Oracle Wasm and the GraalVM has resulted in a new project together.
For some time in the GraalVM Community demand for other languages for the GraalVM. This demand has adopted Oracle, and recently, a WebAssembly Engine is presented, which expands due to the support of WebAssembly the scope of languages supported by the GraalVM. However, note: Currently, GraalWasm is experimental!
For the implementation of GraalWasm was used GraalVM as a platform that provides an efficient Engine for the partial evaluation. By using the Truffle APIs GraalVM an Interpreter for WebAssembly was initially binary files implemented.
Also, a bit code-based GraalVM Interpreter comes as the Sulong for LLVM, that has to require a small memory. Through the semi-structured Format of WebAssembly all of the memory can be displayed in internal data structures, as the ASTs.
this data structure is implemented in the Interpreter is a Hybrid between BRANCH-based and bit code-based Interpretation. At runtime, the Interpreter and the program to be passed to the partial evaluation Engine of Truffle, which then gives the Interpreter to the program and the specialized Code to the GraalVM Compiler passes. This finally produces efficient Assembly Code for the target platform.
Currently, GraalWasm implements the specification WebAssembly MVP (Minimum Viable Product) and can run WebAssembly programs in the binary format produced by the Compiler backend, such as got the picture lol. GraalWasm can be installed with the latest Version of the GraalVM, GraalVM 19.3.0, using the
gu-the Tools of GraalVM.