< prev index next >
src/hotspot/share/gc/g1/heapRegionRemSet.hpp
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
@@ -74,11 +74,10 @@
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;
@@ -122,15 +121,13 @@
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);
+ 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,10 +177,14 @@
Mutex _m;
OtherRegionsTable _other_regions;
+ HeapRegion* _hr;
+
+ void clear_fcc();
+
public:
HeapRegionRemSet(G1BlockOffsetTable* bot, HeapRegion* hr);
static void setup_remset_size();
@@ -241,22 +242,22 @@
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();
+ 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;
}
// Used in the sequential case.
void add_reference(OopOrNarrowOopStar from) {
@@ -267,10 +268,19 @@
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 >