8211388: Make OtherRegionsTable independent of the region it is for
Reviewed-by: sjohanss, sangheki
This commit is contained in:
parent
0d19f0bb51
commit
0e622f29a2
@ -239,10 +239,9 @@ 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),
|
||||
@ -250,7 +249,7 @@ OtherRegionsTable::OtherRegionsTable(HeapRegion* hr, Mutex* m) :
|
||||
_first_all_fine_prts(NULL),
|
||||
_last_all_fine_prts(NULL),
|
||||
_fine_eviction_start(0),
|
||||
_sparse_table(hr)
|
||||
_sparse_table()
|
||||
{
|
||||
typedef PerRegionTable* PerRegionTablePtr;
|
||||
|
||||
@ -348,15 +347,6 @@ CardIdx_t OtherRegionsTable::card_within_region(OopOrNarrowOopStar within_region
|
||||
}
|
||||
|
||||
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();
|
||||
@ -569,10 +559,6 @@ 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) {
|
||||
@ -590,8 +576,6 @@ void OtherRegionsTable::clear() {
|
||||
}
|
||||
_n_fine_entries = 0;
|
||||
_n_coarse_entries = 0;
|
||||
|
||||
clear_fcc();
|
||||
}
|
||||
|
||||
bool OtherRegionsTable::contains_reference(OopOrNarrowOopStar from) const {
|
||||
@ -627,11 +611,16 @@ HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetTable* bot,
|
||||
: _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)
|
||||
@ -659,6 +648,7 @@ 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.");
|
||||
|
@ -76,7 +76,6 @@ class OtherRegionsTable {
|
||||
|
||||
G1CollectedHeap* _g1h;
|
||||
Mutex* _m;
|
||||
HeapRegion* _hr;
|
||||
|
||||
// These are protected by "_m".
|
||||
CHeapBitMap _coarse_map;
|
||||
@ -124,11 +123,8 @@ class OtherRegionsTable {
|
||||
bool contains_reference_locked(OopOrNarrowOopStar from) const;
|
||||
|
||||
public:
|
||||
// Clear the from_card_cache entries for this region.
|
||||
void clear_fcc();
|
||||
// Create a new remembered set for the given heap region. The given mutex should
|
||||
// be used to ensure consistency.
|
||||
OtherRegionsTable(HeapRegion* hr, Mutex* m);
|
||||
// Create a new remembered set. The given mutex is used to ensure consistency.
|
||||
OtherRegionsTable(Mutex* m);
|
||||
|
||||
// Returns the card index of the given within_region pointer relative to the bottom
|
||||
// of the given heap region.
|
||||
@ -182,6 +178,10 @@ private:
|
||||
|
||||
OtherRegionsTable _other_regions;
|
||||
|
||||
HeapRegion* _hr;
|
||||
|
||||
void clear_fcc();
|
||||
|
||||
public:
|
||||
HeapRegionRemSet(G1BlockOffsetTable* bot, HeapRegion* hr);
|
||||
|
||||
@ -243,18 +243,18 @@ public:
|
||||
if (_state == Untracked) {
|
||||
return;
|
||||
}
|
||||
_other_regions.clear_fcc();
|
||||
clear_fcc();
|
||||
_state = Untracked;
|
||||
}
|
||||
|
||||
void set_state_updating() {
|
||||
guarantee(SafepointSynchronize::is_at_safepoint() && !is_tracked(), "Should only set to Updating from Untracked during safepoint but is %s", get_state_str());
|
||||
_other_regions.clear_fcc();
|
||||
clear_fcc();
|
||||
_state = Updating;
|
||||
}
|
||||
|
||||
void set_state_complete() {
|
||||
_other_regions.clear_fcc();
|
||||
clear_fcc();
|
||||
_state = Complete;
|
||||
}
|
||||
|
||||
@ -269,6 +269,15 @@ public:
|
||||
if (state == Untracked) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint cur_idx = _hr->hrm_index();
|
||||
uintptr_t from_card = uintptr_t(from) >> CardTable::card_shift;
|
||||
|
||||
if (G1FromCardCache::contains_or_replace(tid, cur_idx, from_card)) {
|
||||
assert(contains_reference(from), "We just found " PTR_FORMAT " in the FromCardCache", p2i(from));
|
||||
return;
|
||||
}
|
||||
|
||||
_other_regions.add_reference(from, tid);
|
||||
}
|
||||
|
||||
|
@ -361,8 +361,8 @@ void SparsePRT::cleanup_all() {
|
||||
}
|
||||
|
||||
|
||||
SparsePRT::SparsePRT(HeapRegion* hr) :
|
||||
_hr(hr), _expanded(false), _next_expanded(NULL)
|
||||
SparsePRT::SparsePRT() :
|
||||
_expanded(false), _next_expanded(NULL)
|
||||
{
|
||||
_cur = new RSHashTable(InitialCapacity);
|
||||
_next = _cur;
|
||||
|
@ -231,8 +231,6 @@ class SparsePRT {
|
||||
RSHashTable* _cur;
|
||||
RSHashTable* _next;
|
||||
|
||||
HeapRegion* _hr;
|
||||
|
||||
enum SomeAdditionalPrivateConstants {
|
||||
InitialCapacity = 16
|
||||
};
|
||||
@ -254,7 +252,7 @@ class SparsePRT {
|
||||
static SparsePRT* volatile _head_expanded_list;
|
||||
|
||||
public:
|
||||
SparsePRT(HeapRegion* hr);
|
||||
SparsePRT();
|
||||
|
||||
~SparsePRT();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user