JEP 483: "Ahead-of-Time Class Loading & Linking" has been integrated into jdk24 and allows Java applications to be be run with so called AOT cache to improve startup and warmup of Java applications.
As part of AOT testing we want to run jtreg tests (at least some of them) with AOT cache. This cache should contains the assets from the train test run. In other words all jtreg tests need to be run twice to accomplish this and this require jtreg harness modification.
Note, AOT cache works only with jar files for now and as result it will require all the jtreg test classes be packed into jar files. This also requires jtreg harness modification.
To summarize at least following steps needs to be done by jtreg harness to accomplish jtreg tests run in aot mode:
1) Compile test files, pack into jar files and add jar files into classpath instead of class directories.
2) Do run training test run to create AOT config file.
"-XX:AOTMode=record -XX:AOTConfiguration=test.aotconfig" flags need to be added to run test with.
3) Create AOT cache.
> java -XX:AOTMode=create -XX:AOTConfiguration=test.aotconfig XX:AOTCache=test.aot -cp TEST_CLASSPATH
Note, this step doesn't require the test to be run.
4) Run test with AOT cache create before.
Additional -XX:AOTCache=test.aot flag needs to be added to run test with.
As part of AOT testing we want to run jtreg tests (at least some of them) with AOT cache. This cache should contains the assets from the train test run. In other words all jtreg tests need to be run twice to accomplish this and this require jtreg harness modification.
Note, AOT cache works only with jar files for now and as result it will require all the jtreg test classes be packed into jar files. This also requires jtreg harness modification.
To summarize at least following steps needs to be done by jtreg harness to accomplish jtreg tests run in aot mode:
1) Compile test files, pack into jar files and add jar files into classpath instead of class directories.
2) Do run training test run to create AOT config file.
"-XX:AOTMode=record -XX:AOTConfiguration=test.aotconfig" flags need to be added to run test with.
3) Create AOT cache.
> java -XX:AOTMode=create -XX:AOTConfiguration=test.aotconfig XX:AOTCache=test.aot -cp TEST_CLASSPATH
Note, this step doesn't require the test to be run.
4) Run test with AOT cache create before.
Additional -XX:AOTCache=test.aot flag needs to be added to run test with.