src/share/vm/classfile/classLoaderData.cpp

changeset 6742
e4a6e7f1b90b
parent 6680
78bbf4d43a14
child 6876
710a3c8b516e
child 6974
556a06aec3fa
     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();

mercurial