Skip to content

Commit cc61520

Browse files
author
Hamlin Li
committed
8270842: G1: Only young regions need to redirty outside references in remset.
Reviewed-by: tschatzl
1 parent f4cf2f7 commit cc61520

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/hotspot/share/gc/g1/g1EvacFailure.cpp

+10-13
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class RemoveSelfForwardPtrObjClosure: public ObjectClosure {
8080
G1CollectedHeap* _g1h;
8181
G1ConcurrentMark* _cm;
8282
HeapRegion* _hr;
83+
const bool _is_young;
8384
size_t _marked_bytes;
8485
UpdateLogBuffersDeferred* _log_buffer_cl;
8586
bool _during_concurrent_start;
@@ -94,6 +95,7 @@ class RemoveSelfForwardPtrObjClosure: public ObjectClosure {
9495
_g1h(G1CollectedHeap::heap()),
9596
_cm(_g1h->concurrent_mark()),
9697
_hr(hr),
98+
_is_young(hr->is_young()),
9799
_marked_bytes(0),
98100
_log_buffer_cl(log_buffer_cl),
99101
_during_concurrent_start(during_concurrent_start),
@@ -140,19 +142,14 @@ class RemoveSelfForwardPtrObjClosure: public ObjectClosure {
140142
_marked_bytes += (obj_size * HeapWordSize);
141143
PreservedMarks::init_forwarded_mark(obj);
142144

143-
// While we were processing RSet buffers during the collection,
144-
// we actually didn't scan any cards on the collection set,
145-
// since we didn't want to update remembered sets with entries
146-
// that point into the collection set, given that live objects
147-
// from the collection set are about to move and such entries
148-
// will be stale very soon.
149-
// This change also dealt with a reliability issue which
150-
// involved scanning a card in the collection set and coming
151-
// across an array that was being chunked and looking malformed.
152-
// The problem is that, if evacuation fails, we might have
153-
// remembered set entries missing given that we skipped cards on
154-
// the collection set. So, we'll recreate such entries now.
155-
obj->oop_iterate(_log_buffer_cl);
145+
// During evacuation failure we do not record inter-region
146+
// references referencing regions that need a remembered set
147+
// update originating from young regions (including eden) that
148+
// failed evacuation. Make up for that omission now by rescanning
149+
// these failed objects.
150+
if (_is_young) {
151+
obj->oop_iterate(_log_buffer_cl);
152+
}
156153

157154
HeapWord* obj_end = obj_addr + obj_size;
158155
_last_forwarded_object_end = obj_end;

0 commit comments

Comments
 (0)