comparison src/share/vm/gc_implementation/g1/heapRegion.cpp @ 3983:811ec3d0833b

7097053: G1: assert(da ? referent->is_oop() : referent->is_oop_or_null()) failed: referenceProcessor.cpp:1054 Summary: 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
author johnc
date Mon, 03 Oct 2011 12:49:53 -0700
parents 4dfb2df418f2
children 65a8ff39a6da
comparison
equal deleted inserted replaced
3982:273b46400613 3983:811ec3d0833b
208 void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr, 208 void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr,
209 HeapWord* bottom, 209 HeapWord* bottom,
210 HeapWord* top, 210 HeapWord* top,
211 OopClosure* cl) { 211 OopClosure* cl) {
212 G1CollectedHeap* g1h = _g1; 212 G1CollectedHeap* g1h = _g1;
213
214 int oop_size; 213 int oop_size;
215 214 OopClosure* cl2 = NULL;
216 OopClosure* cl2 = cl; 215
217 216 FilterIntoCSClosure intoCSFilt(this, g1h, cl);
218 // If we are scanning the remembered sets looking for refs
219 // into the collection set during an evacuation pause then
220 // we will want to 'discover' reference objects that point
221 // to referents in the collection set.
222 //
223 // Unfortunately it is an instance of FilterIntoCSClosure
224 // that is iterated over the reference fields of oops in
225 // mr (and not the G1ParPushHeapRSClosure - which is the
226 // cl parameter).
227 // If we set the _ref_processor field in the FilterIntoCSClosure
228 // instance, all the reference objects that are walked
229 // (regardless of whether their referent object's are in
230 // the cset) will be 'discovered'.
231 //
232 // The G1STWIsAlive closure considers a referent object that
233 // is outside the cset as alive. The G1CopyingKeepAliveClosure
234 // skips referents that are not in the cset.
235 //
236 // Therefore reference objects in mr with a referent that is
237 // outside the cset should be OK.
238
239 ReferenceProcessor* rp = _cl->_ref_processor;
240 if (rp != NULL) {
241 assert(rp == _g1->ref_processor_stw(), "should be stw");
242 assert(_fk == IntoCSFilterKind, "should be looking for refs into CS");
243 }
244
245 FilterIntoCSClosure intoCSFilt(this, g1h, cl, rp);
246 FilterOutOfRegionClosure outOfRegionFilt(_hr, cl); 217 FilterOutOfRegionClosure outOfRegionFilt(_hr, cl);
247 218
248 switch (_fk) { 219 switch (_fk) {
220 case NoFilterKind: cl2 = cl; break;
249 case IntoCSFilterKind: cl2 = &intoCSFilt; break; 221 case IntoCSFilterKind: cl2 = &intoCSFilt; break;
250 case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break; 222 case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break;
223 default: ShouldNotReachHere();
251 } 224 }
252 225
253 // Start filtering what we add to the remembered set. If the object is 226 // Start filtering what we add to the remembered set. If the object is
254 // not considered dead, either because it is marked (in the mark bitmap) 227 // not considered dead, either because it is marked (in the mark bitmap)
255 // or it was allocated after marking finished, then we add it. Otherwise 228 // or it was allocated after marking finished, then we add it. Otherwise
268 case NoFilterKind: 241 case NoFilterKind:
269 bottom = walk_mem_region_loop(cl, g1h, _hr, bottom, top); 242 bottom = walk_mem_region_loop(cl, g1h, _hr, bottom, top);
270 break; 243 break;
271 244
272 case IntoCSFilterKind: { 245 case IntoCSFilterKind: {
273 FilterIntoCSClosure filt(this, g1h, cl, rp); 246 FilterIntoCSClosure filt(this, g1h, cl);
274 bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top); 247 bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
275 break; 248 break;
276 } 249 }
277 250
278 case OutOfRegionFilterKind: { 251 case OutOfRegionFilterKind: {