JDK-8266331 : Add new test case for -XX:+VerifyArchivedFields
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2021-04-29
  • Updated: 2022-01-11
  • Resolved: 2022-01-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 18
18 b16Resolved
Description
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
Comments
Closing as a duplicate of JDK-8271073, which has already been fixed in JDK 18.
11-01-2022