Skip to content
Permalink
Browse files
8274338: com/sun/jdi/RedefineCrossEvent.java failed "assert(m != __nu…
…ll) failed: NULL mirror"

Reviewed-by: phh
Backport-of: 172aed1a2d75756b140cb723133ac5fb67f7745e
  • Loading branch information
zhengyu123 committed Nov 6, 2021
1 parent 1d2fee0 commit 3a3515807cd76b571aa9cf5f19203bca7be7f970
Showing with 9 additions and 0 deletions.
  1. +3 −0 src/hotspot/share/classfile/classLoaderData.cpp
  2. +3 −0 src/hotspot/share/memory/metaspaceShared.cpp
  3. +3 −0 src/hotspot/share/oops/instanceKlass.cpp
@@ -342,6 +342,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 = OrderAccess::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
// Do not filter ArrayKlass oops here...
@@ -1627,6 +1627,9 @@ void MetaspaceShared::link_and_cleanup_shared_classes(TRAPS) {
// We need to iterate because verification may cause additional classes
// to be loaded.
LinkSharedClassesClosure link_closure(THREAD);
// To get a consistent list of classes we need MultiArray_lock to ensure
// array classes aren't created.
MutexLocker locker(MultiArray_lock);
do {
link_closure.reset();
ClassLoaderDataGraph::loaded_classes_do(&link_closure);
@@ -2378,6 +2378,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);

1 comment on commit 3a35158

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 3a35158 Nov 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.