< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page
rev 52404 : imported patch 8213307-rmt-cleanup


1828 void SystemDictionary::add_to_hierarchy(InstanceKlass* k, TRAPS) {
1829   assert(k != NULL, "just checking");
1830   assert_locked_or_safepoint(Compile_lock);
1831 
1832   // Link into hierachy. Make sure the vtables are initialized before linking into
1833   k->append_to_sibling_list();                    // add to superklass/sibling list
1834   k->process_interfaces(THREAD);                  // handle all "implements" declarations
1835   k->set_init_state(InstanceKlass::loaded);
1836   // Now flush all code that depended on old class hierarchy.
1837   // Note: must be done *after* linking k into the hierarchy (was bug 12/9/97)
1838   // Also, first reinitialize vtable because it may have gotten out of synch
1839   // while the new class wasn't connected to the class hierarchy.
1840   CodeCache::flush_dependents_on(k);
1841 }
1842 
1843 // ----------------------------------------------------------------------------
1844 // GC support
1845 
1846 // Assumes classes in the SystemDictionary are only unloaded at a safepoint
1847 // Note: anonymous classes are not in the SD.
1848 bool SystemDictionary::do_unloading(GCTimer* gc_timer,
1849                                     bool do_cleaning) {
1850 
1851   bool unloading_occurred;
1852   {
1853     GCTraceTime(Debug, gc, phases) t("ClassLoaderData", gc_timer);
1854 
1855     // First, mark for unload all ClassLoaderData referencing a dead class loader.
1856     unloading_occurred = ClassLoaderDataGraph::do_unloading(do_cleaning);
1857     if (unloading_occurred) {
1858       JFR_ONLY(Jfr::on_unloading_classes();)
1859       ClassLoaderDataGraph::clean_module_and_package_info();
1860     }
1861   }
1862 
1863   // TODO: just return if !unloading_occurred.
1864   if (unloading_occurred) {
1865     {
1866       GCTraceTime(Debug, gc, phases) t("SymbolTable", gc_timer);
1867       // Check if there's work to do in the SymbolTable
1868       SymbolTable::do_check_concurrent_work();
1869     }
1870 
1871     {
1872       GCTraceTime(Debug, gc, phases) t("Dictionary", gc_timer);
1873       constraints()->purge_loader_constraints();
1874       resolution_errors()->purge_resolution_errors();
1875     }
1876   }
1877 
1878   {
1879     GCTraceTime(Debug, gc, phases) t("ProtectionDomainCacheTable", gc_timer);
1880     // Oops referenced by the protection domain cache table may get unreachable independently
1881     // of the class loader (eg. cached protection domain oops). So we need to
1882     // explicitly unlink them here.
1883     _pd_cache_table->trigger_cleanup();
1884   }
1885 
1886   if (do_cleaning) {
1887     GCTraceTime(Debug, gc, phases) t("ResolvedMethodTable", gc_timer);
1888     ResolvedMethodTable::trigger_cleanup();
1889   }
1890 
1891   return unloading_occurred;
1892 }
1893 
1894 void SystemDictionary::oops_do(OopClosure* f) {
1895   f->do_oop(&_java_system_loader);
1896   f->do_oop(&_java_platform_loader);
1897   f->do_oop(&_system_loader_lock_obj);
1898   CDS_ONLY(SystemDictionaryShared::oops_do(f);)
1899 
1900   // Visit extra methods
1901   invoke_method_table()->oops_do(f);
1902 }
1903 
1904 // CDS: scan and relocate all classes in the system dictionary.
1905 void SystemDictionary::classes_do(MetaspaceClosure* it) {
1906   ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(it);
1907 }
1908 
1909 // CDS: scan and relocate all classes referenced by _well_known_klasses[].




1828 void SystemDictionary::add_to_hierarchy(InstanceKlass* k, TRAPS) {
1829   assert(k != NULL, "just checking");
1830   assert_locked_or_safepoint(Compile_lock);
1831 
1832   // Link into hierachy. Make sure the vtables are initialized before linking into
1833   k->append_to_sibling_list();                    // add to superklass/sibling list
1834   k->process_interfaces(THREAD);                  // handle all "implements" declarations
1835   k->set_init_state(InstanceKlass::loaded);
1836   // Now flush all code that depended on old class hierarchy.
1837   // Note: must be done *after* linking k into the hierarchy (was bug 12/9/97)
1838   // Also, first reinitialize vtable because it may have gotten out of synch
1839   // while the new class wasn't connected to the class hierarchy.
1840   CodeCache::flush_dependents_on(k);
1841 }
1842 
1843 // ----------------------------------------------------------------------------
1844 // GC support
1845 
1846 // Assumes classes in the SystemDictionary are only unloaded at a safepoint
1847 // Note: anonymous classes are not in the SD.
1848 bool SystemDictionary::do_unloading(GCTimer* gc_timer) {

1849 
1850   bool unloading_occurred;
1851   {
1852     GCTraceTime(Debug, gc, phases) t("ClassLoaderData", gc_timer);
1853 
1854     // First, mark for unload all ClassLoaderData referencing a dead class loader.
1855     unloading_occurred = ClassLoaderDataGraph::do_unloading();
1856     if (unloading_occurred) {
1857       JFR_ONLY(Jfr::on_unloading_classes();)
1858       ClassLoaderDataGraph::clean_module_and_package_info();
1859     }
1860   }
1861 
1862   // TODO: just return if !unloading_occurred.
1863   if (unloading_occurred) {
1864     {
1865       GCTraceTime(Debug, gc, phases) t("SymbolTable", gc_timer);
1866       // Check if there's work to do in the SymbolTable
1867       SymbolTable::do_check_concurrent_work();
1868     }
1869 
1870     {
1871       GCTraceTime(Debug, gc, phases) t("Dictionary", gc_timer);
1872       constraints()->purge_loader_constraints();
1873       resolution_errors()->purge_resolution_errors();
1874     }
1875   }
1876 
1877   {
1878     GCTraceTime(Debug, gc, phases) t("ProtectionDomainCacheTable", gc_timer);
1879     // Oops referenced by the protection domain cache table may get unreachable independently
1880     // of the class loader (eg. cached protection domain oops). So we need to
1881     // explicitly unlink them here.
1882     _pd_cache_table->trigger_cleanup();
1883   }
1884 

1885   GCTraceTime(Debug, gc, phases) t("ResolvedMethodTable", gc_timer);
1886   ResolvedMethodTable::trigger_cleanup();

1887 
1888   return unloading_occurred;
1889 }
1890 
1891 void SystemDictionary::oops_do(OopClosure* f) {
1892   f->do_oop(&_java_system_loader);
1893   f->do_oop(&_java_platform_loader);
1894   f->do_oop(&_system_loader_lock_obj);
1895   CDS_ONLY(SystemDictionaryShared::oops_do(f);)
1896 
1897   // Visit extra methods
1898   invoke_method_table()->oops_do(f);
1899 }
1900 
1901 // CDS: scan and relocate all classes in the system dictionary.
1902 void SystemDictionary::classes_do(MetaspaceClosure* it) {
1903   ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(it);
1904 }
1905 
1906 // CDS: scan and relocate all classes referenced by _well_known_klasses[].


< prev index next >