> [JEP 483](https://bugs.openjdk.org/browse/JDK-8315737) preserves class > information in AOT cache which helps Java startup performance. > > We should also preserve adapters (i2c, c2i) to further improve performance of > class linking where adapters are generated. > > Short running Java application can see several percents improvement. I got 6% > improvement when ran `HelloWorld.java` on Linux-x64 Ice Lake CPU (2.5Ghz): > > > (perf stat -r 100 java -XX:AOTCache=app.aotcache -cp hello.jar HelloWorld > > /dev/null) 2>&1 | grep elapsed > 0.0299401 +- 0.0000504 seconds time elapsed ( +- 0.17% ) > > (perf stat -r 100 java -XX:AOTCache=app.aotcache > -XX:+UnlockDiagnosticVMOptions -XX:-AOTAdapterCaching -cp hello.jar > HelloWorld > /dev/null) 2>&1 | grep elapsed > 0.0318654 +- 0.0000535 seconds time elapsed ( +- 0.17% ) > > > New diagnostic flags are introduced (use `-XX:+UnlockDiagnosticVMOptions` to > unlock them): > > > -XX:+AOTAdapterCaching - Enable or disable saving and restoring i2c2i > adapters > -XX:AOTCodeMaxSize=10*M - buffer size in bytes for AOT code caching > -XX:+AbortVMOnAOTCodeFailure - Abort VM on the first occurrence of AOT code > caching failure > > By default `AOTAdapterCaching` is `false` and enabled ergonomically when > `-XX:AOTCache` is specified. > This flag is ignored when `AOTCache` is not specified. > > To use AOT adapters follow process described in JEP 483: > > > java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconf -cp app.jar App > java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf -XX:AOTCache=app.aot > -cp app.jar > java -XX:AOTCache=app.aot -cp app.jar App > > > There are several new UL flag combinations to trace the AOT code caching > process: > > > -Xlog:aot+codecache+init -Xlog:aot+codecache+exit -Xlog:aot+codecache+stubs > > > @ashu-mehra is main author of changes. He implemented adapters caching. > I did main framework (`AOTCodeCache` class) for saving and loading AOT code. > > Tested tier1-6,10, which includes tests with `AOTClassLinking` enabled. Also > Xcomp,stress and JCK.
Vladimir Kozlov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits: - Fix C strings caching - Merge branch 'master' into JDK-8350209 - Merge branch 'master' into JDK-8350209 - Downgraded UL as asked. Added synchronization to C strings caching. - Fix message - Generate far jumps for AOT code on AArch64 - remove _enabled suffix - Add sanity test for AOTAdapterCaching flag - AOT code flags are ignored when AOTCache is not specified. Set range for AOTCodeMaxSize values. - Removed unused AOTCodeSection class - ... and 1 more: https://git.openjdk.org/jdk/compare/7cf190fb...1b0c89f6 ------------- Changes: https://git.openjdk.org/jdk/pull/24740/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24740&range=09 Stats: 3314 lines in 51 files changed: 2845 ins; 200 del; 269 mod Patch: https://git.openjdk.org/jdk/pull/24740.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/24740/head:pull/24740 PR: https://git.openjdk.org/jdk/pull/24740