src/share/vm/gc_implementation/g1/heapRegion.cpp

Print this page
rev 5920 : 8035406: Improve data structure for Code Cache remembered sets
Summary: Change the code cache remembered sets data structure from a GrowableArray to a chunked list of nmethods. This makes the data structure more amenable to parallelization, and decreases freeing time.
Reviewed-by:


 693   bool failures()       { return _failures; }
 694 };
 695 
 696 void HeapRegion::verify_strong_code_roots(VerifyOption vo, bool* failures) const {
 697   if (!G1VerifyHeapRegionCodeRoots) {
 698     // We're not verifying code roots.
 699     return;
 700   }
 701   if (vo == VerifyOption_G1UseMarkWord) {
 702     // Marking verification during a full GC is performed after class
 703     // unloading, code cache unloading, etc so the strong code roots
 704     // attached to each heap region are in an inconsistent state. They won't
 705     // be consistent until the strong code roots are rebuilt after the
 706     // actual GC. Skip verifying the strong code roots in this particular
 707     // time.
 708     assert(VerifyDuringGC, "only way to get here");
 709     return;
 710   }
 711 
 712   HeapRegionRemSet* hrrs = rem_set();
 713   int strong_code_roots_length = hrrs->strong_code_roots_list_length();
 714 
 715   // if this region is empty then there should be no entries
 716   // on its strong code root list
 717   if (is_empty()) {
 718     if (strong_code_roots_length > 0) {
 719       gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is empty "
 720                              "but has "INT32_FORMAT" code root entries",
 721                              bottom(), end(), strong_code_roots_length);
 722       *failures = true;
 723     }
 724     return;
 725   }
 726 
 727   if (continuesHumongous()) {
 728     if (strong_code_roots_length > 0) {
 729       gclog_or_tty->print_cr("region "HR_FORMAT" is a continuation of a humongous "
 730                              "region but has "INT32_FORMAT" code root entries",
 731                              HR_FORMAT_PARAMS(this), strong_code_roots_length);
 732       *failures = true;
 733     }
 734     return;
 735   }
 736 
 737   VerifyStrongCodeRootCodeBlobClosure cb_cl(this);
 738   strong_code_roots_do(&cb_cl);
 739 
 740   if (cb_cl.failures()) {
 741     *failures = true;
 742   }
 743 }
 744 
 745 void HeapRegion::print() const { print_on(gclog_or_tty); }
 746 void HeapRegion::print_on(outputStream* st) const {
 747   if (isHumongous()) {
 748     if (startsHumongous())
 749       st->print(" HS");
 750     else




 693   bool failures()       { return _failures; }
 694 };
 695 
 696 void HeapRegion::verify_strong_code_roots(VerifyOption vo, bool* failures) const {
 697   if (!G1VerifyHeapRegionCodeRoots) {
 698     // We're not verifying code roots.
 699     return;
 700   }
 701   if (vo == VerifyOption_G1UseMarkWord) {
 702     // Marking verification during a full GC is performed after class
 703     // unloading, code cache unloading, etc so the strong code roots
 704     // attached to each heap region are in an inconsistent state. They won't
 705     // be consistent until the strong code roots are rebuilt after the
 706     // actual GC. Skip verifying the strong code roots in this particular
 707     // time.
 708     assert(VerifyDuringGC, "only way to get here");
 709     return;
 710   }
 711 
 712   HeapRegionRemSet* hrrs = rem_set();
 713   size_t strong_code_roots_length = hrrs->strong_code_roots_list_length();
 714 
 715   // if this region is empty then there should be no entries
 716   // on its strong code root list
 717   if (is_empty()) {
 718     if (strong_code_roots_length > 0) {
 719       gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is empty "
 720                              "but has "SIZE_FORMAT" code root entries",
 721                              bottom(), end(), strong_code_roots_length);
 722       *failures = true;
 723     }
 724     return;
 725   }
 726 
 727   if (continuesHumongous()) {
 728     if (strong_code_roots_length > 0) {
 729       gclog_or_tty->print_cr("region "HR_FORMAT" is a continuation of a humongous "
 730                              "region but has "SIZE_FORMAT" code root entries",
 731                              HR_FORMAT_PARAMS(this), strong_code_roots_length);
 732       *failures = true;
 733     }
 734     return;
 735   }
 736 
 737   VerifyStrongCodeRootCodeBlobClosure cb_cl(this);
 738   strong_code_roots_do(&cb_cl);
 739 
 740   if (cb_cl.failures()) {
 741     *failures = true;
 742   }
 743 }
 744 
 745 void HeapRegion::print() const { print_on(gclog_or_tty); }
 746 void HeapRegion::print_on(outputStream* st) const {
 747   if (isHumongous()) {
 748     if (startsHumongous())
 749       st->print(" HS");
 750     else