< prev index next >

src/hotspot/share/ci/ciMethodData.cpp

Print this page
@@ -67,11 +67,15 @@
        _safepoint_tracker(SafepointSynchronize::safepoint_state_tracker()),
        _uncached_methods()
    { }
  
    bool is_live(Method* m) {
-     if (!m->method_holder()->is_loader_alive()) {
+     Klass* holder = m->method_holder();
+     if (holder == nullptr || // premain: not yet loaded
+         holder->class_loader_data() == nullptr ||
+         !holder->is_loader_alive() ||
+         (holder->is_instance_klass() && !InstanceKlass::cast(holder)->is_loaded())) {
        return false;
      }
      if (CURRENT_ENV->cached_metadata(m) == nullptr) {
        // Uncached entries need to be pre-populated.
        _uncached_methods.append(m);

@@ -302,11 +306,12 @@
  }
  
  void ciReceiverTypeData::translate_receiver_data_from(const ProfileData* data) {
    for (uint row = 0; row < row_limit(); row++) {
      Klass* k = data->as_ReceiverTypeData()->receiver(row);
-     if (k != nullptr) {
+     if (k != nullptr && k->class_loader_data() != nullptr &&
+         (!k->is_instance_klass() || InstanceKlass::cast(k)->is_loaded())) {
        if (k->is_loader_alive()) {
          ciKlass* klass = CURRENT_ENV->get_klass(k);
          set_receiver(row, klass);
        } else {
          // With concurrent class unloading, the MDO could have stale metadata; override it

@@ -320,11 +325,13 @@
  
  void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
    for (int i = 0; i < number_of_entries(); i++) {
      intptr_t k = entries->type(i);
      Klass* klass = (Klass*)klass_part(k);
-     if (klass != nullptr && !klass->is_loader_alive()) {
+     if (klass != nullptr &&
+         ((klass->is_instance_klass() && !InstanceKlass::cast(klass)->is_loaded()) ||
+          (klass->class_loader_data() == nullptr || !klass->is_loader_alive()))) {
        // With concurrent class unloading, the MDO could have stale metadata; override it
        TypeStackSlotEntries::set_type(i, TypeStackSlotEntries::with_status((Klass*)nullptr, k));
      } else {
        TypeStackSlotEntries::set_type(i, translate_klass(k));
      }

@@ -332,11 +339,13 @@
  }
  
  void ciReturnTypeEntry::translate_type_data_from(const ReturnTypeEntry* ret) {
    intptr_t k = ret->type();
    Klass* klass = (Klass*)klass_part(k);
-   if (klass != nullptr && !klass->is_loader_alive()) {
+   if (klass != nullptr &&
+       ((klass->is_instance_klass() && !InstanceKlass::cast(klass)->is_loaded()) ||
+        (klass->class_loader_data() == nullptr || !klass->is_loader_alive()))) {
      // With concurrent class unloading, the MDO could have stale metadata; override it
      set_type(ReturnTypeEntry::with_status((Klass*)nullptr, k));
    } else {
      set_type(translate_klass(k));
    }
< prev index next >