RFR: 8261455: Automatically generate the CDS archive if necessary [v2]

Ioi Lam iklam at openjdk.java.net
Mon Jan 3 07:44:10 UTC 2022


On Tue, 28 Dec 2021 03:44:50 GMT, Yumin Qi <minqi at openjdk.org> wrote:

>> This patch is re-coded after serial fixes related: 8275846, 8276787, 8279018 etc.
>> original description(PR 5997):
>> `----------------------------------------------------------------------------------`
>> When shared archive (dynamic archive) failed to map due to damage of the archive file, dump/run jdk version mismatch or non-existence file etc, the new patch will automatically create a new shared archive if -XX:+AutoCreateSharedArchive specified with the name based on SharedArchiveFile.
>> This is a revised patch based on the old PR: 5077 and after bug 8273152 integrated.
>> `-----------------------------------------------------------------------------------`
>> 
>> Tests: tier1,tier2,tier3,tier4
>> 
>> Thanks
>> Yumin
>
> Yumin Qi has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Set ArchiveClassesAtExit when AutoCreateSharedArchive is enabled

Changes requested by iklam (Reviewer).

src/hotspot/share/cds/filemap.cpp line 1132:

> 1130:       warning_continue("The shared archive file version %d which is not current version %d",
> 1131:                                     gen_header._version, CURRENT_CDS_ARCHIVE_VERSION);
> 1132:     }

There's no need to add `warning_continue`. `FileMapInfo::fail_continue` means:

- when running with -Xshare:auto, print a warning and continue
- when running with -Xshare:on, print an error and exit

All other calls of `FileMapInfo::fail_continue` expects this behavior.

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

> 1026: 
> 1027:   if (AutoCreateSharedArchive && static_mapinfo != NULL && dynamic_mapinfo == NULL) {
> 1028:     warning("AutoCreateSharedArchive will be ignored for static archive");

To be consistent, we should use `log_warning(cds)`. Also, the message is unclear. Here, `foo.jsa` is a static archive:


$ java -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=foo.jsa -cp HelloWorld.jar HelloWorld
Java HotSpot(TM) 64-Bit Server VM warning: AutoCreateSharedArchive will be ignored for static archive
Hello World


I think it's better to print out:


AutoCreateSharedArchive is ignored because foo.jsa is a static archive

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

PR: https://git.openjdk.java.net/jdk/pull/6920


More information about the hotspot-runtime-dev mailing list