8199007: ClassLoaderDataGraph::unload_list_contains() is wrong
authorcoleenp
Mon, 26 Mar 2018 10:19:31 -0400
changeset 49603 6ce4db4460ca
parent 49602 db050c11c3b5
child 49604 ca5978b8378b
8199007: ClassLoaderDataGraph::unload_list_contains() is wrong Summary: The function isn't needed any longer. Reviewed-by: stuefe, stefank
src/hotspot/share/classfile/classLoaderData.cpp
src/hotspot/share/classfile/classLoaderData.hpp
src/hotspot/share/gc/g1/heapRegion.cpp
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Mon Mar 26 12:44:39 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Mon Mar 26 10:19:31 2018 -0400
@@ -1223,17 +1223,6 @@
   return array;
 }
 
-bool ClassLoaderDataGraph::unload_list_contains(const void* x) {
-  assert(SafepointSynchronize::is_at_safepoint(), "only safe to call at safepoint");
-  for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
-    // Needs fixing, see JDK-8199007.
-    if (cld->metaspace_or_null() != NULL && Metaspace::contains(x)) {
-      return true;
-    }
-  }
-  return false;
-}
-
 #ifndef PRODUCT
 bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
   for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
--- a/src/hotspot/share/classfile/classLoaderData.hpp	Mon Mar 26 12:44:39 2018 +0200
+++ b/src/hotspot/share/classfile/classLoaderData.hpp	Mon Mar 26 10:19:31 2018 -0400
@@ -155,8 +155,6 @@
   static void print() { print_on(tty); }
   static void verify();
 
-  static bool unload_list_contains(const void* x);
-
   // instance and array class counters
   static inline size_t num_instance_classes();
   static inline size_t num_array_classes();
--- a/src/hotspot/share/gc/g1/heapRegion.cpp	Mon Mar 26 12:44:39 2018 +0200
+++ b/src/hotspot/share/gc/g1/heapRegion.cpp	Mon Mar 26 10:19:31 2018 -0400
@@ -645,9 +645,7 @@
     if (!g1->is_obj_dead_cond(obj, this, vo)) {
       if (oopDesc::is_oop(obj)) {
         Klass* klass = obj->klass();
-        bool is_metaspace_object = Metaspace::contains(klass) ||
-                                   (vo == VerifyOption_G1UsePrevMarking &&
-                                   ClassLoaderDataGraph::unload_list_contains(klass));
+        bool is_metaspace_object = Metaspace::contains(klass);
         if (!is_metaspace_object) {
           log_error(gc, verify)("klass " PTR_FORMAT " of object " PTR_FORMAT " "
                                 "not metadata", p2i(klass), p2i(obj));