The GraalVM 22.3 release delivers several new features including much anticipated support for Java 19 along with preview support for Project Loom virtual threads in both JVM JIT and Native Image ahead-of-time compiled applications. The release also includes compiler performance improvements, new monitoring and debugging features in Native Image, Python enhancements, and a new name for GraalPython!
Java 19 support arrives in GraalVM 22.3 for Java and Native Image. Java 19 introduces language improvements from project Amber (Record Patterns and Pattern Matching for Switch), library enhancements to interoperate with non-Java Code (Foreign Function and Memory API), and the ability to leverage vector instructions (Vector API) from project Panama. It also adds preview support for Project Loom (Virtual Threads and Structured Concurrency).
Loom's virtual threads are a huge step forward for Java and can drastically reduce the effort required to write and maintain high-throughput, concurrent applications in Java. Now in GraalVM 22.3 for JDK 19 there's preview support for virtual threads. Native Image ahead-of-time compiled applications using vitual threads exhibit the same low resource requirements typically seen in native executables. This was demonstrated in a recent Devoxx conference session using a version of Conway's Game of Life that uses virtual threads with Native Image.
The JDK jlink utility generates a generates a custom runtime image that contains just the modules you need to run an application. Now in GraalVM 22.3 you can run jlink to generate a custom runtime image that uses the optimizing Graal JIT compiler for small high-performance application--these are ideal for use in containers when Native Image is not suitable.
GraalVM 22.3 introduces a new Graal JIT compiler optimization that uses a separate isolate for each compilation thread. This change resulted in a significant 38% improvement in compilation speed on Renaissance, DeCapo, and Scala-DeCapo benchmarks. This optimization is enabled by default and requires no configuration change.
As GraalVM Native Image adoption continues to grow, additional developer tools and production monitoring and debugging support is needed. For monitoring, GraalVM 22.3 adds new JDK Flight Recorder (JFR) events (JavaMonitorEnter, JavaMonitorWait, and ThreadSleep) that build on the previous support for custom JFR events. JFR support will continue to be enhanced until it is on par with the JVM to ensure that ahead-of-time compiled applications enjoy the same level of support as JIT applications.
Performance analysis of native executables is improved with new support for the Linux perf command so that perf report prints Java method names in its output histogram. This means you can map native machine code performance issues to your original Java source. You can read more about using perf and valgrind in the GraalVM documentation.
GraalVM 22.3 provides initial support for jvmstat along with a new command line option to enable it. The -enable-monitoring=<all,heapdump,jfr,jvmstat> option provides fine-grained control over monitoring features included in native executables. The -H:+AllowVMInspection option is now deprecated.
GraalVM support for Python has some big advances in the 22.3 release and also gets a name change. Starting with GraalVM 22.3, "GraalPython" is now "GraalPy". In accordance with this change, the launcher has been renamed to graalpy and symlinks from python and python3 are added to provide better integration with other tools.
GraalPy pip support is enhanced to automatically choose the best version for a known package. For example, "pip install pandas" selects the versions of pandas and numpy that have been tested with GraalPy. And with the addition of support for the sys.settrace API, you can now use GraalPy in PyCharm as the standard Python interpreter and with other standard tools.
GraalVM is known for its excellent performance and that applies to Python with a number of improvements in the 22.3 release including:
The 22.3 release is the culmination of a year of innovation and hard work that has delivered exciting new Java features such as preview support for Loom virtual threads in native executables, improved performance, enhanced usability to improve developer productivity, and many more features than can be covered in this short blog. For a complete list of all the changes, please see the full GraalVM 22.3 release notes.
Shaun Smith leads product management of Oracle Lab's GraalVM.