< prev index next >

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

Print this page
rev 11873 : imported patch 8114823-disable-cls-unload
rev 11874 : 8114823: G1 doesn't honor request to disable class unloading
Reviewed-by:


 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());




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


< prev index next >