RFR: 8343493: Perform module checks during MetaspaceShared::map_archives() [v2]

Matias Saavedra Silva matsaave at openjdk.org
Wed Nov 6 17:50:29 UTC 2024


On Wed, 6 Nov 2024 16:51:07 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Currently, `Modules::serialize()` and `Modules::serialize_addmods_names()` store/retrieve the main module name, as well as the set of modules specified by `--add-modules`. These functions are called from `MetaspaceShared::serialize()`, *after* the JVM has decided to use the CDS archive.
>> 
>> However, with JEP 483 ([JDK-8315737](https://bugs.openjdk.org/browse/JDK-8315737)), we need the module information *before* deciding whether to use the CDS archive. For example, if `-XX:+AOTClassLinking` is specified during the CDS archive creation, the archive cannot be used if we specified an incompatible main module at runtime.
>> 
>> This RFE added a new function, `MetaspaceShared::early_serialize()`, which is called from `MetaspaceShared::map_archives()`. `Modules::serialize()` and `Modules::serialize_addmods_names()` are called within this context so that we can use the module information to decide whether to use the CDS archive or not.
>> 
>> I also added some comments about what "serialize" does, since it's rather non-obvious.
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   @calvinccheung comment: added printing of _early_serialized_data_offset

LGTM! Just one note about a typo in your comment.

src/hotspot/share/cds/metaspaceShared.cpp line 386:

> 384: // is called AFTER we made the decision to map the archive.
> 385: //
> 386: // However, some of the "seralized" data are used to decide whether an archive should

Typo: seralized -> serialized

-------------

Marked as reviewed by matsaave (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21890#pullrequestreview-2419024707
PR Review Comment: https://git.openjdk.org/jdk/pull/21890#discussion_r1831467364


More information about the hotspot-runtime-dev mailing list