WASM on the JVM Ships Under the Bytecode Alliance

9 pointsposted 5 hours ago
by dustingetz

3 Comments

fwsgonzo

5 hours ago

Is this going to be a way to execute emscripted-built projects locally? Or is the target something else entirely, like WASM interacting with Java?

cchianel

an hour ago

Think of WASM as a kinda universal library target. You can compile C, Rust, C#, Java to WASM, and then you can use it in a different language from the source. This way, Java can run C or Rust code without going through a FFI (foreign function interface). From the article, one example is porting tree-sitter (a C library) to Java by first compiling it to WASM, then use Endive to access its function.

As an example of how it can be used, you can look at https://github.com/Christopher-Chianelli/timefold-wasm-servi... and https://github.com/Christopher-Chianelli/timefold-wasm-c-cli..., which was an experiment I did to try using C code inside Timefold Solver (a Java library that can be used to solve constraint problems like Employee Scheduling and Vehicle Routing).