< prev index next >

src/share/vm/memory/genMarkSweep.cpp

Print this page
rev 7975 : Move remaining root processing to GenCollectedHeap


 190 void GenMarkSweep::mark_sweep_phase1(int level,
 191                                   bool clear_all_softrefs) {
 192   // Recursively traverse all live objects and mark them
 193   GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
 194   trace(" 1");
 195 
 196   GenCollectedHeap* gch = GenCollectedHeap::heap();
 197 
 198   // Because follow_root_closure is created statically, cannot
 199   // use OopsInGenClosure constructor which takes a generation,
 200   // as the Universe has not been created when the static constructors
 201   // are run.
 202   follow_root_closure.set_orig_generation(gch->get_gen(level));
 203 
 204   // Need new claim bits before marking starts.
 205   ClassLoaderDataGraph::clear_claimed_marks();
 206 
 207   gch->gen_process_roots(level,
 208                          false, // Younger gens are not roots.
 209                          true,  // activate StrongRootsScope
 210                          SharedHeap::SO_None,
 211                          GenCollectedHeap::StrongRootsOnly,
 212                          &follow_root_closure,
 213                          &follow_root_closure,
 214                          &follow_cld_closure);
 215 
 216   // Process reference objects found during marking
 217   {
 218     ref_processor()->setup_policy(clear_all_softrefs);
 219     const ReferenceProcessorStats& stats =
 220       ref_processor()->process_discovered_references(
 221         &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer, _gc_tracer->gc_id());
 222     gc_tracer()->report_gc_reference_stats(stats);
 223   }
 224 
 225   // This is the point where the entire marking should have completed.
 226   assert(_marking_stack.is_empty(), "Marking should have completed");
 227 
 228   // Unload classes and purge the SystemDictionary.
 229   bool purged_class = SystemDictionary::do_unloading(&is_alive);
 230 


 275 
 276 void GenMarkSweep::mark_sweep_phase3(int level) {
 277   GenCollectedHeap* gch = GenCollectedHeap::heap();
 278 
 279   // Adjust the pointers to reflect the new locations
 280   GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
 281   trace("3");
 282 
 283   // Need new claim bits for the pointer adjustment tracing.
 284   ClassLoaderDataGraph::clear_claimed_marks();
 285 
 286   // Because the closure below is created statically, we cannot
 287   // use OopsInGenClosure constructor which takes a generation,
 288   // as the Universe has not been created when the static constructors
 289   // are run.
 290   adjust_pointer_closure.set_orig_generation(gch->get_gen(level));
 291 
 292   gch->gen_process_roots(level,
 293                          false, // Younger gens are not roots.
 294                          true,  // activate StrongRootsScope
 295                          SharedHeap::SO_AllCodeCache,
 296                          GenCollectedHeap::StrongAndWeakRoots,
 297                          &adjust_pointer_closure,
 298                          &adjust_pointer_closure,
 299                          &adjust_cld_closure);
 300 
 301   gch->gen_process_weak_roots(&adjust_pointer_closure);
 302 
 303   adjust_marks();
 304   GenAdjustPointersClosure blk;
 305   gch->generation_iterate(&blk, true);
 306 }
 307 
 308 class GenCompactClosure: public GenCollectedHeap::GenClosure {
 309 public:
 310   void do_generation(Generation* gen) {
 311     gen->compact();
 312   }
 313 };
 314 
 315 void GenMarkSweep::mark_sweep_phase4() {


 190 void GenMarkSweep::mark_sweep_phase1(int level,
 191                                   bool clear_all_softrefs) {
 192   // Recursively traverse all live objects and mark them
 193   GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
 194   trace(" 1");
 195 
 196   GenCollectedHeap* gch = GenCollectedHeap::heap();
 197 
 198   // Because follow_root_closure is created statically, cannot
 199   // use OopsInGenClosure constructor which takes a generation,
 200   // as the Universe has not been created when the static constructors
 201   // are run.
 202   follow_root_closure.set_orig_generation(gch->get_gen(level));
 203 
 204   // Need new claim bits before marking starts.
 205   ClassLoaderDataGraph::clear_claimed_marks();
 206 
 207   gch->gen_process_roots(level,
 208                          false, // Younger gens are not roots.
 209                          true,  // activate StrongRootsScope
 210                          GenCollectedHeap::SO_None,
 211                          GenCollectedHeap::StrongRootsOnly,
 212                          &follow_root_closure,
 213                          &follow_root_closure,
 214                          &follow_cld_closure);
 215 
 216   // Process reference objects found during marking
 217   {
 218     ref_processor()->setup_policy(clear_all_softrefs);
 219     const ReferenceProcessorStats& stats =
 220       ref_processor()->process_discovered_references(
 221         &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer, _gc_tracer->gc_id());
 222     gc_tracer()->report_gc_reference_stats(stats);
 223   }
 224 
 225   // This is the point where the entire marking should have completed.
 226   assert(_marking_stack.is_empty(), "Marking should have completed");
 227 
 228   // Unload classes and purge the SystemDictionary.
 229   bool purged_class = SystemDictionary::do_unloading(&is_alive);
 230 


 275 
 276 void GenMarkSweep::mark_sweep_phase3(int level) {
 277   GenCollectedHeap* gch = GenCollectedHeap::heap();
 278 
 279   // Adjust the pointers to reflect the new locations
 280   GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
 281   trace("3");
 282 
 283   // Need new claim bits for the pointer adjustment tracing.
 284   ClassLoaderDataGraph::clear_claimed_marks();
 285 
 286   // Because the closure below is created statically, we cannot
 287   // use OopsInGenClosure constructor which takes a generation,
 288   // as the Universe has not been created when the static constructors
 289   // are run.
 290   adjust_pointer_closure.set_orig_generation(gch->get_gen(level));
 291 
 292   gch->gen_process_roots(level,
 293                          false, // Younger gens are not roots.
 294                          true,  // activate StrongRootsScope
 295                          GenCollectedHeap::SO_AllCodeCache,
 296                          GenCollectedHeap::StrongAndWeakRoots,
 297                          &adjust_pointer_closure,
 298                          &adjust_pointer_closure,
 299                          &adjust_cld_closure);
 300 
 301   gch->gen_process_weak_roots(&adjust_pointer_closure);
 302 
 303   adjust_marks();
 304   GenAdjustPointersClosure blk;
 305   gch->generation_iterate(&blk, true);
 306 }
 307 
 308 class GenCompactClosure: public GenCollectedHeap::GenClosure {
 309 public:
 310   void do_generation(Generation* gen) {
 311     gen->compact();
 312   }
 313 };
 314 
 315 void GenMarkSweep::mark_sweep_phase4() {
< prev index next >