We need to add a test case when -XX:+VerifyArchivedFields is explicitly set on the command-line.
https://github.com/openjdk/jdk/blob/5d8c1cc8a05e0d9aedd6d54b8147d374c2290024/src/hotspot/share/cds/heapShared.cpp#L661
if (!FLAG_IS_DEFAULT(VerifyArchivedFields)) {
// If VerifyArchivedFields has a non-default value (e.g., specified on the command-line), do
// more expensive checks.
if (is_init_completed()) {
FlagSetting fs1(VerifyBeforeGC, true);
FlagSetting fs2(VerifyDuringGC, true);
FlagSetting fs3(VerifyAfterGC, true);
Universe::heap()->collect(GCCause::_java_lang_system_gc);
}
Specifically, we want to make sure that the GC can handle this case:
- An archived oop O is reachable via HeapShared::_roots
- O->klass() has not yet been loaded