1.1 --- a/src/share/vm/services/heapDumper.cpp Thu Sep 05 18:40:52 2019 +0800 1.2 +++ b/src/share/vm/services/heapDumper.cpp Thu Sep 05 18:52:27 2019 +0800 1.3 @@ -941,8 +941,14 @@ 1.4 // its array classes 1.5 void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) { 1.6 Klass* klass = k; 1.7 - assert(klass->oop_is_instance(), "not an InstanceKlass"); 1.8 - InstanceKlass* ik = (InstanceKlass*)klass; 1.9 + InstanceKlass* ik = InstanceKlass::cast(k); 1.10 + 1.11 + // We can safepoint and do a heap dump at a point where we have a Klass, 1.12 + // but no java mirror class has been setup for it. So we need to check 1.13 + // that the class is at least loaded, to avoid crash from a null mirror. 1.14 + if (!ik->is_loaded()) { 1.15 + return; 1.16 + } 1.17 1.18 writer->write_u1(HPROF_GC_CLASS_DUMP); 1.19