RFR: 8317269: Store old classes in linked state in AOT cache [v2]

Ioi Lam iklam at openjdk.org
Mon Sep 1 01:05:41 UTC 2025


On Fri, 29 Aug 2025 21:49:48 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> We need to know if are are at the CDS safepoint, not any safepoint.
>
> I don't think we share safepoints anymore (?)

This code is used by places like this in methodData.cpp:


static bool is_excluded(Klass* k) {
#if INCLUDE_CDS
  if (CDSConfig::is_at_cds_safepoint()) {
    // Check for CDS exclusion only at CDS safe point.
    if (k->is_instance_klass() && !InstanceKlass::cast(k)->is_loaded()) {
      log_debug(aot, training)("Purged %s from MDO: unloaded class", k->name()->as_C_string());
      return true;
    } else {
      bool excluded = SystemDictionaryShared::should_be_excluded(k);
      if (excluded) {
        log_debug(aot, training)("Purged %s from MDO: excluded class", k->name()->as_C_string());
      }
      return excluded;
    }
  }
#endif
  return false;
}


This function is usually called with GC safepoints (for class unloading, etc). If that's the case, we must not call `SystemDictionaryShared::should_be_excluded(k)`, because the exclusion check is not yet complete.

So we need to distinguish whether the current safepoint is CDS or not.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26754#discussion_r2312714685


More information about the hotspot-dev mailing list