Oracle’s latest update to the GraalVM multi-language runtime offers compiler and native image usability improvements, along with enhancements geared to specific languages.
GraalVM 21.2, published July 20, is available among community and enterprise editions from the project website.
For the compiler, the update features optimisations including improved loop limit analysis for counted loops, enabling the compiler to analyse control flow preceding the loop to reason about induction variables. This can make more uncounted loops amenable for advanced optimisations.
Compilation of code using typical
StringBuilder patterns also has been improved, with enhanced support for these patterns in JDK 11-based GraalVM builds due to awareness of compact strings in JDK 11.
In the community edition, a speculative guard movement optimisation has been added, which attempts to move a loop invariant guard from inside a loop to outside a loop to improve relevant workloads. Safe-point elimination mechanisms in
long counted loops also have been improved.
An experimental write sinking optimisation tries to move writes out of loops. A novel SIMD vectorisation for sequential code is available in the enterprise edition but is not yet enabled by default.
Native Image now automatically removes unnecessary security providers from the image; reachable security providers are detected by the static analysis. With GraalVM 21.2, an implementation of class pre-definition supports
Classloader.loadClass calls at run time.
Desired classes that need to be loaded at run time must be made available to the static analysis at build time so they are included in “real world” analysis, but otherwise code patterns that include loading classes at arbitrary moments of run time now are working in native images as would be expected. Also with GraalVM 21.2, native images built with
-H:+AllowVMInspection now support JFR (Java Flight Recorder) events written in Java.
Other new features and improvements in GraalVM 21:2 include the Truffle language implementation framework, which works with GraalVM, has a new compilation queuing heuristic to improve the warmup time of the polyglot runtime on many workloads. This is enabled by default.
For Ruby, GraalVM 21.2 adds compatibility and performance improvements including precise invalidation for Ruby methods and constants, using per-name and per-class assumptions. For Python, a faster version of
_pickle is featured for quicker serialisation.
In addition, C++ virtual calls are supported via cross-language interoperability and WebAssembly compatibility improvements have been made.