comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 3323:75af3e8de182

7040450: G1: assert((_g1->evacuation_failed()) || (!_g1->obj_in_cs(obj))) failed: shouldn't still be in ... Summary: There is a race in the evac failure handling code that causes the condition the assert checks not to be true. The fix is to replace the too-strong assert with a more targeted one. Reviewed-by: johnc, ysr, jcoomes
author tonyp
date Thu, 05 May 2011 09:15:52 -0400
parents 063382f9b575
children 78542e2b5e35
comparison
equal deleted inserted replaced
3322:567c87d484a0 3323:75af3e8de182
3973 } 3973 }
3974 3974
3975 oop 3975 oop
3976 G1CollectedHeap::handle_evacuation_failure_par(OopsInHeapRegionClosure* cl, 3976 G1CollectedHeap::handle_evacuation_failure_par(OopsInHeapRegionClosure* cl,
3977 oop old) { 3977 oop old) {
3978 assert(obj_in_cs(old),
3979 err_msg("obj: "PTR_FORMAT" should still be in the CSet",
3980 (HeapWord*) old));
3978 markOop m = old->mark(); 3981 markOop m = old->mark();
3979 oop forward_ptr = old->forward_to_atomic(old); 3982 oop forward_ptr = old->forward_to_atomic(old);
3980 if (forward_ptr == NULL) { 3983 if (forward_ptr == NULL) {
3981 // Forward-to-self succeeded. 3984 // Forward-to-self succeeded.
3982 if (_evac_failure_closure != cl) { 3985 if (_evac_failure_closure != cl) {
3995 assert(_drain_in_progress, "This should only be the recursive case."); 3998 assert(_drain_in_progress, "This should only be the recursive case.");
3996 handle_evacuation_failure_common(old, m); 3999 handle_evacuation_failure_common(old, m);
3997 } 4000 }
3998 return old; 4001 return old;
3999 } else { 4002 } else {
4000 // Someone else had a place to copy it. 4003 // Forward-to-self failed. Either someone else managed to allocate
4004 // space for this object (old != forward_ptr) or they beat us in
4005 // self-forwarding it (old == forward_ptr).
4006 assert(old == forward_ptr || !obj_in_cs(forward_ptr),
4007 err_msg("obj: "PTR_FORMAT" forwarded to: "PTR_FORMAT" "
4008 "should not be in the CSet",
4009 (HeapWord*) old, (HeapWord*) forward_ptr));
4001 return forward_ptr; 4010 return forward_ptr;
4002 } 4011 }
4003 } 4012 }
4004 4013
4005 void G1CollectedHeap::handle_evacuation_failure_common(oop old, markOop m) { 4014 void G1CollectedHeap::handle_evacuation_failure_common(oop old, markOop m) {
4306 // to its new location. 4315 // to its new location.
4307 4316
4308 T heap_oop = oopDesc::load_heap_oop(p); 4317 T heap_oop = oopDesc::load_heap_oop(p);
4309 if (!oopDesc::is_null(heap_oop)) { 4318 if (!oopDesc::is_null(heap_oop)) {
4310 oop obj = oopDesc::decode_heap_oop(heap_oop); 4319 oop obj = oopDesc::decode_heap_oop(heap_oop);
4311 assert((_g1->evacuation_failed()) || (!_g1->obj_in_cs(obj)),
4312 "shouldn't still be in the CSet if evacuation didn't fail.");
4313 HeapWord* addr = (HeapWord*)obj; 4320 HeapWord* addr = (HeapWord*)obj;
4314 if (_g1->is_in_g1_reserved(addr)) 4321 if (_g1->is_in_g1_reserved(addr)) {
4315 _cm->grayRoot(oop(addr)); 4322 _cm->grayRoot(oop(addr));
4323 }
4316 } 4324 }
4317 } 4325 }
4318 4326
4319 oop G1ParCopyHelper::copy_to_survivor_space(oop old) { 4327 oop G1ParCopyHelper::copy_to_survivor_space(oop old) {
4320 size_t word_sz = old->size(); 4328 size_t word_sz = old->size();