< prev index next >

src/share/vm/gc/serial/genMarkSweep.cpp

Print this page




 201                            false, // Younger gens are not roots.
 202                            GenCollectedHeap::SO_None,
 203                            ClassUnloading,
 204                            &follow_root_closure,
 205                            &follow_root_closure,
 206                            &follow_cld_closure);
 207   }
 208 
 209   // Process reference objects found during marking
 210   {
 211     ref_processor()->setup_policy(clear_all_softrefs);
 212     const ReferenceProcessorStats& stats =
 213       ref_processor()->process_discovered_references(
 214         &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer);
 215     gc_tracer()->report_gc_reference_stats(stats);
 216   }
 217 
 218   // This is the point where the entire marking should have completed.
 219   assert(_marking_stack.is_empty(), "Marking should have completed");
 220 



 221   // Unload classes and purge the SystemDictionary.
 222   bool purged_class = SystemDictionary::do_unloading(&is_alive);
 223 
 224   // Unload nmethods.
 225   CodeCache::do_unloading(&is_alive, purged_class);
 226 
 227   // Prune dead klasses from subklass/sibling/implementor lists.
 228   Klass::clean_weak_klass_links(&is_alive);

 229 


 230   // Delete entries for dead interned strings.
 231   StringTable::unlink(&is_alive);

 232 


 233   // Clean up unreferenced symbols in symbol table.
 234   SymbolTable::unlink();

 235 
 236   gc_tracer()->report_object_count_after_gc(&is_alive);
 237 }
 238 
 239 
 240 void GenMarkSweep::mark_sweep_phase2() {
 241   // Now all live objects are marked, compute the new object addresses.
 242 
 243   // It is imperative that we traverse perm_gen LAST. If dead space is
 244   // allowed a range of dead object may get overwritten by a dead int
 245   // array. If perm_gen is not traversed last a Klass* may get
 246   // overwritten. This is fine since it is dead, but if the class has dead
 247   // instances we have to skip them, and in order to find their size we
 248   // need the Klass*!
 249   //
 250   // It is not required that we traverse spaces in the same order in
 251   // phase2, phase3 and phase4, but the ValidateMarkSweep live oops
 252   // tracking expects us to do so. See comment under phase4.
 253 
 254   GenCollectedHeap* gch = GenCollectedHeap::heap();




 201                            false, // Younger gens are not roots.
 202                            GenCollectedHeap::SO_None,
 203                            ClassUnloading,
 204                            &follow_root_closure,
 205                            &follow_root_closure,
 206                            &follow_cld_closure);
 207   }
 208 
 209   // Process reference objects found during marking
 210   {
 211     ref_processor()->setup_policy(clear_all_softrefs);
 212     const ReferenceProcessorStats& stats =
 213       ref_processor()->process_discovered_references(
 214         &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer);
 215     gc_tracer()->report_gc_reference_stats(stats);
 216   }
 217 
 218   // This is the point where the entire marking should have completed.
 219   assert(_marking_stack.is_empty(), "Marking should have completed");
 220 
 221   {
 222     GCTraceTime(Debug, gc) tm_m("Class Unloading", gc_timer());
 223 
 224     // Unload classes and purge the SystemDictionary.
 225     bool purged_class = SystemDictionary::do_unloading(&is_alive);
 226 
 227     // Unload nmethods.
 228     CodeCache::do_unloading(&is_alive, purged_class);
 229 
 230     // Prune dead klasses from subklass/sibling/implementor lists.
 231     Klass::clean_weak_klass_links(&is_alive);
 232   }
 233 
 234   {
 235     GCTraceTime(Debug, gc) t("Scrub String Table", gc_timer());
 236     // Delete entries for dead interned strings.
 237     StringTable::unlink(&is_alive);
 238   }
 239 
 240   {
 241     GCTraceTime(Debug, gc) t("Scrub Symbol Table", gc_timer());
 242     // Clean up unreferenced symbols in symbol table.
 243     SymbolTable::unlink();
 244   }
 245 
 246   gc_tracer()->report_object_count_after_gc(&is_alive);
 247 }
 248 
 249 
 250 void GenMarkSweep::mark_sweep_phase2() {
 251   // Now all live objects are marked, compute the new object addresses.
 252 
 253   // It is imperative that we traverse perm_gen LAST. If dead space is
 254   // allowed a range of dead object may get overwritten by a dead int
 255   // array. If perm_gen is not traversed last a Klass* may get
 256   // overwritten. This is fine since it is dead, but if the class has dead
 257   // instances we have to skip them, and in order to find their size we
 258   // need the Klass*!
 259   //
 260   // It is not required that we traverse spaces in the same order in
 261   // phase2, phase3 and phase4, but the ValidateMarkSweep live oops
 262   // tracking expects us to do so. See comment under phase4.
 263 
 264   GenCollectedHeap* gch = GenCollectedHeap::heap();


< prev index next >