< prev index next >
src/hotspot/share/gc/g1/heapRegionRemSet.cpp
Print this page
rev 51979 : imported patch 8071913-almost-done
rev 51980 : imported patch 8071913-alternate
rev 51982 : [mq]: 8211388-make-otherregionstable-unaware-of-to-region
@@ -237,22 +237,21 @@
size_t OtherRegionsTable::_max_fine_entries = 0;
size_t OtherRegionsTable::_mod_max_fine_entries_mask = 0;
size_t OtherRegionsTable::_fine_eviction_stride = 0;
size_t OtherRegionsTable::_fine_eviction_sample_size = 0;
-OtherRegionsTable::OtherRegionsTable(HeapRegion* hr, Mutex* m) :
+OtherRegionsTable::OtherRegionsTable(Mutex* m) :
_g1h(G1CollectedHeap::heap()),
_m(m),
- _hr(hr),
_coarse_map(G1CollectedHeap::heap()->max_regions(), mtGC),
_n_coarse_entries(0),
_fine_grain_regions(NULL),
_n_fine_entries(0),
_first_all_fine_prts(NULL),
_last_all_fine_prts(NULL),
_fine_eviction_start(0),
- _sparse_table(hr)
+ _sparse_table()
{
typedef PerRegionTable* PerRegionTablePtr;
if (_max_fine_entries == 0) {
assert(_mod_max_fine_entries_mask == 0, "Both or none.");
@@ -346,19 +345,10 @@
CardIdx_t result = (CardIdx_t)(pointer_delta((HeapWord*)within_region, hr->bottom()) >> (CardTable::card_shift - LogHeapWordSize));
return result;
}
void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) {
- uint cur_hrm_ind = _hr->hrm_index();
-
- uintptr_t from_card = uintptr_t(from) >> CardTable::card_shift;
-
- if (G1FromCardCache::contains_or_replace(tid, cur_hrm_ind, from_card)) {
- assert(contains_reference(from), "We just found " PTR_FORMAT " in the FromCardCache", p2i(from));
- return;
- }
-
// Note that this may be a continued H region.
HeapRegion* from_hr = _g1h->heap_region_containing(from);
RegionIdx_t from_hrm_ind = (RegionIdx_t) from_hr->hrm_index();
// If the region is already coarsened, return.
@@ -567,14 +557,10 @@
size_t OtherRegionsTable::fl_mem_size() {
return PerRegionTable::fl_mem_size();
}
-void OtherRegionsTable::clear_fcc() {
- G1FromCardCache::clear(_hr->hrm_index());
-}
-
void OtherRegionsTable::clear() {
// if there are no entries, skip this step
if (_first_all_fine_prts != NULL) {
guarantee(_first_all_fine_prts != NULL && _last_all_fine_prts != NULL, "just checking");
PerRegionTable::bulk_free(_first_all_fine_prts, _last_all_fine_prts);
@@ -588,12 +574,10 @@
if (_n_coarse_entries > 0) {
_coarse_map.clear();
}
_n_fine_entries = 0;
_n_coarse_entries = 0;
-
- clear_fcc();
}
bool OtherRegionsTable::contains_reference(OopOrNarrowOopStar from) const {
// Cast away const in this case.
MutexLockerEx x((Mutex*)_m, Mutex::_no_safepoint_check_flag);
@@ -625,15 +609,20 @@
HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetTable* bot,
HeapRegion* hr)
: _bot(bot),
_code_roots(),
_m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrm_index()), true, Monitor::_safepoint_check_never),
- _other_regions(hr, &_m),
+ _other_regions(&_m),
+ _hr(hr),
_state(Untracked)
{
}
+void HeapRegionRemSet::clear_fcc() {
+ G1FromCardCache::clear(_hr->hrm_index());
+}
+
void HeapRegionRemSet::setup_remset_size() {
// Setup sparse and fine-grain tables sizes.
// table_size = base * (log(region_size / 1M) + 1)
const int LOG_M = 20;
int region_size_log_mb = MAX2(HeapRegion::LogOfHRGrainBytes - LOG_M, 0);
@@ -657,10 +646,11 @@
void HeapRegionRemSet::clear_locked(bool only_cardset) {
if (!only_cardset) {
_code_roots.clear();
}
+ clear_fcc();
_other_regions.clear();
set_state_empty();
assert(occupied_locked() == 0, "Should be clear.");
}
< prev index next >