< prev index next >

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

Print this page




 646     if (so & SO_ScavengeCodeCache) {
 647       assert(code_roots != NULL, "must supply closure for code cache");
 648 
 649       // We only visit parts of the CodeCache when scavenging.
 650       CodeCache::scavenge_root_nmethods_do(code_roots);
 651     }
 652     if (so & SO_AllCodeCache) {
 653       assert(code_roots != NULL, "must supply closure for code cache");
 654 
 655       // CMSCollector uses this to do intermediate-strength collections.
 656       // We scan the entire code cache, since CodeCache::do_unloading is not called.
 657       CodeCache::blobs_do(code_roots);
 658     }
 659     // Verify that the code cache contents are not subject to
 660     // movement by a scavenging collection.
 661     DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, !CodeBlobToOopClosure::FixRelocations));
 662     DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
 663   }
 664 }
 665 
 666 void GenCollectedHeap::gen_process_roots(StrongRootsScope* scope,
 667                                          GenerationType type,
















 668                                          bool young_gen_as_roots,
 669                                          ScanningOption so,
 670                                          bool only_strong_roots,
 671                                          OopsInGenClosure* not_older_gens,
 672                                          OopsInGenClosure* older_gens,
 673                                          CLDClosure* cld_closure) {
 674   const bool is_adjust_phase = !only_strong_roots && !young_gen_as_roots;
 675 
 676   bool is_moving_collection = false;
 677   if (type == YoungGen || is_adjust_phase) {
 678     // young collections are always moving
 679     is_moving_collection = true;
 680   }
 681 
 682   MarkingCodeBlobClosure mark_code_closure(not_older_gens, is_moving_collection);
 683   OopsInGenClosure* weak_roots = only_strong_roots ? NULL : not_older_gens;
 684   CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
 685 
 686   process_roots(scope, so,
 687                 not_older_gens, weak_roots,
 688                 cld_closure, weak_cld_closure,
 689                 &mark_code_closure);
 690 
 691   if (young_gen_as_roots) {
 692     if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
 693       if (type == OldGen) {
 694         not_older_gens->set_generation(_young_gen);
 695         _young_gen->oop_iterate(not_older_gens);
 696       }
 697       not_older_gens->reset_generation();
 698     }
 699   }
 700   // When collection is parallel, all threads get to cooperate to do
 701   // old generation scanning.
 702   if (type == YoungGen) {
 703     older_gens->set_generation(_old_gen);
 704     rem_set()->younger_refs_iterate(_old_gen, older_gens, scope->n_threads());
 705     older_gens->reset_generation();
 706   }
 707 
 708   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 709 }
 710 
 711 
 712 class AlwaysTrueClosure: public BoolObjectClosure {
 713 public:
 714   bool do_object_b(oop p) { return true; }
 715 };
 716 static AlwaysTrueClosure always_true;
 717 
 718 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
 719   JNIHandles::weak_oops_do(&always_true, root_closure);
 720   _young_gen->ref_processor()->weak_oops_do(root_closure);
 721   _old_gen->ref_processor()->weak_oops_do(root_closure);
 722 }
 723 
 724 #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix)    \
 725 void GenCollectedHeap::                                                 \
 726 oop_since_save_marks_iterate(GenerationType gen,                        \
 727                              OopClosureType* cur,                       \
 728                              OopClosureType* older) {                   \
 729   if (gen == YoungGen) {                              \
 730     _young_gen->oop_since_save_marks_iterate##nv_suffix(cur);           \
 731     _old_gen->oop_since_save_marks_iterate##nv_suffix(older);           \




 646     if (so & SO_ScavengeCodeCache) {
 647       assert(code_roots != NULL, "must supply closure for code cache");
 648 
 649       // We only visit parts of the CodeCache when scavenging.
 650       CodeCache::scavenge_root_nmethods_do(code_roots);
 651     }
 652     if (so & SO_AllCodeCache) {
 653       assert(code_roots != NULL, "must supply closure for code cache");
 654 
 655       // CMSCollector uses this to do intermediate-strength collections.
 656       // We scan the entire code cache, since CodeCache::do_unloading is not called.
 657       CodeCache::blobs_do(code_roots);
 658     }
 659     // Verify that the code cache contents are not subject to
 660     // movement by a scavenging collection.
 661     DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, !CodeBlobToOopClosure::FixRelocations));
 662     DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
 663   }
 664 }
 665 
 666 void GenCollectedHeap::young_process_roots(StrongRootsScope* scope,
 667                                            OopsInGenClosure* root_closure,
 668                                            OopsInGenClosure* old_gen_closure,
 669                                            CLDClosure* cld_closure) {
 670   MarkingCodeBlobClosure mark_code_closure(root_closure, CodeBlobToOopClosure::FixRelocations);
 671 
 672   process_roots(scope, SO_ScavengeCodeCache, root_closure, root_closure,
 673                 cld_closure, cld_closure, &mark_code_closure);
 674 
 675   // When collection is parallel, all threads get to cooperate to do
 676   // old generation scanning.
 677   old_gen_closure->assert_generation(_old_gen);
 678   rem_set()->younger_refs_iterate(_old_gen, old_gen_closure, scope->n_threads());
 679 
 680   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 681 }
 682 
 683 void GenCollectedHeap::old_process_roots(StrongRootsScope* scope,
 684                                          bool young_gen_as_roots,
 685                                          ScanningOption so,
 686                                          bool only_strong_roots,
 687                                          OopsInGenClosure* root_closure,

 688                                          CLDClosure* cld_closure) {
 689   const bool is_moving_collection = !only_strong_roots && !young_gen_as_roots;
 690 
 691   MarkingCodeBlobClosure mark_code_closure(root_closure, is_moving_collection);
 692   OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;






 693   CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
 694 
 695   process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
 696 
 697   if (young_gen_as_roots &&
 698       !_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
 699     root_closure->assert_generation(_young_gen);
 700     _young_gen->oop_iterate(root_closure);














 701   }
 702 
 703   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 704 }
 705 

 706 class AlwaysTrueClosure: public BoolObjectClosure {
 707 public:
 708   bool do_object_b(oop p) { return true; }
 709 };
 710 static AlwaysTrueClosure always_true;
 711 
 712 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
 713   JNIHandles::weak_oops_do(&always_true, root_closure);
 714   _young_gen->ref_processor()->weak_oops_do(root_closure);
 715   _old_gen->ref_processor()->weak_oops_do(root_closure);
 716 }
 717 
 718 #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix)    \
 719 void GenCollectedHeap::                                                 \
 720 oop_since_save_marks_iterate(GenerationType gen,                        \
 721                              OopClosureType* cur,                       \
 722                              OopClosureType* older) {                   \
 723   if (gen == YoungGen) {                              \
 724     _young_gen->oop_since_save_marks_iterate##nv_suffix(cur);           \
 725     _old_gen->oop_since_save_marks_iterate##nv_suffix(older);           \


< prev index next >