New Truffle and GraalVM Languages release
A new GraalVM release has just arrived! Let’s see what’s in it for Truffle and GraalVM languages.
Truffle Unchained
GraalVM’s polyglot language runtime, Truffle, and language runtimes are now decoupled from the GraalVM JDK. Standalone language runtimes are available for download in native and JVM standalone versions. For embedding in Java applications, you can download all artifacts from Maven Central, which will work for GraalVM JDK and any other compatible JDK. Let’s take a closer look at what has changed and navigate to the dedicated blog post for more details.
Standalone Language Runtimes
GraalVM language runtimes (for JavaScript, Python, Ruby, Java on Truffle, WebAssembly, and LLVM) can now be downloaded as standalone distributions from GitHub.
Each language standalone comes in two modes:
- Native: Ahead of time compiled language runtime with instant startup;
- JVM: JVM-based runtime with full Java interoperability.
Additionally, there are versions of each standalone for Community Edition (marked with the -community
suffix) and GFTC-based Oracle GraalVM.
Polyglot Embedding
Previously, to embed GraalVM languages in Java applications, you had to install them using the gu
tool. Now all languages are available as Maven dependencies. You can find all artifacts relevant to embedders in the Maven dependency group org.graalvm.polyglot
.
For example, to enable Python embedding in your Java program, add the following to your pom.xml
:
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>23.1.0</version>
</dependency>
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>python</artifactId>
<version>23.1.0</version>
<type>pom</type>
</dependency>
See the polyglot embedding demo on GitHub for a complete project example.
As language runtimes can now be installed as Maven/Gradle dependencies, we are now deprecating and removinggu
. See the related ticket for how to enable each language in GraalVM for JDK 21+.
Find more details about Truffle Unchained in the related blog post.
GraalVM SDK changes
The GraalVM SDK is now split into four fine-grained modules:
org.graalvm.nativeimage
: The public API of Native Image for advanced use cases.org.graalvm.polyglot
: A library that allows users to embed polyglot language implementations in Java.org.graalvm.word
: A low-level library for machine-word-sized values in Java.org.graalvm.collections
: A collections library for GraalVM components.
Note that all GraalVM APIs remain compatible in this release.
Now, let’s look at what’s new for each language.
JavaScript
JavaScript language standalone distributions are available on GitHub.
For embedding in Java programs, use the following Maven coordinates (js
for Oracle GraalVM and js-community
for Community Edition):
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js</artifactId>
<version>23.1.0</version>
<type>pom</type>
</dependency>
Note that GraalVM no longer ships with a “js” ScriptEngine. To enable it, use the Maven dependency or explicitly put js-scriptengine.jar
on the module path.
Also, in this release, we enabled the ECMAScript 2023 features by default and updated Node.js to version 18.17.1.
We also added several new options — see more details in the changelog.
What’s new in GraalPy 🐍
GraalPy is now also available under the GFTC license! You can get both CE and GFTC builds from GitHub.
You can also install GraalPy standalone with pyenv
:
# To install Oracle GraalPy
pyenv install graalpy-23.1.0
# To install GraalPy Community Edition
pyenv install graalpy-community-23.1.0
GraalPy now also provides a distribution for Windows. It’s a first preview of Windows support for GraalPy, and there are limitations, but pure Python packages like Pygal work and can be installed with python -m pip --no-cache install pygal
.
We added support for the sqlite3
module. This allows many packages like coverage
or Flask-SQLAlchemy
to work on top of this embedded database.
The GraalPy standalone tool now enables building single-file executable Python binaries for Linux, Windows, and macOS.
We are also contributing support for GraalPy to the GitHub setup-python
action. This is still work in progress, but we hope you’ll be able to use GraalPy in GitHub Actions soon.
TruffleRuby
Just like other GraalVM languages, TruffleRuby now comes in two standalone modes, native
and jvm
, available on GitHub .
The TruffleRuby Native standalone on Oracle GraalVM on Linux now uses the G1 GC, which provides significant performance improvements.
Also, the Ruby version in the release was updated to 3.2.2.
gu install $LANGUAGE
has been replaced by truffleruby-polyglot-get $LANGUAGE
, available in the TruffleRuby JVM standalone, see the docs for more details.
See more changes and improvements in the release notes.
Conclusion
We want to take this opportunity to thank our community for all the feedback, suggestions, and contributions that went into this release. If you have additional feedback on 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.
And for the GraalVM JDK and Native Image updates, please visit the related blog post.
Now go ahead and try the new GraalVM!🚀
— the GraalVM team