RFR: 8353597: Refactor handling VM options for AOT cache input and output [v4]
Ashutosh Mehra
asmehra at openjdk.org
Wed Apr 9 04:06:30 UTC 2025
On Wed, 9 Apr 2025 02:18:41 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Since [JEP 483: Ahead-of-Time Class Loading & Linking](https://openjdk.org/jeps/483), VM options such as `-XX:AOTCache `are implemented as aliases of "classical" CDS options such as `-XX:SharedArchiveFile`.
>>
>> In anticipation of the [JEP: Ahead-of-time Command Line Ergonomics](https://bugs.openjdk.org/browse/JDK-8350022), we should refactor the code that deals with the AOT options. Specifically, as we expect the JVM to be able to load from an "input AOT cache" and write to an "output AOT cache", we should clearly identify the input and output caches in separate APIs:
>>
>>
>> const char* CDSConfig::input_static_archive_path();
>> const char* CDSConfig::input_dynamic_archive_path();
>> const char* CDSConfig::output_archive_path();
>>
>>
>> This PR also cleans up the code by:
>> - renaming a few function to reflect what they actually do
>> - moving more "config" management code into cdsConfig.cpp
>>
>> There's also a behavioral bug fix: before this PR, `-XX:AOTCache` was handled by the `ergo_init_classic_archive_paths()` function, which allows two files to be specified. E.g., `java -XX:AOTCache=static.jsa:dynamic.jsa`. That's because `-XX:AOTCache` was implemented as an alias of `-XX:SharedArchiveFile`, and the latter allows this usage.
>>
>> However, this behavior is not specified in JEP 483. Allowing two files in -XX:AOTCache will cause unnecessary complexity when we implement [JDK-8353598: Allow AOT cache to be used in training run](https://bugs.openjdk.org/browse/JDK-8353598). Therefore, I added new test cases to disallow the use of two files. This also means that we don't need to modify the already over-complicated `ergo_init_classic_archive_paths()` for the AOT use cases
>
> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains nine commits:
>
> - Merge branch 'master' into 8353597-refactor-aot-cache-input-output
> - @lmesnik comments
> - more clean up
> - Minimized changes in ergo_init_classic_archive_paths()
> - Clean up CDS input/output path handling
> - Refactored CollectClassesForLinking for simplification
> - Merge branch 'master' into 8353014-exclude-tooling-classes-from-aot-cache
> - Reverted some fixes in systemDictionaryShared.cpp that causes test failures
> - 8353014: Exclude AOT tooling classes from AOT cache
lgtm
-------------
Marked as reviewed by asmehra (Committer).
PR Review: https://git.openjdk.org/jdk/pull/24401#pullrequestreview-2751975775
More information about the hotspot-runtime-dev
mailing list