< prev index next >

src/share/vm/gc/shared/genCollectedHeap.cpp

Print this page
rev 11983 : 8166276: Refactor gen_process_roots to allow simpler fix for 8165949
Reviewed-by:
Contributed-by: jesper.wilhelmsson@oracle.com
rev 11984 : 8165949: Serial and ConcMarkSweep do not unload strings when class unloading is disabled
Reviewed-by:


 649                                            OopsInGenClosure* old_gen_closure,
 650                                            CLDClosure* cld_closure) {
 651   MarkingCodeBlobClosure mark_code_closure(root_closure, CodeBlobToOopClosure::FixRelocations);
 652 
 653   process_roots(scope, SO_ScavengeCodeCache, root_closure, root_closure,
 654                 cld_closure, cld_closure, &mark_code_closure);
 655 
 656   if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
 657     root_closure->reset_generation();
 658   }
 659 
 660   // When collection is parallel, all threads get to cooperate to do
 661   // old generation scanning.
 662   old_gen_closure->set_generation(_old_gen);
 663   rem_set()->younger_refs_iterate(_old_gen, old_gen_closure, scope->n_threads());
 664   old_gen_closure->reset_generation();
 665 
 666   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 667 }
 668 
 669 void GenCollectedHeap::old_process_roots(StrongRootsScope* scope,
 670                                          bool young_gen_as_roots,
 671                                          ScanningOption so,
 672                                          bool only_strong_roots,
 673                                          OopsInGenClosure* root_closure,
 674                                          CLDClosure* cld_closure) {
 675   const bool is_moving_collection = !only_strong_roots && !young_gen_as_roots;
 676 
 677   MarkingCodeBlobClosure mark_code_closure(root_closure, is_moving_collection);
 678   OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
 679   CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
 680 
 681   process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
 682 
 683   if (young_gen_as_roots &&
 684       !_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
 685     root_closure->set_generation(_young_gen);
 686     _young_gen->oop_iterate(root_closure);
 687     root_closure->reset_generation();
 688   }















 689 
 690   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 691 }
 692 
 693 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
 694   JNIHandles::weak_oops_do(root_closure);
 695   _young_gen->ref_processor()->weak_oops_do(root_closure);
 696   _old_gen->ref_processor()->weak_oops_do(root_closure);
 697 }
 698 
 699 #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix)    \
 700 void GenCollectedHeap::                                                 \
 701 oop_since_save_marks_iterate(GenerationType gen,                        \
 702                              OopClosureType* cur,                       \
 703                              OopClosureType* older) {                   \
 704   if (gen == YoungGen) {                              \
 705     _young_gen->oop_since_save_marks_iterate##nv_suffix(cur);           \
 706     _old_gen->oop_since_save_marks_iterate##nv_suffix(older);           \
 707   } else {                                                              \
 708     _old_gen->oop_since_save_marks_iterate##nv_suffix(cur);             \




 649                                            OopsInGenClosure* old_gen_closure,
 650                                            CLDClosure* cld_closure) {
 651   MarkingCodeBlobClosure mark_code_closure(root_closure, CodeBlobToOopClosure::FixRelocations);
 652 
 653   process_roots(scope, SO_ScavengeCodeCache, root_closure, root_closure,
 654                 cld_closure, cld_closure, &mark_code_closure);
 655 
 656   if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
 657     root_closure->reset_generation();
 658   }
 659 
 660   // When collection is parallel, all threads get to cooperate to do
 661   // old generation scanning.
 662   old_gen_closure->set_generation(_old_gen);
 663   rem_set()->younger_refs_iterate(_old_gen, old_gen_closure, scope->n_threads());
 664   old_gen_closure->reset_generation();
 665 
 666   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 667 }
 668 
 669 void GenCollectedHeap::conc_process_roots(StrongRootsScope* scope,
 670                                          bool young_gen_as_roots,
 671                                          ScanningOption so,
 672                                          bool only_strong_roots,
 673                                          OopsInGenClosure* root_closure,
 674                                          CLDClosure* cld_closure) {
 675   MarkingCodeBlobClosure mark_code_closure(root_closure, !CodeBlobToOopClosure::FixRelocations);


 676   OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
 677   CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
 678 
 679   process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
 680 
 681   if (young_gen_as_roots &&
 682       !_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
 683     root_closure->set_generation(_young_gen);
 684     _young_gen->oop_iterate(root_closure);
 685     root_closure->reset_generation();
 686   }
 687 
 688   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 689 }
 690 
 691 void GenCollectedHeap::full_process_roots(StrongRootsScope* scope,
 692                                           bool only_strong_roots,
 693                                           ScanningOption so,
 694                                           bool is_adjust_phase,
 695                                           OopsInGenClosure* root_closure,
 696                                           CLDClosure* cld_closure) {
 697   MarkingCodeBlobClosure mark_code_closure(root_closure, is_adjust_phase);
 698   OopsInGenClosure* weak_roots = is_adjust_phase ? root_closure : NULL;
 699   CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
 700 
 701   process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
 702 
 703   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 704 }
 705 
 706 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
 707   JNIHandles::weak_oops_do(root_closure);
 708   _young_gen->ref_processor()->weak_oops_do(root_closure);
 709   _old_gen->ref_processor()->weak_oops_do(root_closure);
 710 }
 711 
 712 #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix)    \
 713 void GenCollectedHeap::                                                 \
 714 oop_since_save_marks_iterate(GenerationType gen,                        \
 715                              OopClosureType* cur,                       \
 716                              OopClosureType* older) {                   \
 717   if (gen == YoungGen) {                              \
 718     _young_gen->oop_since_save_marks_iterate##nv_suffix(cur);           \
 719     _old_gen->oop_since_save_marks_iterate##nv_suffix(older);           \
 720   } else {                                                              \
 721     _old_gen->oop_since_save_marks_iterate##nv_suffix(cur);             \


< prev index next >