8224531: SEGV while collecting Klass statistics
authoreosterlund
Tue, 09 Jul 2019 16:39:41 +0200
changeset 55629 29e522153769
parent 55628 7a0d1616851e
child 55630 10f1928a33b5
8224531: SEGV while collecting Klass statistics Reviewed-by: coleenp, kbarrett, tschatzl
src/hotspot/share/memory/heapInspection.cpp
src/hotspot/share/oops/klass.cpp
--- a/src/hotspot/share/memory/heapInspection.cpp	Tue Jul 09 16:39:37 2019 +0200
+++ b/src/hotspot/share/memory/heapInspection.cpp	Tue Jul 09 16:39:41 2019 +0200
@@ -123,7 +123,7 @@
 
 KlassInfoEntry* KlassInfoBucket::lookup(Klass* const k) {
   // Can happen if k is an archived class that we haven't loaded yet.
-  if (k->java_mirror() == NULL) {
+  if (k->java_mirror_no_keepalive() == NULL) {
     return NULL;
   }
 
@@ -719,7 +719,7 @@
   ResourceMark rm;
 
   RecordInstanceClosure ric(cit, filter);
-  Universe::heap()->object_iterate(&ric);
+  Universe::heap()->safe_object_iterate(&ric);
   return ric.missed_count();
 }
 
--- a/src/hotspot/share/oops/klass.cpp	Tue Jul 09 16:39:37 2019 +0200
+++ b/src/hotspot/share/oops/klass.cpp	Tue Jul 09 16:39:41 2019 +0200
@@ -767,7 +767,7 @@
 // Size Statistics
 void Klass::collect_statistics(KlassSizeStats *sz) const {
   sz->_klass_bytes = sz->count(this);
-  sz->_mirror_bytes = sz->count(java_mirror());
+  sz->_mirror_bytes = sz->count(java_mirror_no_keepalive());
   sz->_secondary_supers_bytes = sz->count_array(secondary_supers());
 
   sz->_ro_bytes += sz->_secondary_supers_bytes;