diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp index 8128674dc1e..b9dcd7a3694 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp @@ -347,7 +347,7 @@ static void do_write_klass(JfrCheckpointWriter* writer, CldPtr cld, KlassPtr kla writer->write(cld != nullptr ? cld_id(cld, leakp) : 0); writer->write(mark_symbol(klass, leakp)); writer->write(package_id(klass, leakp)); - writer->write(klass->modifier_flags()); + writer->write(klass->compute_modifier_flags()); writer->write(klass->is_hidden()); if (leakp) { assert(IS_LEAKP(klass), "invariant"); diff --git a/src/hotspot/share/oops/klass.hpp b/src/hotspot/share/oops/klass.hpp index e7631f9dfe3..87f85dab956 100644 --- a/src/hotspot/share/oops/klass.hpp +++ b/src/hotspot/share/oops/klass.hpp @@ -749,9 +749,14 @@ public: virtual void release_C_heap_structures(bool release_constant_pool = true); public: - virtual u2 compute_modifier_flags() const = 0; + // Get modifier flags from Java mirror cache. int modifier_flags() const; + // Compute modifier flags from the original data. This also allows + // accessing flags when Java mirror is already dead, e.g. during class + // unloading. + virtual u2 compute_modifier_flags() const = 0; + // JVMTI support virtual jint jvmti_class_status() const;