src/hotspot/share/classfile/systemDictionary.cpp
changeset 53587 739eaf4ac4ad
parent 53338 5afdd1100a20
child 53746 bdccafc038a2
equal deleted inserted replaced
53586:5bc1634bc0ca 53587:739eaf4ac4ad
  1823     // First, mark for unload all ClassLoaderData referencing a dead class loader.
  1823     // First, mark for unload all ClassLoaderData referencing a dead class loader.
  1824     unloading_occurred = ClassLoaderDataGraph::do_unloading();
  1824     unloading_occurred = ClassLoaderDataGraph::do_unloading();
  1825     if (unloading_occurred) {
  1825     if (unloading_occurred) {
  1826       MutexLockerEx ml2(is_concurrent ? Module_lock : NULL);
  1826       MutexLockerEx ml2(is_concurrent ? Module_lock : NULL);
  1827       JFR_ONLY(Jfr::on_unloading_classes();)
  1827       JFR_ONLY(Jfr::on_unloading_classes();)
       
  1828 
  1828       MutexLockerEx ml1(is_concurrent ? SystemDictionary_lock : NULL);
  1829       MutexLockerEx ml1(is_concurrent ? SystemDictionary_lock : NULL);
  1829       ClassLoaderDataGraph::clean_module_and_package_info();
  1830       ClassLoaderDataGraph::clean_module_and_package_info();
  1830     }
       
  1831   }
       
  1832 
       
  1833   // Cleanup ResolvedMethodTable even if no unloading occurred.
       
  1834   {
       
  1835     GCTraceTime(Debug, gc, phases) t("ResolvedMethodTable", gc_timer);
       
  1836     ResolvedMethodTable::trigger_cleanup();
       
  1837   }
       
  1838 
       
  1839   if (unloading_occurred) {
       
  1840     {
       
  1841       GCTraceTime(Debug, gc, phases) t("SymbolTable", gc_timer);
       
  1842       // Check if there's work to do in the SymbolTable
       
  1843       SymbolTable::do_check_concurrent_work();
       
  1844     }
       
  1845 
       
  1846     {
       
  1847       MutexLockerEx ml(is_concurrent ? SystemDictionary_lock : NULL);
       
  1848       GCTraceTime(Debug, gc, phases) t("Dictionary", gc_timer);
       
  1849       constraints()->purge_loader_constraints();
  1831       constraints()->purge_loader_constraints();
  1850       resolution_errors()->purge_resolution_errors();
  1832       resolution_errors()->purge_resolution_errors();
  1851     }
  1833     }
  1852 
  1834   }
  1853     {
  1835 
  1854       GCTraceTime(Debug, gc, phases) t("ResolvedMethodTable", gc_timer);
  1836   GCTraceTime(Debug, gc, phases) t("Trigger cleanups", gc_timer);
  1855       // Oops referenced by the protection domain cache table may get unreachable independently
  1837   // Trigger cleaning the ResolvedMethodTable even if no unloading occurred.
  1856       // of the class loader (eg. cached protection domain oops). So we need to
  1838   ResolvedMethodTable::trigger_cleanup();
  1857       // explicitly unlink them here.
  1839 
  1858       // All protection domain oops are linked to the caller class, so if nothing
  1840   if (unloading_occurred) {
  1859       // unloads, this is not needed.
  1841     SymbolTable::trigger_cleanup();
  1860       _pd_cache_table->trigger_cleanup();
  1842 
  1861     }
  1843     // Oops referenced by the protection domain cache table may get unreachable independently
       
  1844     // of the class loader (eg. cached protection domain oops). So we need to
       
  1845     // explicitly unlink them here.
       
  1846     // All protection domain oops are linked to the caller class, so if nothing
       
  1847     // unloads, this is not needed.
       
  1848     _pd_cache_table->trigger_cleanup();
  1862   }
  1849   }
  1863 
  1850 
  1864   return unloading_occurred;
  1851   return unloading_occurred;
  1865 }
  1852 }
  1866 
  1853