Skip to content

1.4.7

Choose a tag to compare

@CharlieTap CharlieTap released this 19 Jun 17:32
· 96 commits to main since this release

Whats Changed

Added WasmJS support to the Gradle plugin

Chasms Gradle plugin now supports wasmJs targets alongside the existing JS support.

Similar to the JS target this does not use Chasms interpreter in the browser, it uses the browsers built in WebAssembly runtime and generates the Kotlin bindings around that. This means users can now consume generated Chasm bindings from Kotlin/WasmJS projects in the same way they already could from Kotlin/JS.

I've also updated the example project so the same web demo proves both JS and WasmJS support.

Fixed browser type inference

Historically the web VM used WebAssembly type reflection to work out the result types coming back from exported functions. That API came from the experimental JS types proposal, which has recently been demoted and appears to have disappeared from browsers.

Instead of relying on browser support for reflection, the Gradle plugin now wires through the Wasm types that Chasm already decoded at codegen time.

Added host interop APIs for GC and externref values

This release adds a set of lower level public APIs for observing and manipulating reference values from host code.

There are now helpers for reading and writing struct fields, reading and writing array elements, reading array lengths, creating externref values and reading host values back out of extern refs. These are also available from HostFunctionContext, which makes it much easier to write host functions that bridge interpreted Wasm code with the outside world.

This should make Chasm much more useful for Kotlin/Wasm interop style programs where host functions need to inspect strings, arrays, structs or mock external JS values.