src/share/vm/gc_implementation/g1/g1EvacFailure.hpp
Print this page
*** 69,78 ****
--- 69,81 ----
size_t _marked_bytes;
OopsInHeapRegionClosure *_update_rset_cl;
bool _during_initial_mark;
bool _during_conc_mark;
uint _worker_id;
+ HeapWord* _end_of_last_gap;
+ HeapWord* _last_gap_threshold;
+ HeapWord* _last_obj_threshold;
public:
RemoveSelfForwardPtrObjClosure(G1CollectedHeap* g1, ConcurrentMark* cm,
HeapRegion* hr,
OopsInHeapRegionClosure* update_rset_cl,
*** 81,91 ****
uint worker_id) :
_g1(g1), _cm(cm), _hr(hr), _marked_bytes(0),
_update_rset_cl(update_rset_cl),
_during_initial_mark(during_initial_mark),
_during_conc_mark(during_conc_mark),
! _worker_id(worker_id) { }
size_t marked_bytes() { return _marked_bytes; }
// <original comment>
// The original idea here was to coalesce evacuated and dead objects.
--- 84,97 ----
uint worker_id) :
_g1(g1), _cm(cm), _hr(hr), _marked_bytes(0),
_update_rset_cl(update_rset_cl),
_during_initial_mark(during_initial_mark),
_during_conc_mark(during_conc_mark),
! _worker_id(worker_id),
! _end_of_last_gap(hr->bottom()),
! _last_gap_threshold(hr->bottom()),
! _last_obj_threshold(hr->bottom()) { }
size_t marked_bytes() { return _marked_bytes; }
// <original comment>
// The original idea here was to coalesce evacuated and dead objects.
*** 105,123 ****
// to coalesce dead objects if we want to.
void do_object(oop obj) {
HeapWord* obj_addr = (HeapWord*) obj;
assert(_hr->is_in(obj_addr), "sanity");
size_t obj_size = obj->size();
! _hr->update_bot_for_object(obj_addr, obj_size);
if (obj->is_forwarded() && obj->forwardee() == obj) {
// The object failed to move.
// We consider all objects that we find self-forwarded to be
// live. What we'll do is that we'll update the prev marking
// info so that they are all under PTAMS and explicitly marked.
_cm->markPrev(obj);
if (_during_initial_mark) {
// For the next marking info we'll only mark the
// self-forwarded objects explicitly if we are during
// initial-mark (since, normally, we only mark objects pointed
// to by roots if we succeed in copying them). By marking all
--- 111,136 ----
// to coalesce dead objects if we want to.
void do_object(oop obj) {
HeapWord* obj_addr = (HeapWord*) obj;
assert(_hr->is_in(obj_addr), "sanity");
size_t obj_size = obj->size();
! HeapWord* obj_end = obj_addr + obj_size;
!
! if (_end_of_last_gap != obj_addr) {
! // there was a gap before obj_addr
! _last_gap_threshold = _hr->cross_threshold(_end_of_last_gap, obj_addr);
! }
if (obj->is_forwarded() && obj->forwardee() == obj) {
// The object failed to move.
// We consider all objects that we find self-forwarded to be
// live. What we'll do is that we'll update the prev marking
// info so that they are all under PTAMS and explicitly marked.
+ if (!_cm->isPrevMarked(obj)) {
_cm->markPrev(obj);
+ }
if (_during_initial_mark) {
// For the next marking info we'll only mark the
// self-forwarded objects explicitly if we are during
// initial-mark (since, normally, we only mark objects pointed
// to by roots if we succeed in copying them). By marking all
*** 143,159 ****
// across an array that was being chunked and looking malformed.
// The problem is that, if evacuation fails, we might have
// remembered set entries missing given that we skipped cards on
// the collection set. So, we'll recreate such entries now.
obj->oop_iterate(_update_rset_cl);
- assert(_cm->isPrevMarked(obj), "Should be marked!");
} else {
// The object has been either evacuated or is dead. Fill it with a
// dummy object.
! MemRegion mr((HeapWord*) obj, obj_size);
CollectedHeap::fill_with_object(mr);
}
}
};
class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {
G1CollectedHeap* _g1h;
--- 156,177 ----
// across an array that was being chunked and looking malformed.
// The problem is that, if evacuation fails, we might have
// remembered set entries missing given that we skipped cards on
// the collection set. So, we'll recreate such entries now.
obj->oop_iterate(_update_rset_cl);
} else {
+
// The object has been either evacuated or is dead. Fill it with a
// dummy object.
! MemRegion mr(obj_addr, obj_size);
CollectedHeap::fill_with_object(mr);
+
+ // must nuke all dead objects which we skipped when iterating over the region
+ _cm->clearRangePrevBitmap(MemRegion(_end_of_last_gap, obj_end));
}
+ _end_of_last_gap = obj_end;
+ _last_obj_threshold = _hr->cross_threshold(obj_addr, obj_end);
}
};
class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {
G1CollectedHeap* _g1h;
*** 180,196 ****
RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, _update_rset_cl,
during_initial_mark,
during_conc_mark,
_worker_id);
- MemRegion mr(hr->bottom(), hr->end());
- // We'll recreate the prev marking info so we'll first clear
- // the prev bitmap range for this region. We never mark any
- // CSet objects explicitly so the next bitmap range should be
- // cleared anyway.
- _cm->clearRangePrevBitmap(mr);
-
hr->note_self_forwarding_removal_start(during_initial_mark,
during_conc_mark);
_g1h->check_bitmaps("Self-Forwarding Ptr Removal", hr);
// In the common case (i.e. when there is no evacuation
--- 198,207 ----