Skip to content

Commit ec6624b

Browse files
committed
8350649: Class unloading accesses/resurrects dead Java mirror after JDK-8346567
Reviewed-by: coleenp, egahlin
1 parent 9477c70 commit ec6624b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static void do_write_klass(JfrCheckpointWriter* writer, CldPtr cld, KlassPtr kla
347347
writer->write(cld != nullptr ? cld_id(cld, leakp) : 0);
348348
writer->write(mark_symbol(klass, leakp));
349349
writer->write(package_id(klass, leakp));
350-
writer->write(klass->modifier_flags());
350+
writer->write(klass->compute_modifier_flags());
351351
writer->write<bool>(klass->is_hidden());
352352
if (leakp) {
353353
assert(IS_LEAKP(klass), "invariant");

src/hotspot/share/oops/klass.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,14 @@ class Klass : public Metadata {
749749
virtual void release_C_heap_structures(bool release_constant_pool = true);
750750

751751
public:
752-
virtual u2 compute_modifier_flags() const = 0;
752+
// Get modifier flags from Java mirror cache.
753753
int modifier_flags() const;
754754

755+
// Compute modifier flags from the original data. This also allows
756+
// accessing flags when Java mirror is already dead, e.g. during class
757+
// unloading.
758+
virtual u2 compute_modifier_flags() const = 0;
759+
755760
// JVMTI support
756761
virtual jint jvmti_class_status() const;
757762

0 commit comments

Comments
 (0)