Hi folks,
I'm curious to run WASM+WASI on the JVM. So far I've found the following options
Of these, embedded wasmtime into the JVM via FFI seems like the most promising to get results in the shortterm across a wide range of virtual machines, but the 1st and 3rd are pretty interesting longer term options. Does anyone know of any other bindings to wasmtime from Java?
the kotlin peepz have made I think the most progress in javaland.....
links?
https://github.com/Kotlin/kotlin-wasm-examples
a wide spectrum of examples
it would of course depend on what you really want to do, obvs
thanks!
I'm pretty sure that is "Kotlin targeting Wasm", not "Kotlin targeting JVM that works on Wasm"
@Joel Dice may have something to say about Wasm on JVM
@nikomatsakis I've done some research and work on transpiling JVM bytecode to Wasm/WASI (e.g. TeaVM-WASI), but it sounds like you're interested in hosting Wasm+WASI in a JVM, which is orthogonal. I don't have much experience with that, so you probably already know more than I do, but I agree that JNI (the JVM's FFI mechanism) is likely your best bet.
The main issue with that approach is that not all of Wasmtime's public API is exposed as part of its C bindings. Specifically, WASIp2 is based on the Component Model, and last time I checked little or none of Wasmtime's CM API is available via C. That's partly because the statically-typed, high performance Rust API relies pretty heavily on proc macros and generics, so it's not clear how to translate that into C, although there's also a dynamic (though somewhat less efficient) API that would be easier to translate.
Improvements to the Wasmtime C bindings would enable not only more complete JVM bindings, but also wasmtime-py
, wasmtime-go
, etc., so they would be most welcome.
Lann Martin said:
I'm pretty sure that is "Kotlin targeting Wasm", not "Kotlin targeting JVM that works on Wasm"
ooops, you're right!
@nikomatsakis the team is advancing pretty quickly wrt AoT support on Chicory! https://github.com/dylibso/chicory/pull/395
obviously, avoiding FFI has the usual benefits of playing nicely with the JVM runtime (e.g. wrt JVM's threading/GC etc). If you want to chat with the team you can join their Zulip too https://chicory.zulipchat.com
@Edoardo Vacchi super cool!
I'd love to chat about chicory but I need an invite for the zulip
I forgot you need an invite, there you go https://chicory.zulipchat.com/join/g4gqsxoys6orfxlrk6hn4cyp/ @nikomatsakis
Last updated: Nov 26 2024 at 00:12 UTC