< prev index next >

src/hotspot/share/classfile/classLoaderData.cpp

Print this page




 588   }
 589   ShouldNotReachHere();   // should have found this class!!
 590 }
 591 
 592 void ClassLoaderData::unload() {
 593   _unloading = true;
 594 
 595   LogTarget(Trace, class, loader, data) lt;
 596   if (lt.is_enabled()) {
 597     ResourceMark rm;
 598     LogStream ls(lt);
 599     ls.print("unload");
 600     print_value_on(&ls);
 601     ls.cr();
 602   }
 603 
 604   // Some items on the _deallocate_list need to free their C heap structures
 605   // if they are not already on the _klasses list.
 606   free_deallocate_list_C_heap_structures();
 607 
 608   // Tell serviceability tools these classes are unloading

 609   // after erroneous classes are released.
 610   classes_do(InstanceKlass::notify_unload_class);
 611 
 612   // Clean up global class iterator for compiler
 613   static_klass_iterator.adjust_saved_class(this);
 614 }
 615 
 616 ModuleEntryTable* ClassLoaderData::modules() {
 617   // Lazily create the module entry table at first request.
 618   // Lock-free access requires load_acquire.
 619   ModuleEntryTable* modules = OrderAccess::load_acquire(&_modules);
 620   if (modules == NULL) {
 621     MutexLocker m1(Module_lock);
 622     // Check if _modules got allocated while we were waiting for this lock.
 623     if ((modules = _modules) == NULL) {
 624       modules = new ModuleEntryTable(ModuleEntryTable::_moduletable_entry_size);
 625 
 626       {
 627         MutexLockerEx m1(metaspace_lock(), Mutex::_no_safepoint_check_flag);
 628         // Ensure _modules is stable, since it is examined without a lock
 629         OrderAccess::release_store(&_modules, modules);
 630       }




 588   }
 589   ShouldNotReachHere();   // should have found this class!!
 590 }
 591 
 592 void ClassLoaderData::unload() {
 593   _unloading = true;
 594 
 595   LogTarget(Trace, class, loader, data) lt;
 596   if (lt.is_enabled()) {
 597     ResourceMark rm;
 598     LogStream ls(lt);
 599     ls.print("unload");
 600     print_value_on(&ls);
 601     ls.cr();
 602   }
 603 
 604   // Some items on the _deallocate_list need to free their C heap structures
 605   // if they are not already on the _klasses list.
 606   free_deallocate_list_C_heap_structures();
 607 
 608   // Clean up class dependencies and tell serviceability tools
 609   // these classes are unloading.  Must be called
 610   // after erroneous classes are released.
 611   classes_do(InstanceKlass::unload_class);
 612 
 613   // Clean up global class iterator for compiler
 614   static_klass_iterator.adjust_saved_class(this);
 615 }
 616 
 617 ModuleEntryTable* ClassLoaderData::modules() {
 618   // Lazily create the module entry table at first request.
 619   // Lock-free access requires load_acquire.
 620   ModuleEntryTable* modules = OrderAccess::load_acquire(&_modules);
 621   if (modules == NULL) {
 622     MutexLocker m1(Module_lock);
 623     // Check if _modules got allocated while we were waiting for this lock.
 624     if ((modules = _modules) == NULL) {
 625       modules = new ModuleEntryTable(ModuleEntryTable::_moduletable_entry_size);
 626 
 627       {
 628         MutexLockerEx m1(metaspace_lock(), Mutex::_no_safepoint_check_flag);
 629         // Ensure _modules is stable, since it is examined without a lock
 630         OrderAccess::release_store(&_modules, modules);
 631       }


< prev index next >