< prev index next >
src/hotspot/share/gc/g1/heapRegionRemSet.hpp
Print this page
rev 52310 : imported patch 8071913-almost-done
rev 52314 : imported patch 8211388-make-otherregionstable-unaware-of-to-region
rev 52315 : imported patch 8211388-sangheon-review
*** 74,84 ****
class OtherRegionsTable {
friend class HeapRegionRemSetIterator;
G1CollectedHeap* _g1h;
Mutex* _m;
- HeapRegion* _hr;
// These are protected by "_m".
CHeapBitMap _coarse_map;
size_t _n_coarse_entries;
static jint _n_coarsenings;
--- 74,83 ----
*** 122,136 ****
void unlink_from_all(PerRegionTable * prt);
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);
// Returns the card index of the given within_region pointer relative to the bottom
// of the given heap region.
static CardIdx_t card_within_region(OopOrNarrowOopStar within_region, HeapRegion* hr);
// Adds the reference from "from to this remembered set.
--- 121,132 ----
void unlink_from_all(PerRegionTable * prt);
bool contains_reference_locked(OopOrNarrowOopStar from) const;
public:
! // 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.
static CardIdx_t card_within_region(OopOrNarrowOopStar within_region, HeapRegion* hr);
// Adds the reference from "from to this remembered set.
*** 180,189 ****
--- 176,189 ----
Mutex _m;
OtherRegionsTable _other_regions;
+ HeapRegion* _hr;
+
+ void clear_fcc();
+
public:
HeapRegionRemSet(G1BlockOffsetTable* bot, HeapRegion* hr);
static void setup_remset_size();
*** 241,262 ****
void set_state_empty() {
guarantee(SafepointSynchronize::is_at_safepoint() || !is_tracked(), "Should only set to Untracked during safepoint but is %s.", get_state_str());
if (_state == Untracked) {
return;
}
! _other_regions.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();
_state = Updating;
}
void set_state_complete() {
! _other_regions.clear_fcc();
_state = Complete;
}
// Used in the sequential case.
void add_reference(OopOrNarrowOopStar from) {
--- 241,262 ----
void set_state_empty() {
guarantee(SafepointSynchronize::is_at_safepoint() || !is_tracked(), "Should only set to Untracked during safepoint but is %s.", get_state_str());
if (_state == Untracked) {
return;
}
! 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());
! clear_fcc();
_state = Updating;
}
void set_state_complete() {
! clear_fcc();
_state = Complete;
}
// Used in the sequential case.
void add_reference(OopOrNarrowOopStar from) {
*** 267,276 ****
--- 267,285 ----
void add_reference(OopOrNarrowOopStar from, uint tid) {
RemSetState state = _state;
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);
}
// The region is being reclaimed; clear its remset, and any mention of
// entries for this region in other remsets.
< prev index next >