Oracle’s latest update to the GraalVM multilingual runtime provides compiler and native image availability improvements, as well as language-specific improvements.
GraalVM 21.2 was released on July 20 and is available in both the community and enterprise editions of the project website. For the compiler, this update features optimizations, including improved loop limit analysis for counting loops, enabling the compiler to analyze control flow prior to loops to reason about induction variables. This makes more uncomputed loops suitable for advanced optimization. Compilation of code using typical StringBuilder patterns has also been improved, and support for these patterns has been enhanced in GraalVM builds based on JDK 11 due to the recognition of compact strings in JDK 11.
[Also at InfoWorld: New features in JDK 16: Java 17]
In the Community edition, a speculative guard movement optimization was added, which attempts to move a guard with a constant loop from within the loop to outside the loop to improve the associated workload. The safety point elimination mechanism in the loop of the Long meter has also been improved.
An experimental write sink optimization attempts to move write operations out of the loop. There is a new SIMD vectorization for sequential code in the Enterprise edition, but it is not 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 the Native Image feature in GraalVM, Gradle and Maven plug-ins, released in June, support JUnit 5 tests to simplify building Native images for applications and allow JUnit tests to run in Native Image mode, To check how the code works there.
Native images can now automatically remove unnecessary security providers from images; The accessible security providers are detected by static analysis. With GraalVM 21.2, the predefined implementation of the class supports calling classLoader.loadClass at run time. The expected classes that need to be loaded at run time must be made available to static analysis at build time so that they can be included in the “real world” analysis, but otherwise the code pattern that involves loading classes at any point during run time now works in the local image as expected. Also, in 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 queue heuristic to improve warm-up times for multilanguage runtimes on many workloads. This is enabled by default.
- Java’s HotSpot plug-in API 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 collection methods and experimental operator overloading.
- For Ruby, GraalVM 21.2 adds compatibility and performance improvements, including precise invalidation of Ruby methods and constants, using per-name and per-category assumptions.
- For Python, a faster one
_pickle
To speed up serialization. - Support for C++ virtual calls through cross-language interoperability.
- WebAssembly compatibility has also improved.