This changelog summarizes major changes to the WebAssembly engine implemented in GraalVM (GraalWasm).
- Adopted a bytecode-handler-based design for the WebAssembly interpreter, improving interpreted performance on Native Image.
- Implemented the exception handling proposal. This feature is enabled by default and can be disabled with the experimental option
wasm.Exceptions=false. - Implemented the legacy exception handling proposal. This feature is disabled by default and can be enabled independently with the experimental option
wasm.LegacyExceptions=true. - Implemented the typed function references proposal. This feature is enabled by default and can be disabled with the experimental option
wasm.TypedFunctionReferences=false. - Enabled the standardized features Extended Constant Expressions, Multiple Memories, and Relaxed SIMD by default.
- Implemented the GC proposal proposal. This feature is enabled by default and can be disabled with the experimental option
wasm.GC=false.
- BREAKING: Changed Context.eval of wasm sources to return a compiled, but not yet instantiated, module object instead of the module instance.
To instantiate the module, you have to call
newInstance()on the module object now, e.g.:This change enables modules to be instantiated multiple times—and run independently—within the same context. Previously, each module could only be instantiated once per context.Context c = Context.create(); Source wasmSource = Source.newBuilder...; Value module = c.eval(wasmSource); Value instance = module.newInstance(); // < 25.0: c.eval(wasmSource)
newInstance()optionally also accepts an import object, similar to the JS WebAssembly API, as well as other modules to be linked together with the module. The previous behavior can still be restored with the experimental option--wasm.EvalReturnsInstance=true. Note: Modules instantiated usingmodule.newInstance()are not accessible viacontext.getBindings("wasm"), unlike modules instantiated usingcontext.evalwhen using--wasm.EvalReturnsInstance=true. - BREAKING: Exports are no longer exposed as direct members of the module instance.
Use the
exportsmember of the module instance to access its exports, e.g:.This aligns with the JS WebAssembly API and allows other members to be introduced on the module instance without potential name clashes. More information about these API changes and examples can be found in the GraalWasm Polyglot API Migration Guide and the Readme.Value mainFunction = instance.getMember("exports").getMember("main"); // < 25.0: instance.getMember("main")
- Implemented support for editing primitive values during debugging. Fixed several debugger-related issues.
- Added an implementation of the SIMD proposal using the JDK's Vector API. This improves peak performance when running WebAssembly code which makes heavy use of the new instructions in the SIMD proposal. This new implementation is always used in native image. On the JVM, it is opt-in and requires setting
--add-modules=jdk.incubator.vector. Use of the incubating Vector API will result in the following warning message being printed to stderr:WARNING: Using incubator modules: jdk.incubator.vector
- Updated developer metadata of Maven artifacts.
- Deprecated the
--wasm.AsyncParsingBinarySizeand--wasm.AsyncParsingStackSizeoptions. These options no longer have any effect and will be removed in a future release. - Implemented the Relaxed SIMD proposal. This feature can be enabled with the option
--wasm.RelaxedSIMD.
- Implemented the SIMD proposal. This feature is enabled by default and can be disabled with the option
--wasm.SIMD=false. - Implemented
clock_res_get,fd_advise,fd_datasync,fd_fdstat_set_rights,fd_filestat_set_size,fd_pread,fd_pwrite,fd_readdir,fd_renumber,fd_syncandfd_tellinwasi_snapshot_preview1.
- Implemented the extended const expressions proposal. The feature can be enabled with the option
--wasm.ExtendedConstExpressions=true.
- Added experimental debugging support for DWARFv4. This enables debugging of C, C++, and Rust applications.
- Added experimental support for Memory64. The feature can be enabled with the option
--wasm.Memory64=true. - Implemented the Bulk-Memory and Reference-Types proposal. They can be disabled with the option
--wasm.BulkMemoryAndRefTypes.
- Implemented the Multi-Value proposal. It can be disabled with the
option
--wasm.MultiValue=false. - Sign-Extension-Ops and Saturating-Float-To-Int conversions are now enabled by default.
- Changed the representation of WebAssembly control flow structures to a flat model. Loops and branches are now represented by jumps rather than separated AST nodes.
- Implemented the Sign-Extension-Ops proposal. It is available
behind the experimental option
--wasm.SignExtensionOps. - GraalWasm adopted the new Frame API.
- (GR-32924) Added support for importing and exporting mutable globals to GraalWasm, as defined by the respective WebAssembly proposal: https://github.com/WebAssembly/mutable-global/blob/master/proposals/mutable-global/Overview.md
- (GR-26941) Moved the module-validation checks to an earlier stage, so that the module is completely validated during
parsing, instead of being validated late, during linking and instantiation. All validation errors are now properly
reported when
Context#evalfrom the Polyglot API is invoked, and similarly when invokingWebAssembly.validatefrom the JS-WebAssembly Interface API. - (GR-33183) Memory-access performance was improved by avoiding a branch due to a out-of-bounds check.
- (GR-32714) Loop-profiling in GraalWasm was made more accurate to enable more loop optimizations.
- (GR-33227) Changed the Interop objects in GraalWasm to allow object-caching in the JS-WebAssembly Interface: https://webassembly.github.io/spec/js-api/index.html#object-caches
- (GR-32356) Fixed a bug that caused an overflow during memory or table initialization.
- (GR-33296) Added notifications to JavaScript when the memory grows (i.e., when
mem_growinstruction executes). This improves the compliance of the JS-WebAssembly Interface API. - (GR-33333) Added support for
BigInt-to-i64conversion in the JS-WebAssembly Interface API: https://github.com/WebAssembly/JS-BigInt-integration - (GR-32590) Improved internal implementation of GraalWasm to make JS-WebAssembly Interface API more compliant.