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.

GraalVM attempts to provide a high-performance runtime for Java, JavaScript, LLVM-based languages such as C and C++, and dynamic languages such as Python and Ruby. For Native Image capabilities in GraalVM, Gradle and Maven plug-ins were released in June with JUnit 5 testing support, to simplify building native images of applications and allowing JUnit tests to run in native image mode, to check how code works there.

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 the 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.

  • 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.
  • The JavaScript implementation adds recent proposals such as new set methods and experimental operator overloading.
  • 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 serialization.
  • C++ virtual calls are supported via cross-language interoperability.
  • WebAssembly compatibility improvements have been made.
Tags: , , , , , , , , , , , , , , , , , , , , , ,