hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 46464 6432a858a220
parent 46458 3c12af929e7d
child 46505 fd4bc78630b1
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Tue May 16 09:33:49 2017 -0400
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Tue May 16 19:36:55 2017 -0400
@@ -1995,13 +1995,18 @@
   }
 }
 
-static void remove_unshareable_in_class(Klass* k) {
-  // remove klass's unshareable info
-  k->remove_unshareable_info();
-}
-
 void InstanceKlass::remove_unshareable_info() {
   Klass::remove_unshareable_info();
+
+  if (is_in_error_state()) {
+    // Classes are attempted to link during dumping and may fail,
+    // but these classes are still in the dictionary and class list in CLD.
+    // Check in_error state first because in_error is > linked state, so
+    // is_linked() is true.
+    // If there's a linking error, there is nothing else to remove.
+    return;
+  }
+
   // Unlink the class
   if (is_linked()) {
     unlink_class();
@@ -2016,9 +2021,6 @@
     Method* m = methods()->at(i);
     m->remove_unshareable_info();
   }
-
-  // do array classes also.
-  array_klasses_do(remove_unshareable_in_class);
 }
 
 static void restore_unshareable_in_class(Klass* k, TRAPS) {