Before this PR, you cannot use -XX:AOTCache in the training run:
$ java -XX:AOTCache=foo.aot -cp HelloWorld.jar \
-XX:AOTMode=record -XX:AOTConfiguration=hw.aotconfig \
HelloWorld
[...] AOTCache must not be specified when using -XX:AOTMode=record
However, in some cases, it may be desirable to train the AOT cache in two or
more steps. For example:
## Separate Training for Framework and Application:
- First perform a training run to exercise commonly-used areas of the framework.
- Second, perform a training run of a specific application.
The idea is that important parts of the framework may not be covered by a
single application training run, but they may still be used in the production
run due to runtime-specific input.
# Train the framework
java -XX:AOTCacheOutput=first.aot -cp FrameWork.jar FrameWorkTraningHelper
# Train the app
java -XX:AOTCache=first.aot -XX:AOTCacheOutput=second.aot -cp
FrameWork.jar:App.jar MyApp
# Production run using second.aot, which contains artifacts from
# the first and second training runs
java -XX:AOTCache=second.aot -cp FrameWork.jar:App.jar MyApp
Note that the classpaths of the training runs must be compatible. I.e., the
classpath of an earlier training run must be the same as, or the prefix of, the
classpath of a later training run.
## Train the Same Application in Multiple Runs:
An application may perform 3 different operations. It's not easy to perform all
3 operations in a single training run, as the 3 operations are represented by 3
separate main classes (`WalkDog`, `FeedCat`, and `WaterPlants`). So, we perform
3 separate training runs and combine the results into a single AOT cache.
# Training
java -XX:AOTCacheOutput=tmp1.aot -cp MyApp.jar WalkDog
java -XX:AOTCache=tmp1.aot -XX:AOTCacheOutput=tmp2.aot -cp MyApp.jar FeedCat
java -XX:AOTCache=tmp2.aot -XX:AOTCacheOutput=final.aot -cp MyApp.jar
WaterPlants
# Production: final.aot contains artifacts for optimizing all 3 operations:
java -XX:AOTCache=final.aot -cp MyApp.jar WalkDog
java -XX:AOTCache=final.aot -cp MyApp.jar FeedCat
java -XX:AOTCache=final.aot -cp MyApp.jar WaterPlants
---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK
Interim AI Policy](https://openjdk.org/legal/ai).
-------------
Commit messages:
- Renamed the CDSAppTester workflows to AOT-Iterative1 and AOT-Iterative2
- updated man page
- Merge branch 'master' into aot-re-training
- Avoid crashing inside ciRecords::Arguments<>::prepare() because
_first==nullptr
- Merge branch 'master' into aot-re-training
- Fixed bug found in AOT/JCK testing
- more clean up
- clean up: added CDSConfig::is_dumping_with_input_archive()
- Clean up: added AOTWriteClosureDisabler
- more clean up
- ... and 41 more: https://git.openjdk.org/jdk/compare/da7dfc1b...f73f146b
Changes: https://git.openjdk.org/jdk/pull/31344/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31344&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8353598
Stats: 1686 lines in 63 files changed: 1312 ins; 108 del; 266 mod
Patch: https://git.openjdk.org/jdk/pull/31344.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/31344/head:pull/31344
PR: https://git.openjdk.org/jdk/pull/31344