#SwitchToAzul

Have your Oracle Java costs gone through the roof?
Join the hundreds of 😊 customers who have made the Switch to Azul.

JDK 9: XXtra Command Line Options

JDK 9: XXtra Command Line Options

Aug 21, 2017 | 10 MIN READ

In my last blog entry on JDK 9 compatibility, I included a list of the command line options that had been removed between JDK 8 and JDK 9. For this blog, I thought I’d do the inverse and look at the new command-line options available in JDK 9. I’m going to limit things to the less well documented –XX options, so this applies to OpenJDK code only. To construct my list, I ran the latest versions of JDK 8 and JDK 9 with the command:

java -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal

After some post-processing with vi, awk, diff and grep I got 115 new options broken into three lists:

There’s too many for one blog entry, so I’ll limit the scope of this post to just the 39 new product options. These are likely to be the ones of most use.

Ahead Of Time Compilation

Ahead of Time (AOT) compilation is included (but not supported) as an experimental feature in JDK 9. Many people often think that static compilation of Java code would solve many of the problems of bytecode interpretation and adaptive Just-in-time (JIT) compilation performance. On its own, static compilation often provides significantly worse performance than properly warmed up JIT compiled code because of the issues associated with dynamic class loading, class initialisation, the restrictions on method inlining and inability to use speculative optimisations, etc. That said, there are situations where AOT compilation can help with the JVM startup time associated with moving from interpreted to JIT compiled mode. The AOT designers are also doing some interesting things with using statically compiled code at JVM startup and then having the JIT provide more optimised code as the application runs.

The AOT code generated by the jaotc tool shipped with JDK 9 can either be tiered or non-tiered. Non-tiered code behaves the same way as statically compiled C and C++ code; the code is static and stays that way. Using tiered code enables the JVM to take advantage of running the statically compiled code when it starts but to also record profiling data in the same way it does for interpreted bytecodes. The JVM is then able to use the JIT to recompile the code using more sophisticated optimisations as it has full knowledge of the runtime. The JIT compilers used by the OpenJDK JVM (C1 and C2) use five tiers; the AOT system uses tier three, which is the C1 compiler with profiling information. Several of the new options control the AOT and Tier 3 JIT interaction.

This is an experimental feature in JDK 9 and based on the Graal compiler project. Currently, the java.base module is the only one of the core modules that is supported by this feature. More detail of AOT compilation can be found in JEP 295.

The new command line options to support this are:

There is a bit more detail on these in the excellent presentation by Dmitry Chuyko of Oracle’s AOT development team. 

Garbage Collection Related

JIT Related

C2 JIT Specific

These all look quite esoteric. Several relate to the use of SuperWords, which is the idea of vector operations using extremely wide registers and extensions to the x86 instruction set such as AVX, AVX 2 and AVX 512. Pete Lawrey has written more about this in a blog post.

Stack Related

Segmented Code Cache

This is a new feature in JDK 9 and is described in JEP 197.

Informative

Miscellaneous

Hopefully, this will be of some use and at least interesting to see some of the new options available in JDK 9.

Early access (and also now GA) versions of the Zulu builds of OpenJDK 9 are available for your testing pleasure.

Category: Java

© Azul Systems, Inc. 2020 All rights reserved.