8274338: com/sun/jdi/RedefineCrossEvent.java failed "assert(m != __null) failed: NULL mirror"

Reviewed-by: dholmes, iklam
This commit is contained in:
Coleen Phillimore 2021-10-15 12:10:27 +00:00
parent ced79091f6
commit 172aed1a2d
2 changed files with 6 additions and 0 deletions

View File

@ -353,6 +353,9 @@ void ClassLoaderData::methods_do(void f(Method*)) {
}
void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
// To call this, one must have the MultiArray_lock held, but the _klasses list still has lock free reads.
assert_locked_or_safepoint(MultiArray_lock);
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
// Do not filter ArrayKlass oops here...

View File

@ -2584,6 +2584,9 @@ void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handl
constants()->restore_unshareable_info(CHECK);
if (array_klasses() != NULL) {
// To get a consistent list of classes we need MultiArray_lock to ensure
// array classes aren't observed while they are being restored.
MutexLocker ml(MultiArray_lock);
// Array classes have null protection domain.
// --> see ArrayKlass::complete_create_array_klass()
array_klasses()->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);