8214231: Allow concurrent cleaning of TypeStackSlotEntries and ReturnTypeEntry
authoreosterlund
Fri, 30 Nov 2018 16:51:23 +0100
changeset 52785 7003a0220fe4
parent 52784 621efe32eb0b
child 52786 447236ceaf28
8214231: Allow concurrent cleaning of TypeStackSlotEntries and ReturnTypeEntry Reviewed-by: rehn, coleenp
src/hotspot/share/ci/ciMethodData.cpp
--- a/src/hotspot/share/ci/ciMethodData.cpp	Fri Nov 30 15:29:19 2018 +0100
+++ b/src/hotspot/share/ci/ciMethodData.cpp	Fri Nov 30 16:51:23 2018 +0100
@@ -198,17 +198,28 @@
   }
 }
 
-
 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
   for (int i = 0; i < number_of_entries(); i++) {
     intptr_t k = entries->type(i);
-    TypeStackSlotEntries::set_type(i, translate_klass(k));
+    Klass* klass = (Klass*)klass_part(k);
+    if (klass != NULL && !klass->is_loader_alive()) {
+      // With concurrent class unloading, the MDO could have stale metadata; override it
+      TypeStackSlotEntries::set_type(i, TypeStackSlotEntries::with_status((Klass*)NULL, k));
+    } else {
+      TypeStackSlotEntries::set_type(i, translate_klass(k));
+    }
   }
 }
 
 void ciReturnTypeEntry::translate_type_data_from(const ReturnTypeEntry* ret) {
   intptr_t k = ret->type();
-  set_type(translate_klass(k));
+  Klass* klass = (Klass*)klass_part(k);
+  if (klass != NULL && !klass->is_loader_alive()) {
+    // With concurrent class unloading, the MDO could have stale metadata; override it
+    set_type(ReturnTypeEntry::with_status((Klass*)NULL, k));
+  } else {
+    set_type(translate_klass(k));
+  }
 }
 
 void ciSpeculativeTrapData::translate_from(const ProfileData* data) {