7097053: G1: assert(da ? referent->is_oop() : referent->is_oop_or_null()) failed: referenceProcessor.cpp:1054

During remembered set scanning, the reference processor could discover a reference object whose referent was in the process of being copied and so may not be completely initialized. Do not perform reference discovery during remembered set scanning.

Reviewed-by: tonyp, ysr
This commit is contained in:
John Cuthbertson 2011-10-03 12:49:53 -07:00
parent bbfe9c6e25
commit 02e9894454
4 changed files with 12 additions and 57 deletions

View file

@ -210,44 +210,17 @@ void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr,
HeapWord* top,
OopClosure* cl) {
G1CollectedHeap* g1h = _g1;
int oop_size;
OopClosure* cl2 = NULL;
OopClosure* cl2 = cl;
// If we are scanning the remembered sets looking for refs
// into the collection set during an evacuation pause then
// we will want to 'discover' reference objects that point
// to referents in the collection set.
//
// Unfortunately it is an instance of FilterIntoCSClosure
// that is iterated over the reference fields of oops in
// mr (and not the G1ParPushHeapRSClosure - which is the
// cl parameter).
// If we set the _ref_processor field in the FilterIntoCSClosure
// instance, all the reference objects that are walked
// (regardless of whether their referent object's are in
// the cset) will be 'discovered'.
//
// The G1STWIsAlive closure considers a referent object that
// is outside the cset as alive. The G1CopyingKeepAliveClosure
// skips referents that are not in the cset.
//
// Therefore reference objects in mr with a referent that is
// outside the cset should be OK.
ReferenceProcessor* rp = _cl->_ref_processor;
if (rp != NULL) {
assert(rp == _g1->ref_processor_stw(), "should be stw");
assert(_fk == IntoCSFilterKind, "should be looking for refs into CS");
}
FilterIntoCSClosure intoCSFilt(this, g1h, cl, rp);
FilterIntoCSClosure intoCSFilt(this, g1h, cl);
FilterOutOfRegionClosure outOfRegionFilt(_hr, cl);
switch (_fk) {
case NoFilterKind: cl2 = cl; break;
case IntoCSFilterKind: cl2 = &intoCSFilt; break;
case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break;
default: ShouldNotReachHere();
}
// Start filtering what we add to the remembered set. If the object is
@ -270,7 +243,7 @@ void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr,
break;
case IntoCSFilterKind: {
FilterIntoCSClosure filt(this, g1h, cl, rp);
FilterIntoCSClosure filt(this, g1h, cl);
bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
break;
}