8276721: G1: Refine G1EvacFailureObjectsSet::iterate

Reviewed-by: tschatzl, ayang
This commit is contained in:
Hamlin Li 2021-11-10 01:26:35 +00:00
parent 8822d41fdc
commit e91e9d8532
5 changed files with 13 additions and 12 deletions

View File

@ -165,7 +165,7 @@ public:
during_concurrent_start,
_worker_id);
// Iterates evac failure objs which are recorded during evacuation.
hr->iterate_evac_failure_objs(&rspc);
hr->process_and_drop_evac_failure_objs(&rspc);
// Need to zap the remainder area of the processed region.
rspc.zap_remainder();

View File

@ -89,7 +89,7 @@ class G1EvacFailureObjectsIterationHelper {
QuickSort::sort(_offset_array, _array_length, order_oop, true);
}
void iterate_internal(ObjectClosure* closure) {
void iterate(ObjectClosure* closure) {
for (uint i = 0; i < _array_length; i++) {
oop cur = _objects_set->from_offset(_offset_array[i]);
closure->do_object(cur);
@ -103,13 +103,13 @@ public:
_offset_array(nullptr),
_array_length(0) { }
void iterate(ObjectClosure* closure) {
void process_and_drop(ObjectClosure* closure) {
uint num = _segments->num_allocated_nodes();
_offset_array = NEW_C_HEAP_ARRAY(OffsetInRegion, num, mtGC);
join_and_sort();
assert(_array_length == num, "must be %u, %u", _array_length, num);
iterate_internal(closure);
iterate(closure);
FREE_C_HEAP_ARRAY(OffsetInRegion, _offset_array);
}
@ -121,11 +121,11 @@ public:
}
};
void G1EvacFailureObjectsSet::iterate(ObjectClosure* closure) {
void G1EvacFailureObjectsSet::process_and_drop(ObjectClosure* closure) {
assert_at_safepoint();
G1EvacFailureObjectsIterationHelper helper(this);
helper.iterate(closure);
helper.process_and_drop(closure);
_offsets.drop_all();
}

View File

@ -72,9 +72,10 @@ public:
// Record an object that failed evacuation.
void record(oop obj);
// Apply the given ObjectClosure to all objects that failed evacuation. Objects
// are passed in increasing address order.
void iterate(ObjectClosure* closure);
// Apply the given ObjectClosure to all objects that failed evacuation and
// empties the list after processing.
// Objects are passed in increasing address order.
void process_and_drop(ObjectClosure* closure);
};

View File

@ -106,8 +106,8 @@ void HeapRegion::handle_evacuation_failure() {
_next_marked_bytes = 0;
}
void HeapRegion::iterate_evac_failure_objs(ObjectClosure* closure) {
_evac_failure_objs.iterate(closure);
void HeapRegion::process_and_drop_evac_failure_objs(ObjectClosure* closure) {
_evac_failure_objs.process_and_drop(closure);
}
void HeapRegion::unlink_from_list() {

View File

@ -571,7 +571,7 @@ public:
void record_evac_failure_obj(oop obj);
// Applies the given closure to all previously recorded objects
// that failed evacuation in ascending address order.
void iterate_evac_failure_objs(ObjectClosure* closure);
void process_and_drop_evac_failure_objs(ObjectClosure* closure);
// Iterate over the objects overlapping the given memory region, applying cl
// to all references in the region. This is a helper for