8183397: Ensure consistent closure filtering during evacuation

Consistently apply the cross-region check for references in the various oop closures.

Reviewed-by: sjohanss, ehelin
This commit is contained in:
Thomas Schatzl 2017-07-10 10:10:49 +02:00
parent dc44ef52d3
commit 4de007ff3b
3 changed files with 14 additions and 8 deletions

View File

@ -78,8 +78,10 @@ inline void G1ScanEvacuatedObjClosure::do_oop_nv(T* p) {
if (state.is_in_cset()) {
prefetch_and_push(p, obj);
} else {
if (HeapRegion::is_in_same_region(p, obj)) {
return;
}
handle_non_cset_obj_common(state, p, obj);
_par_scan_state->update_rs(_from, p, obj);
}
}
@ -171,9 +173,7 @@ inline void G1ScanObjsDuringUpdateRSClosure::do_oop_nv(T* p) {
if (_from == to) {
return;
}
handle_non_cset_obj_common(state, p, obj);
to->rem_set()->add_reference(p, _worker_i);
}
}
@ -190,6 +190,9 @@ inline void G1ScanObjsDuringScanRSClosure::do_oop_nv(T* p) {
if (state.is_in_cset()) {
prefetch_and_push(p, obj);
} else {
if (HeapRegion::is_in_same_region(p, obj)) {
return;
}
handle_non_cset_obj_common(state, p, obj);
}
}

View File

@ -100,9 +100,10 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
template <class T> void push_on_queue(T* ref);
template <class T> void update_rs(HeapRegion* from, T* p, oop o) {
// If the new value of the field points to the same region or
// is the to-space, we don't need to include it in the Rset updates.
if (!HeapRegion::is_in_same_region(p, o) && !from->is_young()) {
assert(!HeapRegion::is_in_same_region(p, o), "Caller should have filtered out cross-region references already.");
// If the field originates from the to-space, we don't need to include it
// in the remembered set updates.
if (!from->is_young()) {
size_t card_index = ctbs()->index_for(p);
// If the card hasn't been added to the buffer, do it.
if (ctbs()->mark_card_deferred(card_index)) {

View File

@ -51,11 +51,13 @@ template <class T> void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from
_g1h->set_humongous_is_live(obj);
} else {
assert(in_cset_state.is_default() || in_cset_state.is_ext(),
"In_cset_state must be NotInCSet or Ext here, but is " CSETSTATE_FORMAT, in_cset_state.value());
"In_cset_state must be NotInCSet or Ext here, but is " CSETSTATE_FORMAT, in_cset_state.value());
}
assert(obj != NULL, "Must be");
update_rs(from, p, obj);
if (!HeapRegion::is_in_same_region(p, obj)) {
update_rs(from, p, obj);
}
}
template <class T> inline void G1ParScanThreadState::push_on_queue(T* ref) {