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 optimizations including improved loop limit analysis for counted loops, enabling the compiler to analyze control flow preceding the loop to reason about induction variables. This can make more uncounted loops amenable for advanced optimizations. 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 optimization 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 optimization tries to move writes out of loops. A novel SIMD vectorization 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:
- 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.
- A HotSpot plug-in API for Java on Truffle allows code to evolve naturally during development without having to restart a running application.
- 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
_pickleis featured for quicker serialization.
- C++ virtual calls are supported via cross-language interoperability.
- WebAssembly compatibility improvements have been made.
Copyright © 2021 IDG Communications, Inc.