8047812: Ensure ClassLoaderDataGraph::classes_unloading_do only delivers klasses from CLDs with non-reclaimed class loader oops hs25.20-b21

Tue, 01 Jul 2014 10:36:19 +0200

author
mgronlun
date
Tue, 01 Jul 2014 10:36:19 +0200
changeset 6742
e4a6e7f1b90b
parent 6741
ae92351815b6
child 6743
f7429096a202

8047812: Ensure ClassLoaderDataGraph::classes_unloading_do only delivers klasses from CLDs with non-reclaimed class loader oops
Reviewed-by: coleenp, sspitsyn, ehelin

src/share/vm/classfile/classLoaderData.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/classLoaderData.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/classfile/classLoaderData.cpp	Fri Jun 20 10:48:36 2014 -0400
     1.2 +++ b/src/share/vm/classfile/classLoaderData.cpp	Tue Jul 01 10:36:19 2014 +0200
     1.3 @@ -531,6 +531,7 @@
     1.4  // GC root of class loader data created.
     1.5  ClassLoaderData* ClassLoaderDataGraph::_head = NULL;
     1.6  ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
     1.7 +ClassLoaderData* ClassLoaderDataGraph::_saved_unloading = NULL;
     1.8  ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
     1.9  
    1.10  bool ClassLoaderDataGraph::_should_purge = false;
    1.11 @@ -628,7 +629,9 @@
    1.12  
    1.13  void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
    1.14    assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
    1.15 -  for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
    1.16 +  // Only walk the head until any clds not purged from prior unloading
    1.17 +  // (CMS doesn't purge right away).
    1.18 +  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
    1.19      cld->classes_do(f);
    1.20    }
    1.21  }
    1.22 @@ -676,6 +679,11 @@
    1.23    ClassLoaderData* data = _head;
    1.24    ClassLoaderData* prev = NULL;
    1.25    bool seen_dead_loader = false;
    1.26 +
    1.27 +  // Save previous _unloading pointer for CMS which may add to unloading list before
    1.28 +  // purging and we don't want to rewalk the previously unloaded class loader data.
    1.29 +  _saved_unloading = _unloading;
    1.30 +
    1.31    // mark metadata seen on the stack and code cache so we can delete
    1.32    // unneeded entries.
    1.33    bool has_redefined_a_class = JvmtiExport::has_redefined_a_class();
     2.1 --- a/src/share/vm/classfile/classLoaderData.hpp	Fri Jun 20 10:48:36 2014 -0400
     2.2 +++ b/src/share/vm/classfile/classLoaderData.hpp	Tue Jul 01 10:36:19 2014 +0200
     2.3 @@ -66,6 +66,7 @@
     2.4    static ClassLoaderData* _unloading;
     2.5    // CMS support.
     2.6    static ClassLoaderData* _saved_head;
     2.7 +  static ClassLoaderData* _saved_unloading;
     2.8    static bool _should_purge;
     2.9  
    2.10    static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);

mercurial