What’s new in Graal Languages 24.1
Today, along with GraalVM for JDK 23, we are also releasing a new version of Graal Languages: 24.1. This version is designed for use with GraalVM for JDK 23, but it is also compatible with GraalVM for JDK 21 (LTS). Let’s look at what’s inside this release!
You can also check out our release stream:
First stable release of GraalPy and GraalWasm 🚀
GraalPy and GraalWasm are now considered stable! You can use them to run your production workloads (you can also get support via Oracle GraalVM). For GraalPy, at the moment we prioritize pure Python code and Jython use cases. As you might remember, embedding the languages in Java is now as easy as adding two Maven dependencies — see how you can get started for your project, or try out our demo.
GraalPy 🐍
GraalPy is now ready for production workloads! 🎉
Our priority is on pure Python code and Jython use cases. While many Python packages such as numpy that leverage native extensions work, their use is still considered experimental. You can use the command-line option --python.WarnExperimentalFeatures
to enable warnings for such modules at runtime. In Java embeddings, the warnings are enabled by default and you can suppress them by setting the context option python.WarnExperimentalFeatures
to false
.
Our Python version is now updated to 3.11.7.
The _pickle
module is now intrinsifed, providing a better developer experience.
polyglot.eval
now raises more meaningful exceptions. Unavailable languages raise aValueError
. Exceptions from the polyglot language are raised directly as interop objects (typed as polyglot.ForeignException
). The shortcut for executing Python files without specifying language has been removed, use regular eval
for executing Python code.
In Jython emulation mode, we now magically fall back to calling Java getters or setters when using Python attribute access for non-visible properties. This can help migrating away from Jython if you rely on this behavior.
The option python.EmulateJython
to enable Jython emulation is now marked as stable, and can thus be relied upon in production.
Also, GraalPy now uses https://www.graalvm.org/python/wheels/ as the default value for the --extra-index-url
pip option. This allows you to download pre-built binaries for popular Python packages instead of building from source. Let us know what other packages you want to use with GraalPy in the future. And feel free to also reach out to Python package maintainers to ask them to test with and build wheels for GraalPy (such as via setup-python
).
GraalJS
- The JavaScript WebAssembly API is now a stable feature of GraalJS and is supported as part of Oracle GraalVM.
- ECMAScript 2024 Language Specification enabled by default.
- Implemented several new proposals: Make eval-introduced global vars redeclarable, Float16Array, Array.fromAsync, Resizable and Growable ArrayBuffers
GraalWasm
In addition to going stable, we have several new features in this release.
- We implemented the SIMD proposal. This feature is enabled by default and can be disabled with the option
--wasm.SIMD=false
. - We also 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_sync
andfd_tell
inwasi_snapshot_preview1
.
Espresso (Java on Truffle)
- Espresso can now use TRegex to execute
java.util.regex
patterns. TRegex offers better performance than the standard implementation. Usejava.UseTRegex
to enable this engine. - Fixed several JDWP compatibility issues improving the user experience when debugging Java on Truffle with a Java IDE.
- Added the
org.graalvm.continuations
package, along with support forcontinuations
. The continuations feature of the Espresso VM allows you to control the program stack. When a continuation is suspended the stack is unwound and copied onto the heap as ordinary Java objects. When a continuation is resumed those objects are put back onto the stack, along with all the needed metadata to resume execution at the pause point. The heap objects can be serialized to resume execution in a different JVM running the same code (e.g. after a restart). - See the Espresso Continuations documentation for more details.
TruffleRuby
- TruffleRuby updated to Ruby 3.2.4.
- Many compatibility and bug fixes, as well as significant performance improvements, see the full changes.
Virtual threads for Graal Languages 🎉
We have implemented one of the features highly anticipated in our languages community — virtual threads. At the moment this feature is experimental, and it’s available for Graal Languages running on JVM and on Native Image. It also works on GraalVM for JDK 21 in JVM mode thanks to Truffle Unchained. On Native Image it uses one physical thread per virtual thread.
Protecting Against Stack Overflows
We also have added the option engine.InterpreterCallStackHeadRoom
to protect against stack overflow in the middle of a guest method execution in the interpreter, Enabled random offsets of runtime compiled functions entry points for the UNTRUSTED
polyglot sandbox policy. GraalVM additionally pads the starting offset of functions with a random number of trap instructions which helps prevent a potential JIT spray attack.
Truly Memory Safe JIT Compilers
Check out this excellent blog post from Mike Hearn, where he talks about how an entire class of safety bugs is eliminated in Graal languages, such as GraalJS: because the semantics of the language are defined by the memory-safe interpreter and then partially evaluated, the generated machine code is also memory safe by construction.
Community and Ecosystem
- GraalJS meets IntelliJ IDEA! ❤️ They have upgraded the JavaScript execution engine used in the HTTP Client to GraalJS. This enables using all GraalJS features, including full support for the ECMAScript 2023 specification, when testing endpoints with IntelliJ IDEA’s HTTP Client and using JavaScript in
.http
files to handle the results.
- Apple have announced their new configuration language, Pkl, which is built on top of Truffle. It lets you define your data and then generate output for JSON, YAML, Property Lists, and other configuration formats.
Conclusion
We’d like to take this opportunity to thank our amazing contributors and community for all the feedback, suggestions, and contributions that went into this release.
If you have feedback for this release or suggestions for features that you would like to see in future releases, please share them with us on Slack, GitHub, or Twitter.
— the GraalVM team