Oracle LABS has released GraalVM 21.1, which has experimental binaries for Java 16. This new release also includes performance improvements and some new features, such as support for multiple languages in Native Image. Node.js was originally included in previous versions of the GraalVM installation package and is now an optional dependency that requires manual installation.

The GraalVM Community edition binaries based on OpenJDK have been updated to Java 8U292, 11.0.11, and 16.0.1, and the GraalVM Enterprise Edition binaries based on Oracle JDK have been updated to Java 8U291, 11.0.11, and 16.0.1.

Two versions of Java 16 support are available for testing and evaluation, but are still under development. JDK 16 has three known problems when generating native images. Unexpected Method :proxyClassLookup error occurs when building a local image using default proxy methods; Jdk.vm.ci.com mon. JVMCIError: Unknown JvmConstant tag 17 error lambda expressions in the class is initialized at run time, and the JDK Flight Recorder (JFR) support is not available. Several other tools, such as VisualVM, are already JDK 16 compatible. VisualVM is now compatible with Apple’s M1 chip.

The new version of Visual Studio Code (VS) Extensions visualizes unit test results and provides support for Refactoring Java Code. Various features were introduced for the first time in GraalVM 19.2, including Micronaut VS Code Extension, support for YAML and Docker builds, and assistance for configuration files and Java Code.

Similar to the Native image tool in GraalVM 19.0 release, Node.js has become an optional dependency that requires manual installation and is no longer enabled by default. It can be installed using the GraalVM update tool GU by calling the gu install nodejs command. As a result, the Community download is about 50MB smaller. JavaScript runtime is still included in the GraalVM installation.

GraalVM community edition builds of MacOS based on OpenJDK 8 are no longer produced. The Linux AArch64 build is still experimental, but includes the GraalVM compiler, GU tools, Node.js, Native Image, and several development tools.

The compiler was further optimized to eliminate unnecessary memory hurdles for continuous volatile writes on x86 processors. When code is inlined, many volatile writes can occur sequentially. Now, the compiler will abandon the memory disorders, in addition to the sequence of the last time, it improves the performance of methods, such as ConcurrentHashMap. Transfer ().

Another optimization is the removal of the conversion of loaded array elements. This is necessary when a volatile field loads from an array and loses element type information. In the following example, (Node

) no longer needs to be converted.
,v>

static final <K,V> Node<K,V> tabAt(Node<K,V>[] tab, int i) {
    return (Node<K,V>)U.getObjectVolatile(tab, ((long)i << ASHIFT) + ABASE);
}
Copy the code

Support for locales has also been improved so that multiple locales can be used in a single Native Image. Developers can specify which languages to include at build time. IncludeLocales=en,nl to include specific languages, or -h :+IncludeAllLocales to include all languages. The default language is specified with -h :DefaultLocale= JA.

Multi-layer compilation improves warm-up time, and Polyglot Runtime for Truffle languages such as JavaScript, Python, and Java on Truffle is now enabled by default. The first layer optimizes compilation speed and uses inline methods for trivial methods. The second layer uses all of GraalVM’s optimizations. New experimental compilation queue function to further improve the preheating time, can use — engine. TraversingCompilationQueue enabled.

Some improvements were made with the addition of Java on Truffle in GraalVM 21.0. Debugging is now faster because enabling instrumentation no longer causes problems. When the application terminates, the closing hooks in the application now execute as expected.

Java applications can take advantage of the guest Java Polyglot API provided by Java on Truffle. For example, the context.safepoint () method can be used to poll thread-local actions while the host method is running. The Context class can be used to check for interrupts or cancellations. An experimental feature of HotSpot provides the ability to specify a maximum heap of memory to limit memory use in guest Truffle language. This is called with: — sandbox.maxheapMemory =

. The Java Polyglot API now supports data structures equivalent to byte buffers, iterators, iterables, and maps. After these functions are implemented in various object languages, they work just as their native functions do.

There are several enhancements to loops in the Enterprise edition. The compiler can now detect and vectorally process loops with a hash code pattern, where the hash code evaluates similarly to c\* hash +array[I]. Reverse loops, such as the do-while loop, are now optimized like any other loop, with fenced optimization, vectorization, complete unwinding, and partial unwinding. Tests show performance improvements of up to 40%. In each iteration of the while loop will check, if the index is higher than the length of the array, a ArrayIndexOutOfBoundsException will be thrown. GraalVM optimizes this part by extracting the validation and putting it before the loop. However, this means that validation is always done, even if it doesn’t enter the loop. GraalVM solves this problem by using an inverted loop.

More details on these new features can be found at GraalVM’s lead developer advocates Oleg š elajev and Thomas Wuerthinger, GraalVM founder and project leader, in the out of the box GraalVM version 21.1! Found.

The original link: www.infoq.com/news/2021/0…