src/share/vm/gc_implementation/g1/g1EvacFailure.hpp

changeset 6992
2c6ef90f030a
parent 6198
55fb97c4c58d
child 7005
e0954897238a
     1.1 --- a/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp	Tue Jul 01 09:03:55 2014 +0200
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1EvacFailure.hpp	Mon Jul 07 10:12:40 2014 +0200
     1.3 @@ -71,6 +71,9 @@
     1.4    bool _during_initial_mark;
     1.5    bool _during_conc_mark;
     1.6    uint _worker_id;
     1.7 +  HeapWord* _end_of_last_gap;
     1.8 +  HeapWord* _last_gap_threshold;
     1.9 +  HeapWord* _last_obj_threshold;
    1.10  
    1.11  public:
    1.12    RemoveSelfForwardPtrObjClosure(G1CollectedHeap* g1, ConcurrentMark* cm,
    1.13 @@ -83,7 +86,10 @@
    1.14      _update_rset_cl(update_rset_cl),
    1.15      _during_initial_mark(during_initial_mark),
    1.16      _during_conc_mark(during_conc_mark),
    1.17 -    _worker_id(worker_id) { }
    1.18 +    _worker_id(worker_id),
    1.19 +    _end_of_last_gap(hr->bottom()),
    1.20 +    _last_gap_threshold(hr->bottom()),
    1.21 +    _last_obj_threshold(hr->bottom()) { }
    1.22  
    1.23    size_t marked_bytes() { return _marked_bytes; }
    1.24  
    1.25 @@ -107,7 +113,12 @@
    1.26      HeapWord* obj_addr = (HeapWord*) obj;
    1.27      assert(_hr->is_in(obj_addr), "sanity");
    1.28      size_t obj_size = obj->size();
    1.29 -    _hr->update_bot_for_object(obj_addr, obj_size);
    1.30 +    HeapWord* obj_end = obj_addr + obj_size;
    1.31 +
    1.32 +    if (_end_of_last_gap != obj_addr) {
    1.33 +      // there was a gap before obj_addr
    1.34 +      _last_gap_threshold = _hr->cross_threshold(_end_of_last_gap, obj_addr);
    1.35 +    }
    1.36  
    1.37      if (obj->is_forwarded() && obj->forwardee() == obj) {
    1.38        // The object failed to move.
    1.39 @@ -115,7 +126,9 @@
    1.40        // We consider all objects that we find self-forwarded to be
    1.41        // live. What we'll do is that we'll update the prev marking
    1.42        // info so that they are all under PTAMS and explicitly marked.
    1.43 -      _cm->markPrev(obj);
    1.44 +      if (!_cm->isPrevMarked(obj)) {
    1.45 +        _cm->markPrev(obj);
    1.46 +      }
    1.47        if (_during_initial_mark) {
    1.48          // For the next marking info we'll only mark the
    1.49          // self-forwarded objects explicitly if we are during
    1.50 @@ -145,13 +158,18 @@
    1.51        // remembered set entries missing given that we skipped cards on
    1.52        // the collection set. So, we'll recreate such entries now.
    1.53        obj->oop_iterate(_update_rset_cl);
    1.54 -      assert(_cm->isPrevMarked(obj), "Should be marked!");
    1.55      } else {
    1.56 +
    1.57        // The object has been either evacuated or is dead. Fill it with a
    1.58        // dummy object.
    1.59 -      MemRegion mr((HeapWord*) obj, obj_size);
    1.60 +      MemRegion mr(obj_addr, obj_size);
    1.61        CollectedHeap::fill_with_object(mr);
    1.62 +
    1.63 +      // must nuke all dead objects which we skipped when iterating over the region
    1.64 +      _cm->clearRangePrevBitmap(MemRegion(_end_of_last_gap, obj_end));
    1.65      }
    1.66 +    _end_of_last_gap = obj_end;
    1.67 +    _last_obj_threshold = _hr->cross_threshold(obj_addr, obj_end);
    1.68    }
    1.69  };
    1.70  
    1.71 @@ -182,13 +200,6 @@
    1.72                                              during_conc_mark,
    1.73                                              _worker_id);
    1.74  
    1.75 -        MemRegion mr(hr->bottom(), hr->end());
    1.76 -        // We'll recreate the prev marking info so we'll first clear
    1.77 -        // the prev bitmap range for this region. We never mark any
    1.78 -        // CSet objects explicitly so the next bitmap range should be
    1.79 -        // cleared anyway.
    1.80 -        _cm->clearRangePrevBitmap(mr);
    1.81 -
    1.82          hr->note_self_forwarding_removal_start(during_initial_mark,
    1.83                                                 during_conc_mark);
    1.84  

mercurial