RFR: 8348426: Generate binary file for -XX:AOTMode=record -XX:AOTConfiguration=file [v6]
Ioi Lam
iklam at openjdk.org
Thu Feb 20 04:42:58 UTC 2025
> Currently, with `java -XX:AOTMode=record -XX:AOTConfiguration=file ...`, a text file is written. The file contains the names of loaded classes, indices of resolved constant pools entries, etc, that are easily represented in text.
>
> With the upcoming 2nd JEP of the Leyden project, [JDK-8325147](https://bugs.openjdk.org/browse/JDK-8325147) (Ahead-of-Time Method Profiling), the AOT config file needs to record complex data structures that are difficult to represent in text (we would need code for serializing hierarchical data structures to/from text). Also, a next step after [JDK-8325147](https://bugs.openjdk.org/browse/JDK-8325147) would be to support hidden classes that have no predictable names. Representing such classes with textual names would become another challenge.
>
> To prepare for [JDK-8325147](https://bugs.openjdk.org/browse/JDK-8325147), this PR writes the AOT configuration file in a **binary format** (essentially the same format as a CDS archive file). This allows arbitrary data associated with the cached classes to be processed and stored using the existing `MetaspaceClosure` API (which can recursively copy C++ objects). Such a change in the file format is allowed by [JEP 483](https://openjdk.org/jeps/483):
>
>> the format of the configuration and cache files is not specified and is subject to change without notice.
>
> **Notes for reviewers:**
>
> - Although the new config file format is essentially the same as a CDS "static" archive, for sanity, we use a different magic number so that the config file cannot be accidentally used as a CDS archive. See new tests inside AOTFlags.java.
> - After this PR, the CDS "static" archive can be dumped in three modes: "classic", "preimage", and "final". See new comments in cdsConfig.hpp.
> - The main starting point of this PR is `CDSConfig::check_aot_flags()` - it checks the existence of `-XX:AOTConfiguration` and `-XX:AOTMode` to configure the JVM to dump the CDS "preimage" or "final" archives as necessary.
> - Most of the other changes are checks for `CDSConfig::is_dumping_preimage_static_archive()` and `CDSConfig::is_dumping_final_static_archive()` to handle subtlle differences between the different dumping modes.
> - I also updated the UL messages to use the new JEP 483 terminology ("AOT cache", "AOT configuration file", etc) when JEP 483 options are specified.
>
> **Misc Note**
> - The changes in [CDS.java and RunTests.gmk](https://github.com/iklam/jdk/commit/0e77a35c25a968c7d931931bc108ccba6dcce4a3) will be integrated separ...
Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
@ashu-mehra comments
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/23484/files
- new: https://git.openjdk.org/jdk/pull/23484/files/72a7d1b1..39c53cc1
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=23484&range=05
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=23484&range=04-05
Stats: 21 lines in 3 files changed: 15 ins; 0 del; 6 mod
Patch: https://git.openjdk.org/jdk/pull/23484.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23484/head:pull/23484
PR: https://git.openjdk.org/jdk/pull/23484
More information about the hotspot-dev
mailing list