src/hotspot/share/classfile/classLoaderData.cpp
changeset 52587 6cd56deebb0d
parent 52141 de6dc206a92b
child 52852 eb95a38b2964
equal deleted inserted replaced
52586:74109912c738 52587:6cd56deebb0d
   482 }
   482 }
   483 
   483 
   484 // Remove a klass from the _klasses list for scratch_class during redefinition
   484 // Remove a klass from the _klasses list for scratch_class during redefinition
   485 // or parsed class in the case of an error.
   485 // or parsed class in the case of an error.
   486 void ClassLoaderData::remove_class(Klass* scratch_class) {
   486 void ClassLoaderData::remove_class(Klass* scratch_class) {
   487   assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
   487   assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
   488 
   488 
   489   // Adjust global class iterator.
   489   // Adjust global class iterator.
   490   ClassLoaderDataGraph::adjust_saved_class(scratch_class);
   490   ClassLoaderDataGraph::adjust_saved_class(scratch_class);
   491 
   491 
   492   Klass* prev = NULL;
   492   Klass* prev = NULL;
   802   }
   802   }
   803 }
   803 }
   804 
   804 
   805 // Deallocate free metadata on the free list.  How useful the PermGen was!
   805 // Deallocate free metadata on the free list.  How useful the PermGen was!
   806 void ClassLoaderData::free_deallocate_list() {
   806 void ClassLoaderData::free_deallocate_list() {
   807   // Don't need lock, at safepoint
   807   // This must be called at a safepoint because it depends on metadata walking at
       
   808   // safepoint cleanup time.
   808   assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
   809   assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
   809   assert(!is_unloading(), "only called for ClassLoaderData that are not unloading");
   810   assert(!is_unloading(), "only called for ClassLoaderData that are not unloading");
   810   if (_deallocate_list == NULL) {
   811   if (_deallocate_list == NULL) {
   811     return;
   812     return;
   812   }
   813   }
   842 // unloading, this frees the C heap memory for items on the list, and unlinks
   843 // unloading, this frees the C heap memory for items on the list, and unlinks
   843 // scratch or error classes so that unloading events aren't triggered for these
   844 // scratch or error classes so that unloading events aren't triggered for these
   844 // classes. The metadata is removed with the unloading metaspace.
   845 // classes. The metadata is removed with the unloading metaspace.
   845 // There isn't C heap memory allocated for methods, so nothing is done for them.
   846 // There isn't C heap memory allocated for methods, so nothing is done for them.
   846 void ClassLoaderData::free_deallocate_list_C_heap_structures() {
   847 void ClassLoaderData::free_deallocate_list_C_heap_structures() {
   847   // Don't need lock, at safepoint
   848   assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
   848   assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
       
   849   assert(is_unloading(), "only called for ClassLoaderData that are unloading");
   849   assert(is_unloading(), "only called for ClassLoaderData that are unloading");
   850   if (_deallocate_list == NULL) {
   850   if (_deallocate_list == NULL) {
   851     return;
   851     return;
   852   }
   852   }
   853   // Go backwards because this removes entries that are freed.
   853   // Go backwards because this removes entries that are freed.