< prev index next >

src/share/vm/gc/g1/g1MarkSweep.cpp

Print this page




 113 }
 114 
 115 
 116 void G1MarkSweep::allocate_stacks() {
 117   GenMarkSweep::_preserved_count_max = 0;
 118   GenMarkSweep::_preserved_marks = NULL;
 119   GenMarkSweep::_preserved_count = 0;
 120 }
 121 
 122 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
 123                                     bool clear_all_softrefs) {
 124   // Recursively traverse all live objects and mark them
 125   GCTraceTime(Info, gc, phases) tm("Phase 1: Mark live objects", gc_timer());
 126 
 127   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 128 
 129   // Need cleared claim bits for the roots processing
 130   ClassLoaderDataGraph::clear_claimed_marks();
 131 
 132   MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations);
 133   {
 134     G1RootProcessor root_processor(g1h, 1);
 135     root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure,
 136                                         &GenMarkSweep::follow_cld_closure,
 137                                         &follow_code_closure);





 138   }
 139 
 140   {
 141     GCTraceTime(Debug, gc, phases) trace("Reference Processing", gc_timer());
 142 
 143     // Process reference objects found during marking
 144     ReferenceProcessor* rp = GenMarkSweep::ref_processor();
 145     assert(rp == g1h->ref_processor_stw(), "Sanity");
 146 
 147     rp->setup_policy(clear_all_softrefs);
 148     const ReferenceProcessorStats& stats =
 149         rp->process_discovered_references(&GenMarkSweep::is_alive,
 150                                           &GenMarkSweep::keep_alive,
 151                                           &GenMarkSweep::follow_stack_closure,
 152                                           NULL,
 153                                           gc_timer());
 154     gc_tracer()->report_gc_reference_stats(stats);
 155   }
 156 
 157   // This is the point where the entire marking should have completed.
 158   assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed");
 159 
 160   {
 161     GCTraceTime(Debug, gc, phases) trace("Class Unloading", gc_timer());
 162 
 163     // Unload classes and purge the SystemDictionary.
 164     bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive);
 165 
 166     // Unload nmethods.
 167     CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class);
 168 
 169     // Prune dead klasses from subklass/sibling/implementor lists.
 170     Klass::clean_weak_klass_links(&GenMarkSweep::is_alive);
 171   }
 172 
 173   {
 174     GCTraceTime(Debug, gc, phases) trace("Scrub String and Symbol Tables", gc_timer());
 175     // Delete entries for dead interned string and clean up unreferenced symbols in symbol table.
 176     g1h->unlink_string_and_symbol_table(&GenMarkSweep::is_alive);
 177   }
 178 
 179   if (G1StringDedup::is_enabled()) {
 180     GCTraceTime(Debug, gc, phases) trace("String Deduplication Unlink", gc_timer());




 113 }
 114 
 115 
 116 void G1MarkSweep::allocate_stacks() {
 117   GenMarkSweep::_preserved_count_max = 0;
 118   GenMarkSweep::_preserved_marks = NULL;
 119   GenMarkSweep::_preserved_count = 0;
 120 }
 121 
 122 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
 123                                     bool clear_all_softrefs) {
 124   // Recursively traverse all live objects and mark them
 125   GCTraceTime(Info, gc, phases) tm("Phase 1: Mark live objects", gc_timer());
 126 
 127   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 128 
 129   // Need cleared claim bits for the roots processing
 130   ClassLoaderDataGraph::clear_claimed_marks();
 131 
 132   MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations);
 133   if (ClassUnloading) {
 134     G1RootProcessor root_processor(g1h, 1);
 135     root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure,
 136                                         &GenMarkSweep::follow_cld_closure,
 137                                         &follow_code_closure);
 138   } else {
 139     G1RootProcessor root_processor(g1h, 1);
 140     root_processor.process_all_roots(&GenMarkSweep::follow_root_closure,
 141                                      &GenMarkSweep::follow_cld_closure,
 142                                      &follow_code_closure);
 143   }
 144 
 145   {
 146     GCTraceTime(Debug, gc, phases) trace("Reference Processing", gc_timer());
 147 
 148     // Process reference objects found during marking
 149     ReferenceProcessor* rp = GenMarkSweep::ref_processor();
 150     assert(rp == g1h->ref_processor_stw(), "Sanity");
 151 
 152     rp->setup_policy(clear_all_softrefs);
 153     const ReferenceProcessorStats& stats =
 154         rp->process_discovered_references(&GenMarkSweep::is_alive,
 155                                           &GenMarkSweep::keep_alive,
 156                                           &GenMarkSweep::follow_stack_closure,
 157                                           NULL,
 158                                           gc_timer());
 159     gc_tracer()->report_gc_reference_stats(stats);
 160   }
 161 
 162   // This is the point where the entire marking should have completed.
 163   assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed");
 164 
 165   if (ClassUnloading) {
 166     GCTraceTime(Debug, gc, phases) trace("Class Unloading", gc_timer());
 167 
 168     // Unload classes and purge the SystemDictionary.
 169     bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive);
 170 
 171     // Unload nmethods.
 172     CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class);
 173 
 174     // Prune dead klasses from subklass/sibling/implementor lists.
 175     Klass::clean_weak_klass_links(&GenMarkSweep::is_alive);
 176   }
 177 
 178   {
 179     GCTraceTime(Debug, gc, phases) trace("Scrub String and Symbol Tables", gc_timer());
 180     // Delete entries for dead interned string and clean up unreferenced symbols in symbol table.
 181     g1h->unlink_string_and_symbol_table(&GenMarkSweep::is_alive);
 182   }
 183 
 184   if (G1StringDedup::is_enabled()) {
 185     GCTraceTime(Debug, gc, phases) trace("String Deduplication Unlink", gc_timer());


< prev index next >