< prev index next >

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

Print this page
rev 12504 : 8171238: Unify cleanup code used in G1 Remark and Full GC marking
Reviewed-by:


 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());
 188     G1StringDedup::unlink(&GenMarkSweep::is_alive);
 189   }
 190 
 191   if (VerifyDuringGC) {
 192     HandleMark hm;  // handle scope
 193 #if defined(COMPILER2) || INCLUDE_JVMCI
 194     DerivedPointerTableDeactivate dpt_deact;
 195 #endif
 196     g1h->prepare_for_verify();
 197     // Note: we can verify only the heap here. When an object is
 198     // marked, the previous value of the mark word (including
 199     // identity hash values, ages, etc) is preserved, and the mark
 200     // word is set to markOop::marked_value - effectively removing
 201     // any hash values from the mark word. These hash values are
 202     // used when verifying the dictionaries and so removing them
 203     // from the mark word can make verification of the dictionaries
 204     // fail. At the end of the GC, the original mark word values
 205     // (including hash values) are restored to the appropriate
 206     // objects.
 207     GCTraceTime(Info, gc, verify)("During GC (full)");
 208     g1h->verify(VerifyOption_G1UseMarkWord);




 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     g1h->full_cleaning(&GenMarkSweep::is_alive, purged_class);
 174   } else {
 175     GCTraceTime(Debug, gc, phases) trace("Cleanup", gc_timer());
 176     g1h->partial_cleaning(&GenMarkSweep::is_alive, true, true, G1StringDedup::is_enabled());












 177   }
 178 
 179   if (VerifyDuringGC) {
 180     HandleMark hm;  // handle scope
 181 #if defined(COMPILER2) || INCLUDE_JVMCI
 182     DerivedPointerTableDeactivate dpt_deact;
 183 #endif
 184     g1h->prepare_for_verify();
 185     // Note: we can verify only the heap here. When an object is
 186     // marked, the previous value of the mark word (including
 187     // identity hash values, ages, etc) is preserved, and the mark
 188     // word is set to markOop::marked_value - effectively removing
 189     // any hash values from the mark word. These hash values are
 190     // used when verifying the dictionaries and so removing them
 191     // from the mark word can make verification of the dictionaries
 192     // fail. At the end of the GC, the original mark word values
 193     // (including hash values) are restored to the appropriate
 194     // objects.
 195     GCTraceTime(Info, gc, verify)("During GC (full)");
 196     g1h->verify(VerifyOption_G1UseMarkWord);


< prev index next >