Skip to content

Commit 6c86a41

Browse files
committed
8274338: com/sun/jdi/RedefineCrossEvent.java failed "assert(m != __null) failed: NULL mirror"
Backport-of: 172aed1a2d75756b140cb723133ac5fb67f7745e
1 parent e160532 commit 6c86a41

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/hotspot/share/classfile/classLoaderData.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,9 @@ void ClassLoaderData::methods_do(void f(Method*)) {
353353
}
354354

355355
void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
356+
// To call this, one must have the MultiArray_lock held, but the _klasses list still has lock free reads.
357+
assert_locked_or_safepoint(MultiArray_lock);
358+
356359
// Lock-free access requires load_acquire
357360
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
358361
// Do not filter ArrayKlass oops here...

src/hotspot/share/oops/instanceKlass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,6 +2525,9 @@ void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handl
25252525
constants()->restore_unshareable_info(CHECK);
25262526

25272527
if (array_klasses() != NULL) {
2528+
// To get a consistent list of classes we need MultiArray_lock to ensure
2529+
// array classes aren't observed while they are being restored.
2530+
MutexLocker ml(MultiArray_lock);
25282531
// Array classes have null protection domain.
25292532
// --> see ArrayKlass::complete_create_array_klass()
25302533
array_klasses()->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);

0 commit comments

Comments
 (0)