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

Ioi Lam iklam at openjdk.org
Thu Nov 7 17:01:20 UTC 2024


> 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:

  @matias9927 comments - fixed typo

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21890/files
  - new: https://git.openjdk.org/jdk/pull/21890/files/83914209..d8f8c8d7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=21890&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=21890&range=01-02

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/21890.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21890/head:pull/21890

PR: https://git.openjdk.org/jdk/pull/21890


More information about the hotspot-runtime-dev mailing list