hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 25491 70fb742e40aa
parent 25490 59f226da8d81
child 25492 d27050bdfb04
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Mon Jul 07 10:12:40 2014 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Mon Jul 07 12:37:11 2014 +0200
@@ -245,7 +245,6 @@
   set_static_oop_field_count(0);
   set_nonstatic_field_size(0);
   set_is_marked_dependent(false);
-  set_has_unloaded_dependent(false);
   set_init_state(InstanceKlass::allocated);
   set_init_thread(NULL);
   set_reference_type(rt);
@@ -1802,9 +1801,6 @@
   return id;
 }
 
-int nmethodBucket::decrement() {
-  return Atomic::add(-1, (volatile int *)&_count);
-}
 
 //
 // Walk the list of dependent nmethods searching for nmethods which
@@ -1819,7 +1815,7 @@
     nmethod* nm = b->get_nmethod();
     // since dependencies aren't removed until an nmethod becomes a zombie,
     // the dependency list may contain nmethods which aren't alive.
-    if (b->count() > 0 && nm->is_alive() && !nm->is_marked_for_deoptimization() && nm->check_dependency_on(changes)) {
+    if (nm->is_alive() && !nm->is_marked_for_deoptimization() && nm->check_dependency_on(changes)) {
       if (TraceDependencies) {
         ResourceMark rm;
         tty->print_cr("Marked for deoptimization");
@@ -1836,43 +1832,6 @@
   return found;
 }
 
-void InstanceKlass::clean_dependent_nmethods() {
-  assert_locked_or_safepoint(CodeCache_lock);
-
-  if (has_unloaded_dependent()) {
-    nmethodBucket* b = _dependencies;
-    nmethodBucket* last = NULL;
-    while (b != NULL) {
-      assert(b->count() >= 0, err_msg("bucket count: %d", b->count()));
-
-      nmethodBucket* next = b->next();
-
-      if (b->count() == 0) {
-        if (last == NULL) {
-          _dependencies = next;
-        } else {
-          last->set_next(next);
-        }
-        delete b;
-        // last stays the same.
-      } else {
-        last = b;
-      }
-
-      b = next;
-    }
-    set_has_unloaded_dependent(false);
-  }
-#ifdef ASSERT
-  else {
-    // Verification
-    for (nmethodBucket* b = _dependencies; b != NULL; b = b->next()) {
-      assert(b->count() >= 0, err_msg("bucket count: %d", b->count()));
-      assert(b->count() != 0, "empty buckets need to be cleaned");
-    }
-  }
-#endif
-}
 
 //
 // Add an nmethodBucket to the list of dependencies for this nmethod.
@@ -1907,10 +1866,13 @@
   nmethodBucket* last = NULL;
   while (b != NULL) {
     if (nm == b->get_nmethod()) {
-      int val = b->decrement();
-      guarantee(val >= 0, err_msg("Underflow: %d", val));
-      if (val == 0) {
-        set_has_unloaded_dependent(true);
+      if (b->decrement() == 0) {
+        if (last == NULL) {
+          _dependencies = b->next();
+        } else {
+          last->set_next(b->next());
+        }
+        delete b;
       }
       return;
     }
@@ -1949,11 +1911,6 @@
   nmethodBucket* b = _dependencies;
   while (b != NULL) {
     if (nm == b->get_nmethod()) {
-#ifdef ASSERT
-      int count = b->count();
-      assert(count >= 0, "Just check if we ever get here 1");
-      assert(count > 0,  "Just check if we ever get here 2");
-#endif
       return true;
     }
     b = b->next();
@@ -2252,7 +2209,7 @@
 #endif // INCLUDE_ALL_GCS
 
 void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) {
-  assert(class_loader_data()->is_alive(is_alive), "this klass should be live");
+  assert(is_loader_alive(is_alive), "this klass should be live");
   if (is_interface()) {
     if (ClassUnloading) {
       Klass* impl = implementor();