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

Ioi Lam iklam at openjdk.java.net
Tue Jan 11 07:12:24 UTC 2022


On Tue, 11 Jan 2022 05:31:59 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:
> 
>   Renamed renameModules to rename, cleaned comment and printing messages

I have reviewed all the files. The changes look good overall. Just a few small nits.

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

> 1240:     assert(header->_magic == CDS_ARCHIVE_MAGIC, "must be");
> 1241:     if (AutoCreateSharedArchive) {
> 1242:       warning("AutoCreateSharedArchive is ignored because %s is a static archive", archive_name);

We should use log_warning(cds) for all new warning messages.

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

> 952:       if (AutoCreateSharedArchive) {
> 953:         AutoCreateSharedArchive = false;
> 954:       }

No need for the 'if' check.

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

> 964:     if (DynamicDumpSharedSpaces) {
> 965:       DynamicDumpSharedSpaces = false;
> 966:     }

I think there's no need to put the above checks in 'if' blocks. I would suggest replacing the above six lines with:

// The base archive cannot be mapped. We cannot dump the dynamic shared archive.
AutoCreateSharedArchive = false;
DynamicDumpSharedSpaces = false;

src/hotspot/share/runtime/java.cpp line 510:

> 508:     const char* archive_name =
> 509:        (ArchiveClassesAtExit != nullptr) ? ArchiveClassesAtExit : Arguments::GetSharedDynamicArchivePath();
> 510:     assert(archive_name != NULL, "Must be already set");

The above change doesn't seem necessary. `ArchiveClassesAtExit` should be already set to non-null if AutoCreateArchive was set but the dynamic archive cannot be mapped.

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

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


More information about the hotspot-runtime-dev mailing list