7040450: G1: assert((_g1->evacuation_failed()) || (!_g1->obj_in_cs(obj))) failed: shouldn't still be in ...

Thu, 05 May 2011 09:15:52 -0400

author
tonyp
date
Thu, 05 May 2011 09:15:52 -0400
changeset 2855
75af3e8de182
parent 2854
567c87d484a0
child 2856
acf5e660c71a

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

src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed May 04 15:08:44 2011 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu May 05 09:15:52 2011 -0400
     1.3 @@ -3975,6 +3975,9 @@
     1.4  oop
     1.5  G1CollectedHeap::handle_evacuation_failure_par(OopsInHeapRegionClosure* cl,
     1.6                                                 oop old) {
     1.7 +  assert(obj_in_cs(old),
     1.8 +         err_msg("obj: "PTR_FORMAT" should still be in the CSet",
     1.9 +                 (HeapWord*) old));
    1.10    markOop m = old->mark();
    1.11    oop forward_ptr = old->forward_to_atomic(old);
    1.12    if (forward_ptr == NULL) {
    1.13 @@ -3997,7 +4000,13 @@
    1.14      }
    1.15      return old;
    1.16    } else {
    1.17 -    // Someone else had a place to copy it.
    1.18 +    // Forward-to-self failed. Either someone else managed to allocate
    1.19 +    // space for this object (old != forward_ptr) or they beat us in
    1.20 +    // self-forwarding it (old == forward_ptr).
    1.21 +    assert(old == forward_ptr || !obj_in_cs(forward_ptr),
    1.22 +           err_msg("obj: "PTR_FORMAT" forwarded to: "PTR_FORMAT" "
    1.23 +                   "should not be in the CSet",
    1.24 +                   (HeapWord*) old, (HeapWord*) forward_ptr));
    1.25      return forward_ptr;
    1.26    }
    1.27  }
    1.28 @@ -4308,11 +4317,10 @@
    1.29    T heap_oop = oopDesc::load_heap_oop(p);
    1.30    if (!oopDesc::is_null(heap_oop)) {
    1.31      oop obj = oopDesc::decode_heap_oop(heap_oop);
    1.32 -    assert((_g1->evacuation_failed()) || (!_g1->obj_in_cs(obj)),
    1.33 -           "shouldn't still be in the CSet if evacuation didn't fail.");
    1.34      HeapWord* addr = (HeapWord*)obj;
    1.35 -    if (_g1->is_in_g1_reserved(addr))
    1.36 +    if (_g1->is_in_g1_reserved(addr)) {
    1.37        _cm->grayRoot(oop(addr));
    1.38 +    }
    1.39    }
    1.40  }
    1.41  

mercurial