hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
changeset 23450 c7c6202fc7e2
parent 22903 4a0602246320
child 23451 ed2b8bb28fed
equal deleted inserted replaced
23227:af06c27bdb0d 23450:c7c6202fc7e2
  1296   print_heap_before_gc();
  1296   print_heap_before_gc();
  1297   trace_heap_before_gc(gc_tracer);
  1297   trace_heap_before_gc(gc_tracer);
  1298 
  1298 
  1299   size_t metadata_prev_used = MetaspaceAux::allocated_used_bytes();
  1299   size_t metadata_prev_used = MetaspaceAux::allocated_used_bytes();
  1300 
  1300 
  1301   HRSPhaseSetter x(HRSPhaseFullGC);
       
  1302   verify_region_sets_optional();
  1301   verify_region_sets_optional();
  1303 
  1302 
  1304   const bool do_clear_all_soft_refs = clear_all_soft_refs ||
  1303   const bool do_clear_all_soft_refs = clear_all_soft_refs ||
  1305                            collector_policy()->should_clear_all_soft_refs();
  1304                            collector_policy()->should_clear_all_soft_refs();
  1306 
  1305 
  1926   _mark_in_progress(false),
  1925   _mark_in_progress(false),
  1927   _cg1r(NULL), _summary_bytes_used(0),
  1926   _cg1r(NULL), _summary_bytes_used(0),
  1928   _g1mm(NULL),
  1927   _g1mm(NULL),
  1929   _refine_cte_cl(NULL),
  1928   _refine_cte_cl(NULL),
  1930   _full_collection(false),
  1929   _full_collection(false),
  1931   _free_list("Master Free List"),
  1930   _free_list("Master Free List", new MasterFreeRegionListMtSafeChecker()),
  1932   _secondary_free_list("Secondary Free List"),
  1931   _secondary_free_list("Secondary Free List", new SecondaryFreeRegionListMtSafeChecker()),
  1933   _old_set("Old Set"),
  1932   _old_set("Old Set", false /* humongous */, new OldRegionSetMtSafeChecker()),
  1934   _humongous_set("Master Humongous Set"),
  1933   _humongous_set("Master Humongous Set", true /* humongous */, new HumongousRegionSetMtSafeChecker()),
  1935   _free_regions_coming(false),
  1934   _free_regions_coming(false),
  1936   _young_list(new YoungList(this)),
  1935   _young_list(new YoungList(this)),
  1937   _gc_time_stamp(0),
  1936   _gc_time_stamp(0),
  1938   _retained_old_gc_alloc_region(NULL),
  1937   _retained_old_gc_alloc_region(NULL),
  1939   _survivor_plab_stats(YoungPLABSize, PLABWeight),
  1938   _survivor_plab_stats(YoungPLABSize, PLABWeight),
  2077   size_t max_cards_per_region = ((size_t)1 << (sizeof(CardIdx_t)*BitsPerByte-1)) - 1;
  2076   size_t max_cards_per_region = ((size_t)1 << (sizeof(CardIdx_t)*BitsPerByte-1)) - 1;
  2078   guarantee(HeapRegion::CardsPerRegion > 0, "make sure it's initialized");
  2077   guarantee(HeapRegion::CardsPerRegion > 0, "make sure it's initialized");
  2079   guarantee(HeapRegion::CardsPerRegion < max_cards_per_region,
  2078   guarantee(HeapRegion::CardsPerRegion < max_cards_per_region,
  2080             "too many cards per region");
  2079             "too many cards per region");
  2081 
  2080 
  2082   HeapRegionSet::set_unrealistically_long_length(max_regions() + 1);
  2081   FreeRegionList::set_unrealistically_long_length(max_regions() + 1);
  2083 
  2082 
  2084   _bot_shared = new G1BlockOffsetSharedArray(_reserved,
  2083   _bot_shared = new G1BlockOffsetSharedArray(_reserved,
  2085                                              heap_word_size(init_byte_size));
  2084                                              heap_word_size(init_byte_size));
  2086 
  2085 
  2087   _g1h = this;
  2086   _g1h = this;
  3885   ResourceMark rm;
  3884   ResourceMark rm;
  3886 
  3885 
  3887   print_heap_before_gc();
  3886   print_heap_before_gc();
  3888   trace_heap_before_gc(_gc_tracer_stw);
  3887   trace_heap_before_gc(_gc_tracer_stw);
  3889 
  3888 
  3890   HRSPhaseSetter x(HRSPhaseEvacuation);
       
  3891   verify_region_sets_optional();
  3889   verify_region_sets_optional();
  3892   verify_dirty_young_regions();
  3890   verify_dirty_young_regions();
  3893 
  3891 
  3894   // This call will decide whether this pause is an initial-mark
  3892   // This call will decide whether this pause is an initial-mark
  3895   // pause. If it is, during_initial_mark_pause() will return true
  3893   // pause. If it is, during_initial_mark_pause() will return true
  5935     assert(dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
  5933     assert(dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
  5936   }
  5934   }
  5937   COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
  5935   COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
  5938 }
  5936 }
  5939 
  5937 
  5940 void G1CollectedHeap::free_region_if_empty(HeapRegion* hr,
       
  5941                                      size_t* pre_used,
       
  5942                                      FreeRegionList* free_list,
       
  5943                                      OldRegionSet* old_proxy_set,
       
  5944                                      HumongousRegionSet* humongous_proxy_set,
       
  5945                                      HRRSCleanupTask* hrrs_cleanup_task,
       
  5946                                      bool par) {
       
  5947   if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young()) {
       
  5948     if (hr->isHumongous()) {
       
  5949       assert(hr->startsHumongous(), "we should only see starts humongous");
       
  5950       free_humongous_region(hr, pre_used, free_list, humongous_proxy_set, par);
       
  5951     } else {
       
  5952       _old_set.remove_with_proxy(hr, old_proxy_set);
       
  5953       free_region(hr, pre_used, free_list, par);
       
  5954     }
       
  5955   } else {
       
  5956     hr->rem_set()->do_cleanup_work(hrrs_cleanup_task);
       
  5957   }
       
  5958 }
       
  5959 
       
  5960 void G1CollectedHeap::free_region(HeapRegion* hr,
  5938 void G1CollectedHeap::free_region(HeapRegion* hr,
  5961                                   size_t* pre_used,
       
  5962                                   FreeRegionList* free_list,
  5939                                   FreeRegionList* free_list,
  5963                                   bool par) {
  5940                                   bool par) {
  5964   assert(!hr->isHumongous(), "this is only for non-humongous regions");
  5941   assert(!hr->isHumongous(), "this is only for non-humongous regions");
  5965   assert(!hr->is_empty(), "the region should not be empty");
  5942   assert(!hr->is_empty(), "the region should not be empty");
  5966   assert(free_list != NULL, "pre-condition");
  5943   assert(free_list != NULL, "pre-condition");
  5969   // Note: we only need to do this if the region is not young
  5946   // Note: we only need to do this if the region is not young
  5970   // (since we don't refine cards in young regions).
  5947   // (since we don't refine cards in young regions).
  5971   if (!hr->is_young()) {
  5948   if (!hr->is_young()) {
  5972     _cg1r->hot_card_cache()->reset_card_counts(hr);
  5949     _cg1r->hot_card_cache()->reset_card_counts(hr);
  5973   }
  5950   }
  5974   *pre_used += hr->used();
       
  5975   hr->hr_clear(par, true /* clear_space */);
  5951   hr->hr_clear(par, true /* clear_space */);
  5976   free_list->add_as_head(hr);
  5952   free_list->add_as_head(hr);
  5977 }
  5953 }
  5978 
  5954 
  5979 void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
  5955 void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
  5980                                      size_t* pre_used,
       
  5981                                      FreeRegionList* free_list,
  5956                                      FreeRegionList* free_list,
  5982                                      HumongousRegionSet* humongous_proxy_set,
       
  5983                                      bool par) {
  5957                                      bool par) {
  5984   assert(hr->startsHumongous(), "this is only for starts humongous regions");
  5958   assert(hr->startsHumongous(), "this is only for starts humongous regions");
  5985   assert(free_list != NULL, "pre-condition");
  5959   assert(free_list != NULL, "pre-condition");
  5986   assert(humongous_proxy_set != NULL, "pre-condition");
  5960 
  5987 
       
  5988   size_t hr_used = hr->used();
       
  5989   size_t hr_capacity = hr->capacity();
  5961   size_t hr_capacity = hr->capacity();
  5990   size_t hr_pre_used = 0;
       
  5991   _humongous_set.remove_with_proxy(hr, humongous_proxy_set);
       
  5992   // We need to read this before we make the region non-humongous,
  5962   // We need to read this before we make the region non-humongous,
  5993   // otherwise the information will be gone.
  5963   // otherwise the information will be gone.
  5994   uint last_index = hr->last_hc_index();
  5964   uint last_index = hr->last_hc_index();
  5995   hr->set_notHumongous();
  5965   hr->set_notHumongous();
  5996   free_region(hr, &hr_pre_used, free_list, par);
  5966   free_region(hr, free_list, par);
  5997 
  5967 
  5998   uint i = hr->hrs_index() + 1;
  5968   uint i = hr->hrs_index() + 1;
  5999   while (i < last_index) {
  5969   while (i < last_index) {
  6000     HeapRegion* curr_hr = region_at(i);
  5970     HeapRegion* curr_hr = region_at(i);
  6001     assert(curr_hr->continuesHumongous(), "invariant");
  5971     assert(curr_hr->continuesHumongous(), "invariant");
  6002     curr_hr->set_notHumongous();
  5972     curr_hr->set_notHumongous();
  6003     free_region(curr_hr, &hr_pre_used, free_list, par);
  5973     free_region(curr_hr, free_list, par);
  6004     i += 1;
  5974     i += 1;
  6005   }
  5975   }
  6006   assert(hr_pre_used == hr_used,
  5976 }
  6007          err_msg("hr_pre_used: "SIZE_FORMAT" and hr_used: "SIZE_FORMAT" "
  5977 
  6008                  "should be the same", hr_pre_used, hr_used));
  5978 void G1CollectedHeap::remove_from_old_sets(const HeapRegionSetCount& old_regions_removed,
  6009   *pre_used += hr_pre_used;
  5979                                        const HeapRegionSetCount& humongous_regions_removed) {
  6010 }
  5980   if (old_regions_removed.length() > 0 || humongous_regions_removed.length() > 0) {
  6011 
  5981     MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
  6012 void G1CollectedHeap::update_sets_after_freeing_regions(size_t pre_used,
  5982     _old_set.bulk_remove(old_regions_removed);
  6013                                        FreeRegionList* free_list,
  5983     _humongous_set.bulk_remove(humongous_regions_removed);
  6014                                        OldRegionSet* old_proxy_set,
  5984   }
  6015                                        HumongousRegionSet* humongous_proxy_set,
  5985 
  6016                                        bool par) {
  5986 }
  6017   if (pre_used > 0) {
  5987 
  6018     Mutex* lock = (par) ? ParGCRareEvent_lock : NULL;
  5988 void G1CollectedHeap::prepend_to_freelist(FreeRegionList* list) {
  6019     MutexLockerEx x(lock, Mutex::_no_safepoint_check_flag);
  5989   assert(list != NULL, "list can't be null");
  6020     assert(_summary_bytes_used >= pre_used,
  5990   if (!list->is_empty()) {
  6021            err_msg("invariant: _summary_bytes_used: "SIZE_FORMAT" "
       
  6022                    "should be >= pre_used: "SIZE_FORMAT,
       
  6023                    _summary_bytes_used, pre_used));
       
  6024     _summary_bytes_used -= pre_used;
       
  6025   }
       
  6026   if (free_list != NULL && !free_list->is_empty()) {
       
  6027     MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
  5991     MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
  6028     _free_list.add_as_head(free_list);
  5992     _free_list.add_as_head(list);
  6029   }
  5993   }
  6030   if (old_proxy_set != NULL && !old_proxy_set->is_empty()) {
  5994 }
  6031     MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
  5995 
  6032     _old_set.update_from_proxy(old_proxy_set);
  5996 void G1CollectedHeap::decrement_summary_bytes(size_t bytes) {
  6033   }
  5997   assert(_summary_bytes_used >= bytes,
  6034   if (humongous_proxy_set != NULL && !humongous_proxy_set->is_empty()) {
  5998          err_msg("invariant: _summary_bytes_used: "SIZE_FORMAT" should be >= bytes: "SIZE_FORMAT,
  6035     MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
  5999                   _summary_bytes_used, bytes));
  6036     _humongous_set.update_from_proxy(humongous_proxy_set);
  6000   _summary_bytes_used -= bytes;
  6037   }
       
  6038 }
  6001 }
  6039 
  6002 
  6040 class G1ParCleanupCTTask : public AbstractGangTask {
  6003 class G1ParCleanupCTTask : public AbstractGangTask {
  6041   G1SATBCardTableModRefBS* _ct_bs;
  6004   G1SATBCardTableModRefBS* _ct_bs;
  6042   G1CollectedHeap* _g1h;
  6005   G1CollectedHeap* _g1h;
  6225     if (!cur->evacuation_failed()) {
  6188     if (!cur->evacuation_failed()) {
  6226       MemRegion used_mr = cur->used_region();
  6189       MemRegion used_mr = cur->used_region();
  6227 
  6190 
  6228       // And the region is empty.
  6191       // And the region is empty.
  6229       assert(!used_mr.is_empty(), "Should not have empty regions in a CS.");
  6192       assert(!used_mr.is_empty(), "Should not have empty regions in a CS.");
  6230       free_region(cur, &pre_used, &local_free_list, false /* par */);
  6193       pre_used += cur->used();
       
  6194       free_region(cur, &local_free_list, false /* par */);
  6231     } else {
  6195     } else {
  6232       cur->uninstall_surv_rate_group();
  6196       cur->uninstall_surv_rate_group();
  6233       if (cur->is_young()) {
  6197       if (cur->is_young()) {
  6234         cur->set_young_index_in_cset(-1);
  6198         cur->set_young_index_in_cset(-1);
  6235       }
  6199       }
  6253     non_young_time_ms += elapsed_ms;
  6217     non_young_time_ms += elapsed_ms;
  6254   } else {
  6218   } else {
  6255     young_time_ms += elapsed_ms;
  6219     young_time_ms += elapsed_ms;
  6256   }
  6220   }
  6257 
  6221 
  6258   update_sets_after_freeing_regions(pre_used, &local_free_list,
  6222   prepend_to_freelist(&local_free_list);
  6259                                     NULL /* old_proxy_set */,
  6223   decrement_summary_bytes(pre_used);
  6260                                     NULL /* humongous_proxy_set */,
       
  6261                                     false /* par */);
       
  6262   policy->phase_times()->record_young_free_cset_time_ms(young_time_ms);
  6224   policy->phase_times()->record_young_free_cset_time_ms(young_time_ms);
  6263   policy->phase_times()->record_non_young_free_cset_time_ms(non_young_time_ms);
  6225   policy->phase_times()->record_non_young_free_cset_time_ms(non_young_time_ms);
  6264 }
  6226 }
  6265 
  6227 
  6266 // This routine is similar to the above but does not record
  6228 // This routine is similar to the above but does not record
  6368   return ret;
  6330   return ret;
  6369 }
  6331 }
  6370 
  6332 
  6371 class TearDownRegionSetsClosure : public HeapRegionClosure {
  6333 class TearDownRegionSetsClosure : public HeapRegionClosure {
  6372 private:
  6334 private:
  6373   OldRegionSet *_old_set;
  6335   HeapRegionSet *_old_set;
  6374 
  6336 
  6375 public:
  6337 public:
  6376   TearDownRegionSetsClosure(OldRegionSet* old_set) : _old_set(old_set) { }
  6338   TearDownRegionSetsClosure(HeapRegionSet* old_set) : _old_set(old_set) { }
  6377 
  6339 
  6378   bool doHeapRegion(HeapRegion* r) {
  6340   bool doHeapRegion(HeapRegion* r) {
  6379     if (r->is_empty()) {
  6341     if (r->is_empty()) {
  6380       // We ignore empty regions, we'll empty the free list afterwards
  6342       // We ignore empty regions, we'll empty the free list afterwards
  6381     } else if (r->is_young()) {
  6343     } else if (r->is_young()) {
  6410 }
  6372 }
  6411 
  6373 
  6412 class RebuildRegionSetsClosure : public HeapRegionClosure {
  6374 class RebuildRegionSetsClosure : public HeapRegionClosure {
  6413 private:
  6375 private:
  6414   bool            _free_list_only;
  6376   bool            _free_list_only;
  6415   OldRegionSet*   _old_set;
  6377   HeapRegionSet*   _old_set;
  6416   FreeRegionList* _free_list;
  6378   FreeRegionList* _free_list;
  6417   size_t          _total_used;
  6379   size_t          _total_used;
  6418 
  6380 
  6419 public:
  6381 public:
  6420   RebuildRegionSetsClosure(bool free_list_only,
  6382   RebuildRegionSetsClosure(bool free_list_only,
  6421                            OldRegionSet* old_set, FreeRegionList* free_list) :
  6383                            HeapRegionSet* old_set, FreeRegionList* free_list) :
  6422     _free_list_only(free_list_only),
  6384     _free_list_only(free_list_only),
  6423     _old_set(old_set), _free_list(free_list), _total_used(0) {
  6385     _old_set(old_set), _free_list(free_list), _total_used(0) {
  6424     assert(_free_list->is_empty(), "pre-condition");
  6386     assert(_free_list->is_empty(), "pre-condition");
  6425     if (!free_list_only) {
  6387     if (!free_list_only) {
  6426       assert(_old_set->is_empty(), "pre-condition");
  6388       assert(_old_set->is_empty(), "pre-condition");
  6613 }
  6575 }
  6614 // Heap region set verification
  6576 // Heap region set verification
  6615 
  6577 
  6616 class VerifyRegionListsClosure : public HeapRegionClosure {
  6578 class VerifyRegionListsClosure : public HeapRegionClosure {
  6617 private:
  6579 private:
  6618   FreeRegionList*     _free_list;
  6580   HeapRegionSet*   _old_set;
  6619   OldRegionSet*       _old_set;
  6581   HeapRegionSet*   _humongous_set;
  6620   HumongousRegionSet* _humongous_set;
  6582   FreeRegionList*  _free_list;
  6621   uint                _region_count;
       
  6622 
  6583 
  6623 public:
  6584 public:
  6624   VerifyRegionListsClosure(OldRegionSet* old_set,
  6585   HeapRegionSetCount _old_count;
  6625                            HumongousRegionSet* humongous_set,
  6586   HeapRegionSetCount _humongous_count;
       
  6587   HeapRegionSetCount _free_count;
       
  6588 
       
  6589   VerifyRegionListsClosure(HeapRegionSet* old_set,
       
  6590                            HeapRegionSet* humongous_set,
  6626                            FreeRegionList* free_list) :
  6591                            FreeRegionList* free_list) :
  6627     _old_set(old_set), _humongous_set(humongous_set),
  6592     _old_set(old_set), _humongous_set(humongous_set), _free_list(free_list),
  6628     _free_list(free_list), _region_count(0) { }
  6593     _old_count(), _humongous_count(), _free_count(){ }
  6629 
       
  6630   uint region_count() { return _region_count; }
       
  6631 
  6594 
  6632   bool doHeapRegion(HeapRegion* hr) {
  6595   bool doHeapRegion(HeapRegion* hr) {
  6633     _region_count += 1;
       
  6634 
       
  6635     if (hr->continuesHumongous()) {
  6596     if (hr->continuesHumongous()) {
  6636       return false;
  6597       return false;
  6637     }
  6598     }
  6638 
  6599 
  6639     if (hr->is_young()) {
  6600     if (hr->is_young()) {
  6640       // TODO
  6601       // TODO
  6641     } else if (hr->startsHumongous()) {
  6602     } else if (hr->startsHumongous()) {
  6642       _humongous_set->verify_next_region(hr);
  6603       assert(hr->containing_set() == _humongous_set, err_msg("Heap region %u is starts humongous but not in humongous set.", hr->region_num()));
       
  6604       _humongous_count.increment(1u, hr->capacity());
  6643     } else if (hr->is_empty()) {
  6605     } else if (hr->is_empty()) {
  6644       _free_list->verify_next_region(hr);
  6606       assert(hr->containing_set() == _free_list, err_msg("Heap region %u is empty but not on the free list.", hr->region_num()));
       
  6607       _free_count.increment(1u, hr->capacity());
  6645     } else {
  6608     } else {
  6646       _old_set->verify_next_region(hr);
  6609       assert(hr->containing_set() == _old_set, err_msg("Heap region %u is old but not in the old set.", hr->region_num()));
       
  6610       _old_count.increment(1u, hr->capacity());
  6647     }
  6611     }
  6648     return false;
  6612     return false;
       
  6613   }
       
  6614 
       
  6615   void verify_counts(HeapRegionSet* old_set, HeapRegionSet* humongous_set, FreeRegionList* free_list) {
       
  6616     guarantee(old_set->length() == _old_count.length(), err_msg("Old set count mismatch. Expected %u, actual %u.", old_set->length(), _old_count.length()));
       
  6617     guarantee(old_set->total_capacity_bytes() == _old_count.capacity(), err_msg("Old set capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT,
       
  6618         old_set->total_capacity_bytes(), _old_count.capacity()));
       
  6619 
       
  6620     guarantee(humongous_set->length() == _humongous_count.length(), err_msg("Hum set count mismatch. Expected %u, actual %u.", humongous_set->length(), _humongous_count.length()));
       
  6621     guarantee(humongous_set->total_capacity_bytes() == _humongous_count.capacity(), err_msg("Hum set capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT,
       
  6622         humongous_set->total_capacity_bytes(), _humongous_count.capacity()));
       
  6623 
       
  6624     guarantee(free_list->length() == _free_count.length(), err_msg("Free list count mismatch. Expected %u, actual %u.", free_list->length(), _free_count.length()));
       
  6625     guarantee(free_list->total_capacity_bytes() == _free_count.capacity(), err_msg("Free list capacity mismatch. Expected " SIZE_FORMAT ", actual " SIZE_FORMAT,
       
  6626         free_list->total_capacity_bytes(), _free_count.capacity()));
  6649   }
  6627   }
  6650 };
  6628 };
  6651 
  6629 
  6652 HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index,
  6630 HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index,
  6653                                              HeapWord* bottom) {
  6631                                              HeapWord* bottom) {
  6660 
  6638 
  6661 void G1CollectedHeap::verify_region_sets() {
  6639 void G1CollectedHeap::verify_region_sets() {
  6662   assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
  6640   assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
  6663 
  6641 
  6664   // First, check the explicit lists.
  6642   // First, check the explicit lists.
  6665   _free_list.verify();
  6643   _free_list.verify_list();
  6666   {
  6644   {
  6667     // Given that a concurrent operation might be adding regions to
  6645     // Given that a concurrent operation might be adding regions to
  6668     // the secondary free list we have to take the lock before
  6646     // the secondary free list we have to take the lock before
  6669     // verifying it.
  6647     // verifying it.
  6670     MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag);
  6648     MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag);
  6671     _secondary_free_list.verify();
  6649     _secondary_free_list.verify_list();
  6672   }
  6650   }
  6673   _old_set.verify();
       
  6674   _humongous_set.verify();
       
  6675 
  6651 
  6676   // If a concurrent region freeing operation is in progress it will
  6652   // If a concurrent region freeing operation is in progress it will
  6677   // be difficult to correctly attributed any free regions we come
  6653   // be difficult to correctly attributed any free regions we come
  6678   // across to the correct free list given that they might belong to
  6654   // across to the correct free list given that they might belong to
  6679   // one of several (free_list, secondary_free_list, any local lists,
  6655   // one of several (free_list, secondary_free_list, any local lists,
  6692   // attributed to the free_list.
  6668   // attributed to the free_list.
  6693   append_secondary_free_list_if_not_empty_with_lock();
  6669   append_secondary_free_list_if_not_empty_with_lock();
  6694 
  6670 
  6695   // Finally, make sure that the region accounting in the lists is
  6671   // Finally, make sure that the region accounting in the lists is
  6696   // consistent with what we see in the heap.
  6672   // consistent with what we see in the heap.
  6697   _old_set.verify_start();
       
  6698   _humongous_set.verify_start();
       
  6699   _free_list.verify_start();
       
  6700 
  6673 
  6701   VerifyRegionListsClosure cl(&_old_set, &_humongous_set, &_free_list);
  6674   VerifyRegionListsClosure cl(&_old_set, &_humongous_set, &_free_list);
  6702   heap_region_iterate(&cl);
  6675   heap_region_iterate(&cl);
  6703 
  6676   cl.verify_counts(&_old_set, &_humongous_set, &_free_list);
  6704   _old_set.verify_end();
       
  6705   _humongous_set.verify_end();
       
  6706   _free_list.verify_end();
       
  6707 }
  6677 }
  6708 
  6678 
  6709 // Optimized nmethod scanning
  6679 // Optimized nmethod scanning
  6710 
  6680 
  6711 class RegisterNMethodOopClosure: public OopClosure {
  6681 class RegisterNMethodOopClosure: public OopClosure {