src/share/vm/oops/instanceKlass.cpp

changeset 8185
5cece4584b8e
parent 8049
c2c7fed86a5e
child 8497
50e62b688ddc
     1.1 --- a/src/share/vm/oops/instanceKlass.cpp	Wed Dec 02 17:48:20 2015 -0800
     1.2 +++ b/src/share/vm/oops/instanceKlass.cpp	Thu Nov 12 09:53:17 2015 +0100
     1.3 @@ -1969,7 +1969,7 @@
     1.4  // find a corresponding bucket otherwise there's a bug in the
     1.5  // recording of dependecies.
     1.6  //
     1.7 -void InstanceKlass::remove_dependent_nmethod(nmethod* nm) {
     1.8 +void InstanceKlass::remove_dependent_nmethod(nmethod* nm, bool delete_immediately) {
     1.9    assert_locked_or_safepoint(CodeCache_lock);
    1.10    nmethodBucket* b = _dependencies;
    1.11    nmethodBucket* last = NULL;
    1.12 @@ -1978,7 +1978,17 @@
    1.13        int val = b->decrement();
    1.14        guarantee(val >= 0, err_msg("Underflow: %d", val));
    1.15        if (val == 0) {
    1.16 -        set_has_unloaded_dependent(true);
    1.17 +        if (delete_immediately) {
    1.18 +          if (last == NULL) {
    1.19 +            _dependencies = b->next();
    1.20 +          } else {
    1.21 +            last->set_next(b->next());
    1.22 +          }
    1.23 +          delete b;
    1.24 +        } else {
    1.25 +          // The deletion of this entry is deferred until a later, potentially parallel GC phase.
    1.26 +          set_has_unloaded_dependent(true);
    1.27 +        }
    1.28        }
    1.29        return;
    1.30      }
    1.31 @@ -2318,6 +2328,13 @@
    1.32  
    1.33  #endif // INCLUDE_ALL_GCS
    1.34  
    1.35 +void InstanceKlass::clean_weak_instanceklass_links(BoolObjectClosure* is_alive) {
    1.36 +  clean_implementors_list(is_alive);
    1.37 +  clean_method_data(is_alive);
    1.38 +
    1.39 +  clean_dependent_nmethods();
    1.40 +}
    1.41 +
    1.42  void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) {
    1.43    assert(class_loader_data()->is_alive(is_alive), "this klass should be live");
    1.44    if (is_interface()) {

mercurial