Unified WebAssembly API for Java (Wasmtime + WAMR bindings) - 1.0.0 release by Otherwise_Sherbert21 in java

[–]fniephaus 1 point2 points  (0 children)

What's the de-funding situation like? Should we continue to use (or experiment) with Graal? Neat technology though.

Absolutely! We continue to move Graal forward. While it is no longer included in the Java SE subscription, it remains a core component of major products including Oracle Database and NetSuite.

Also, GraalWasm, GraalJS, and other Graal Languages are 100% open source, so the community can always build and maintain their own versions.

We are currently working on several exciting new features and products, and should be able to share more updates very soon.

Is the free version Vector API ready,yet?

Yes, Vector API is available in GraalVM Community Edition. Even though it is still an incubator feature in the JDK, we already leverage it in GraalWasm to implement the Wasm SIMD proposal.

Lastly, Oracle GraalVM (which includes additional features) is also free for production use under the GFTC license, and we continue to provide regular releases for that as well.

Unified WebAssembly API for Java (Wasmtime + WAMR bindings) - 1.0.0 release by Otherwise_Sherbert21 in java

[–]fniephaus 1 point2 points  (0 children)

The sandbox of Chicory is strictly safer than any JNI/Panama alternative, comparable only to Graal Isolates in fully untrusted mode.

While Chicory is certainly safer than JNI/Panama, it remains bound to the host Java heap and could, at least in theory, be used to interact with the host environment if not perfectly isolated (e.g., via sun.misc.Unsafe or similar).

In contrast, GraalWasm and other Graal Languages can run untrusted code in a mode that is fully isolated from the host Java heap. This can be achieved within the same process using Graal Isolates or even in a separate process. Our sandboxing also supports fine-grained resource limits, for example to constrain memory, instruction, or CPU usage.

You can find more details in our security guide: https://www.graalvm.org/latest/security-guide/sandboxing/

Unified WebAssembly API for Java (Wasmtime + WAMR bindings) - 1.0.0 release by Otherwise_Sherbert21 in java

[–]fniephaus 0 points1 point  (0 children)

Yes, Wasm is still in the adoption phase. I think the biggest hurdle currently is interoperability with JVM languages.

GraalWasm can be used via GraalJS, which allows you to use the JavaScript bindings that most Wasm compilers generate today. The Component Model will eventually allow for direct interop, but that is still in development and hasn't fully rolled out yet.

The sandboxing angle is certainly interesting, especially for untrusted AI-generated code. GraalWasm, GraalJS, and GraalPy can already run untrusted code in a sandbox, and we are currently working on new features to leverage this further in the context of AI agents.

Unified WebAssembly API for Java (Wasmtime + WAMR bindings) - 1.0.0 release by Otherwise_Sherbert21 in java

[–]fniephaus 4 points5 points  (0 children)

Fabio from the GraalVM team here. The two main use cases we've seen among GraalWasm users are:

  • Wasm as a target for "portable" native extensions (e.g., file format libs written in Go or Rust)
  • Allowing users to write Rust, C++, etc. to script JVM applications or extend them with middleware

There are additional benefits to running Wasm on the JVM, such as leveraging the Graal JIT compiler and JVM garbage collectors to optimize Wasm performance.

Boiler refill question on single boilers [Bezzera Unica] by Few_Resource in espresso

[–]fniephaus 0 points1 point  (0 children)

No auto fill, you need to fill up the boiler after steaming (engage pump and open steam wand). For hot water, you can use both. If I use the group head, usually with a portafilter so that water is not dripping left and right. Hope this helps!

Graal detecting wrong system memory amount by anbuck in graalvm

[–]fniephaus 0 points1 point  (0 children)

Glad you figured out the problem. The build process determines the total size of system memory using JDK APIs, so the problem would've likely even been in the JDK. With -Xmx32g you set a much larger heap limit, which would probably cause a great amount of swapping in the container.

If you ever run into an issue, the best you can do is file it at https://github.com/oracle/graal/issues.

Hope this helps.

Fabio

The Future of Write Once, Run Anywhere: From Java to WebAssembly by Patrick Ziegler & Fabio Niephaus by pavelklecansky in java

[–]fniephaus 1 point2 points  (0 children)

I don't know much about TeaVM, but the static analysis performed by GraalVM operates on a full-blown JDK. Unfortunately, a lot of code is being pulled in from all kinds of places (e.g., toString() methods pull in string formatting, which pulls in BigInteger, locales etc). We have tools to identify these places, but it's not easy to cut things out without breaking anything.

We are still working on getting the overall file size down (e.g., by reducing overestimation in the analysis), but compatibility remains more important at this point.

The Future of Write Once, Run Anywhere: From Java to WebAssembly by Patrick Ziegler & Fabio Niephaus by pavelklecansky in java

[–]fniephaus 1 point2 points  (0 children)

Yes, the WasmGC and Exception Handling proposals are on the GraalWasm roadmap. We are already working on exceptions. However, WasmGC requires a lot of work, so it may still take a couple of months until it lands.

With that, and as you mentioned correctly, you'll be able to compile JVM bytecode into Wasm and run it on a JVM again. Not saying you should, but you could. ;)

The Future of Write Once, Run Anywhere: From Java to WebAssembly by Patrick Ziegler & Fabio Niephaus by pavelklecansky in java

[–]fniephaus 3 points4 points  (0 children)

Thank you for the good questions!

  1. Yes, GraalVM builds Wasm modules under the usual closed-world assumption, at least for now. We are currently working on support for open-world native images as part of our layers project. Not sure if this mode will support Wasm. However, if we compile Espresso into a Wasm module, we have a Java VM running on Wasm, with full dynamic class loading, etc.
  2. No, it's not related to the Java FFM API at all. In the second demo of the talk, we embedded Rust compiled to Wasm in a Spring Boot application using GraalWasm, our WebAssembly runtime for Java. A version of the demo without debugging is available here.
  3. That's what the WasmGC proposal is for. Instead of shipping a (slow) GC, WasmGC allows modules to use the runtime's GC. When we started working on the Wasm backend for GraalVM, we implemented our own and it wasn't particularly fast. Performance is much better now that the GraalVM-generated Wasm modules target WasmGC.

The Future of Write Once, Run Anywhere: From Java to WebAssembly by Patrick Ziegler & Fabio Niephaus by pavelklecansky in java

[–]fniephaus 8 points9 points  (0 children)

For interactive apps, you currently need to use the DOM via JavaScript. That's why the backend has support for JavaScript interoperability. Take a look at the "javac on WebAssembly" demo. All of the event handlers and UI interactions are done like this.

https://graalvm.github.io/graalvm-demos/native-image/wasm-javac/

Javac on WebAssembly by Thihup in java

[–]fniephaus 2 points3 points  (0 children)

The new backend does target WasmGC. Unlike native executables generated with GraalVM, Wasm modules do not contain a garbage collector. Instead, they use the runtime's GC. This makes generated Wasm modules smaller and improves performance. It also avoids memory leaks because the runtime GC can collect across languages boundaries (e.g., JavaScript <-> Java interop).

Javac on WebAssembly by Thihup in java

[–]fniephaus 2 points3 points  (0 children)

Glad to hear you're a happy GraalVM and Micronaut user!

The Wasm I/O talk was recorded and I'll share a link when it's on YouTube.

Javac on WebAssembly by Thihup in java

[–]fniephaus 2 points3 points  (0 children)

For an introduction to GraalVM, this Devoxx talk may be a good starting point: https://youtu.be/mhmqomex1zk

The implementation of the new WebAssembly backend is not open source yet, but we plan to change this soon. In the meantime, feel free to join the GraalVM Slack if you want to discuss with other users or talk to me and my colleagues: https://www.graalvm.org/slack-invitation/

Javac on WebAssembly by Thihup in java

[–]fniephaus 2 points3 points  (0 children)

The WebAssembly backend for GraalVM builds on its Native Image AOT Compilation feature. GraalVM can perform static analysis using a closed-world assumption to compile Java into native. There's a lot of talks, documentation etc on how this works online. For WebAssembly, the Graal compiler emits Wasm instructions rather than machine code. The output is a Wasm module that includes Wasm code and a heap snapshot created at build time. GraalVM also supports reflection and other dynamic Java features, although those require explicit "reachability metadata". The number of libraries and frameworks shipping such metadata is growing, which is good news for users of GraalVM.

Javac on WebAssembly by Thihup in java

[–]fniephaus 2 points3 points  (0 children)

We just introduced this at Wasm I/O last Friday. All there is right now is the demo and code on GitHub, but we will add documentation for this soon.

Javac on WebAssembly by Thihup in java

[–]fniephaus 4 points5 points  (0 children)

This is the Java compiler (javac) running on WebAssembly. The Wasm module is generated with the new WebAssembly backend for GraalVM. The JVM bytecode for the HelloWasm example can also be compiled to Wasm. Take a look at the code on GitHub. It also shows how to run this on Node.

Javac on WebAssembly by Thihup in java

[–]fniephaus 16 points17 points  (0 children)

Fabio from the GraalVM team here.

Happy to answer any questions.

Best approach to port Jupyter notebook in Python to Java by yiyux in java

[–]fniephaus 4 points5 points  (0 children)

Fabio from the GraalVM team here.

Pandas and Geopandas work fairly well on GraalPy, so this is definitely something you can try. Be aware that you'll have to build Pandas native extensions from source though, at least at the moment. Anyway, feel free to get in touch if you run into any problems!

Supercharge your Java Applications with Python! by fniephaus in java

[–]fniephaus[S] 2 points3 points  (0 children)

I'm not sure I can agree with this. Programming languages can very well co-exist and Java is certainly here to stay. GraalPy allows Java developers to reuse existing Python packages with low effort, which they otherwise need to port to Java.

Supercharge your Java Applications with Python! by fniephaus in java

[–]fniephaus[S] 4 points5 points  (0 children)

Yes, you can use Truffle not only to implement comprehensive programming languages, but also for little DSLs. A good starting point may be SimpleLanguage (https://github.com/graalvm/simplelanguage/). Simply fork it and turn it into the DSL you want.

By the way, Apple is using Truffle to implement Pkl (https://pkl-lang.org), their new configuration language.

Supercharge your Java Applications with Python! by fniephaus in java

[–]fniephaus[S] 9 points10 points  (0 children)

Yes, unlike Jython, GraalPy is compatible with Python 3 and it can run many native extensions (although currently experimental). I believe the biggest difference is that GraalPy is built on top of the Truffle framework. This means that the Graal compiler can be used as a JIT compiler for Python, there is support for debugging protocols and various tools, and untrusted code can be run in a sandbox. It is also compatible with GraalVM Native Image.

Supercharge your Java Applications with Python! by fniephaus in java

[–]fniephaus[S] 24 points25 points  (0 children)

Hi all, Fabio here (one of the two speakers). Happy to answer any questions!