RFR: 8275731: CDS archived enums objects are recreated at runtime [v3]

Ioi Lam iklam at openjdk.java.net
Wed Jan 19 05:54:30 UTC 2022


On Mon, 17 Jan 2022 19:22:23 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> I don't really know this code well enough to do a good code review. I had some comments though.

Hi Coleen, thanks for taking a look.

This PR has two major parts:

1. Check for inappropriate reference to static fields. This is mainly done in cdsHeapVerifier.cpp. These checks don't affect the contents of the CDS archive. They just print out warnings if problems are found.
2. Special initialization of enum classes. Essentially if any instance of an enum class `X` is archived, then `X::<clinit>` will not be executed, and we'll take this path instead (in instanceKlass.cpp):


  // This is needed to ensure the consistency of the archived heap objects.
  if (has_archived_enum_objs()) {
    assert(is_shared(), "must be");
    bool initialized = HeapShared::initialize_enum_klass(this, CHECK);
    if (initialized) {
      return;
    }
  }

Could you check if (2) is correct?

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

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


More information about the core-libs-dev mailing list