src/share/vm/classfile/classLoaderData.cpp

changeset 6678
7384f6a12fc1
parent 6316
85318d1fe8fe
child 6680
78bbf4d43a14
     1.1 --- a/src/share/vm/classfile/classLoaderData.cpp	Thu May 15 09:25:27 2014 -0400
     1.2 +++ b/src/share/vm/classfile/classLoaderData.cpp	Thu May 15 18:23:26 2014 -0400
     1.3 @@ -533,6 +533,8 @@
     1.4  ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
     1.5  ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
     1.6  
     1.7 +bool ClassLoaderDataGraph::_should_purge = false;
     1.8 +
     1.9  // Add a new class loader data node to the list.  Assign the newly created
    1.10  // ClassLoaderData into the java/lang/ClassLoader object as a hidden field
    1.11  ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_anonymous, TRAPS) {
    1.12 @@ -655,32 +657,6 @@
    1.13    return array;
    1.14  }
    1.15  
    1.16 -// For profiling and hsfind() only.  Otherwise, this is unsafe (and slow).  This
    1.17 -// is done lock free to avoid lock inversion problems.  It is safe because
    1.18 -// new ClassLoaderData are added to the end of the CLDG, and only removed at
    1.19 -// safepoint.  The _unloading list can be deallocated concurrently with CMS so
    1.20 -// this doesn't look in metaspace for classes that have been unloaded.
    1.21 -bool ClassLoaderDataGraph::contains(const void* x) {
    1.22 -  if (DumpSharedSpaces) {
    1.23 -    // There are only two metaspaces to worry about.
    1.24 -    ClassLoaderData* ncld = ClassLoaderData::the_null_class_loader_data();
    1.25 -    return (ncld->ro_metaspace()->contains(x) || ncld->rw_metaspace()->contains(x));
    1.26 -  }
    1.27 -
    1.28 -  if (UseSharedSpaces && MetaspaceShared::is_in_shared_space(x)) {
    1.29 -    return true;
    1.30 -  }
    1.31 -
    1.32 -  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
    1.33 -    if (cld->metaspace_or_null() != NULL && cld->metaspace_or_null()->contains(x)) {
    1.34 -      return true;
    1.35 -    }
    1.36 -  }
    1.37 -
    1.38 -  // Do not check unloading list because deallocation can be concurrent.
    1.39 -  return false;
    1.40 -}
    1.41 -
    1.42  #ifndef PRODUCT
    1.43  bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
    1.44    for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
    1.45 @@ -739,6 +715,7 @@
    1.46  }
    1.47  
    1.48  void ClassLoaderDataGraph::purge() {
    1.49 +  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
    1.50    ClassLoaderData* list = _unloading;
    1.51    _unloading = NULL;
    1.52    ClassLoaderData* next = list;

mercurial