< prev index next >

src/hotspot/share/gc/g1/heapRegionRemSet.cpp

Print this page




 597     return _sparse_table.contains_card(hr_ind, card_index);
 598   }
 599 }
 600 
 601 HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetTable* bot,
 602                                    HeapRegion* hr)
 603   : _bot(bot),
 604     _code_roots(),
 605     _m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrm_index()), true, Monitor::_safepoint_check_never),
 606     _other_regions(&_m),
 607     _hr(hr),
 608     _state(Untracked)
 609 {
 610 }
 611 
 612 void HeapRegionRemSet::clear_fcc() {
 613   G1FromCardCache::clear(_hr->hrm_index());
 614 }
 615 
 616 void HeapRegionRemSet::setup_remset_size() {


 617   const int LOG_M = 20;
 618   guarantee(HeapRegion::LogOfHRGrainBytes >= LOG_M, "Code assumes the region size >= 1M, but is " SIZE_FORMAT "B", HeapRegion::GrainBytes);
 619 
 620   int region_size_log_mb = HeapRegion::LogOfHRGrainBytes - LOG_M;
 621   if (FLAG_IS_DEFAULT(G1RSetSparseRegionEntries)) {
 622     G1RSetSparseRegionEntries = G1RSetSparseRegionEntriesBase * ((size_t)1 << (region_size_log_mb + 1));
 623   }
 624   if (FLAG_IS_DEFAULT(G1RSetRegionEntries)) {
 625     G1RSetRegionEntries = G1RSetRegionEntriesBase * (region_size_log_mb + 1);
 626   }
 627   guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity");
 628 }
 629 
 630 void HeapRegionRemSet::clear(bool only_cardset) {
 631   MutexLocker x(&_m, Mutex::_no_safepoint_check_flag);
 632   clear_locked(only_cardset);
 633 }
 634 
 635 void HeapRegionRemSet::clear_locked(bool only_cardset) {
 636   if (!only_cardset) {
 637     _code_roots.clear();
 638   }
 639   clear_fcc();
 640   _other_regions.clear();
 641   set_state_empty();
 642   assert(occupied_locked() == 0, "Should be clear.");




 597     return _sparse_table.contains_card(hr_ind, card_index);
 598   }
 599 }
 600 
 601 HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetTable* bot,
 602                                    HeapRegion* hr)
 603   : _bot(bot),
 604     _code_roots(),
 605     _m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrm_index()), true, Monitor::_safepoint_check_never),
 606     _other_regions(&_m),
 607     _hr(hr),
 608     _state(Untracked)
 609 {
 610 }
 611 
 612 void HeapRegionRemSet::clear_fcc() {
 613   G1FromCardCache::clear(_hr->hrm_index());
 614 }
 615 
 616 void HeapRegionRemSet::setup_remset_size() {
 617   // Setup sparse and fine-grain tables sizes.
 618   // table_size = base * (log(region_size / 1M) + 1)
 619   const int LOG_M = 20;
 620   int region_size_log_mb = MAX2(HeapRegion::LogOfHRGrainBytes - LOG_M, 0);


 621   if (FLAG_IS_DEFAULT(G1RSetSparseRegionEntries)) {
 622     G1RSetSparseRegionEntries = G1RSetSparseRegionEntriesBase * (region_size_log_mb + 1);
 623   }
 624   if (FLAG_IS_DEFAULT(G1RSetRegionEntries)) {
 625     G1RSetRegionEntries = G1RSetRegionEntriesBase * (region_size_log_mb + 1);
 626   }
 627   guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity");
 628 }
 629 
 630 void HeapRegionRemSet::clear(bool only_cardset) {
 631   MutexLocker x(&_m, Mutex::_no_safepoint_check_flag);
 632   clear_locked(only_cardset);
 633 }
 634 
 635 void HeapRegionRemSet::clear_locked(bool only_cardset) {
 636   if (!only_cardset) {
 637     _code_roots.clear();
 638   }
 639   clear_fcc();
 640   _other_regions.clear();
 641   set_state_empty();
 642   assert(occupied_locked() == 0, "Should be clear.");


< prev index next >