2086 2087 // Process reference objects found during marking 2088 { 2089 GCTraceTime(Trace, gc, phases) tm("Reference Processing", &_gc_timer); 2090 2091 ReferenceProcessorStats stats; 2092 if (ref_processor()->processing_is_mt()) { 2093 RefProcTaskExecutor task_executor; 2094 stats = ref_processor()->process_discovered_references( 2095 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, 2096 &task_executor, &_gc_timer); 2097 } else { 2098 stats = ref_processor()->process_discovered_references( 2099 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, NULL, 2100 &_gc_timer); 2101 } 2102 2103 gc_tracer->report_gc_reference_stats(stats); 2104 } 2105 2106 GCTraceTime(Trace, gc) tm_m("Class Unloading", &_gc_timer); 2107 2108 // This is the point where the entire marking should have completed. 2109 assert(cm->marking_stacks_empty(), "Marking should have completed"); 2110 2111 // Follow system dictionary roots and unload classes. 2112 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); 2113 2114 // Unload nmethods. 2115 CodeCache::do_unloading(is_alive_closure(), purged_class); 2116 2117 // Prune dead klasses from subklass/sibling/implementor lists. 2118 Klass::clean_weak_klass_links(is_alive_closure()); 2119 2120 // Delete entries for dead interned strings. 2121 StringTable::unlink(is_alive_closure()); 2122 2123 // Clean up unreferenced symbols in symbol table. 2124 SymbolTable::unlink(); 2125 _gc_tracer.report_object_count_after_gc(is_alive_closure()); 2126 } 2127 2128 void PSParallelCompact::adjust_roots(ParCompactionManager* cm) { 2129 // Adjust the pointers to reflect the new locations 2130 GCTraceTime(Trace, gc, phases) tm("Adjust Roots", &_gc_timer); 2131 2132 // Need new claim bits when tracing through and adjusting pointers. 2133 ClassLoaderDataGraph::clear_claimed_marks(); 2134 2135 PSParallelCompact::AdjustPointerClosure oop_closure(cm); 2136 PSParallelCompact::AdjustKlassClosure klass_closure(cm); 2137 2138 // General strong roots. 2139 Universe::oops_do(&oop_closure); 2140 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles 2141 CLDToOopClosure adjust_from_cld(&oop_closure); 2142 Threads::oops_do(&oop_closure, &adjust_from_cld, NULL); 2143 ObjectSynchronizer::oops_do(&oop_closure); 2144 FlatProfiler::oops_do(&oop_closure); | 2086 2087 // Process reference objects found during marking 2088 { 2089 GCTraceTime(Trace, gc, phases) tm("Reference Processing", &_gc_timer); 2090 2091 ReferenceProcessorStats stats; 2092 if (ref_processor()->processing_is_mt()) { 2093 RefProcTaskExecutor task_executor; 2094 stats = ref_processor()->process_discovered_references( 2095 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, 2096 &task_executor, &_gc_timer); 2097 } else { 2098 stats = ref_processor()->process_discovered_references( 2099 is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, NULL, 2100 &_gc_timer); 2101 } 2102 2103 gc_tracer->report_gc_reference_stats(stats); 2104 } 2105 2106 // This is the point where the entire marking should have completed. 2107 assert(cm->marking_stacks_empty(), "Marking should have completed"); 2108 2109 { 2110 GCTraceTime(Debug, gc) tm_m("Class Unloading", &_gc_timer); 2111 2112 // Follow system dictionary roots and unload classes. 2113 bool purged_class = SystemDictionary::do_unloading(is_alive_closure()); 2114 2115 // Unload nmethods. 2116 CodeCache::do_unloading(is_alive_closure(), purged_class); 2117 2118 // Prune dead klasses from subklass/sibling/implementor lists. 2119 Klass::clean_weak_klass_links(is_alive_closure()); 2120 } 2121 2122 { 2123 GCTraceTime(Debug, gc) t("Scrub String Table", &_gc_timer); 2124 // Delete entries for dead interned strings. 2125 StringTable::unlink(is_alive_closure()); 2126 } 2127 2128 { 2129 GCTraceTime(Debug, gc) t("Scrub Symbol Table", &_gc_timer); 2130 // Clean up unreferenced symbols in symbol table. 2131 SymbolTable::unlink(); 2132 } 2133 2134 _gc_tracer.report_object_count_after_gc(is_alive_closure()); 2135 } 2136 2137 void PSParallelCompact::adjust_roots(ParCompactionManager* cm) { 2138 // Adjust the pointers to reflect the new locations 2139 GCTraceTime(Trace, gc, phases) tm("Adjust Roots", &_gc_timer); 2140 2141 // Need new claim bits when tracing through and adjusting pointers. 2142 ClassLoaderDataGraph::clear_claimed_marks(); 2143 2144 PSParallelCompact::AdjustPointerClosure oop_closure(cm); 2145 PSParallelCompact::AdjustKlassClosure klass_closure(cm); 2146 2147 // General strong roots. 2148 Universe::oops_do(&oop_closure); 2149 JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles 2150 CLDToOopClosure adjust_from_cld(&oop_closure); 2151 Threads::oops_do(&oop_closure, &adjust_from_cld, NULL); 2152 ObjectSynchronizer::oops_do(&oop_closure); 2153 FlatProfiler::oops_do(&oop_closure); |