Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
6 For improvement of warm up time Tiered compilation C1 (-client/client use) C2 (-server/server use) • Longer compilation time and longer startup time, but generated code runs faster. • Heavy optimization • In case of prioritizing performance after invocation... • Shorter compilation time and shorter startup time, but generated code runs slow. • Less optimization • In case of prioritizing startup time...
CDS/AppCDS (Class Data Sharing) • CDS is the scheme for sharing Java SE class library only. • In case of AppCDS, application classes are also included. 13 Class Data classes.jsa HotSpot HotSpot HotSpot HotSpot
Works for... • Quicker warmup • Lower total memory footprint Does not work for... • No feature to persist or share machine (native) code. 14 CDS/AppCDS
AOT Supports Tiered Compilation • Non-tiered compilation mode (default) –Similar to C1 in Client VM –No collecting profiling information –No JIT recompilation if AOT code is not deoptimized. • Tied compilation mode (--compile-for-tiered) –Profiling level is as same as C1 Level 2. –If hitting AOT invocation thresholds, methods are recompiled by C1 at Level 3 first for gathering full profiling information. 20
Benefits might be gained from AOT... • No compilation overhead at runtime. • Improve startup time and able to achieve peak performance faster. • Able to run on the platform where native code cannot be not generated at runtime (e.g. iOS, embedded). • Density improvement - Able to share native code. 22
jaotc does not resolve all referenced classes • jaotc does not resolve referenced classes which are not system classes or part of compiled classes. 1. Have to add referenced classes to class path. 2. Specify additional java modules 24 jaotc --output=libfoo.so --jar foo.jar ¥ -J-cp -J./ jaotc --output=libactivation.so --module ¥ java.activation -J--add-module=java.se.ee
On JVM startup... • AOT initialization code looks for well-known AOT libraries in well- known location ($JAVA_HOME/lib) or libraries specified using -XX:AOTLibrary. • JVM knows AOT library name for the following Java modules. –java.base –jdk.compiler (javac) –jdk.scripting.nashorn (Nashorn) –jdk.internal.vm.ci (JVMCI) –jdk.internal.vm.compiler (Graal) 26
Limitations • Available only when using either Parallel or G1 GC on Linux x64 with libelf.so. • AOT compilation must be executed on the same system or a system with the same configuration on which AOT code will be used by Java application. • Unable to compile java code using dynamically generated classes and bytecode (lambda expressions, InvokeDynamic) 30 These limitations are in Java 9, and may be addressed in future releases.
When and where to use AOT? • Event-driven services such as Functions • Embedded, IoT, mobile • Not often invoked classes... (not hot code) • Application code which should be protected from decompilers ...etc. 31 If AOT is officially supported and is available on several platforms...
Summary • Since Java 9 (HotSpot), AOT compilation is available, but positioned as experimental release and no official support. • AOT have several characteristics and is expected to improve performance of applications, especially such short-lived objects as functions • Working to remove current limitation and improve AOT. 32
Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 33