Skip to content

Commit

Permalink
8276921: G1: Remove redundant failed evacuation regions calculation i…
Browse files Browse the repository at this point in the history
…n RemoveSelfForwardPtrHRClosure

Reviewed-by: ayang, tschatzl
  • Loading branch information
Hamlin Li committed Nov 15, 2021
1 parent ca2efb7 commit b231f5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
12 changes: 3 additions & 9 deletions src/hotspot/share/gc/g1/g1EvacFailure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,13 @@ class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {
G1CollectedHeap* _g1h;
uint _worker_id;

uint volatile* _num_failed_regions;
G1EvacFailureRegions* _evac_failure_regions;

public:
RemoveSelfForwardPtrHRClosure(uint worker_id,
uint volatile* num_failed_regions,
G1EvacFailureRegions* evac_failure_regions) :
_g1h(G1CollectedHeap::heap()),
_worker_id(worker_id),
_num_failed_regions(num_failed_regions),
_evac_failure_regions(evac_failure_regions) {
}

Expand Down Expand Up @@ -194,8 +191,6 @@ class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {
hr->rem_set()->clear_locked(true);

hr->note_self_forwarding_removal_end(live_bytes);

Atomic::inc(_num_failed_regions, memory_order_relaxed);
}
return false;
}
Expand All @@ -205,16 +200,15 @@ G1ParRemoveSelfForwardPtrsTask::G1ParRemoveSelfForwardPtrsTask(G1EvacFailureRegi
WorkerTask("G1 Remove Self-forwarding Pointers"),
_g1h(G1CollectedHeap::heap()),
_hrclaimer(_g1h->workers()->active_workers()),
_evac_failure_regions(evac_failure_regions),
_num_failed_regions(0) { }
_evac_failure_regions(evac_failure_regions) { }

void G1ParRemoveSelfForwardPtrsTask::work(uint worker_id) {
RemoveSelfForwardPtrHRClosure rsfp_cl(worker_id, &_num_failed_regions, _evac_failure_regions);
RemoveSelfForwardPtrHRClosure rsfp_cl(worker_id, _evac_failure_regions);

// Iterate through all regions that failed evacuation during the entire collection.
_evac_failure_regions->par_iterate(&rsfp_cl, &_hrclaimer, worker_id);
}

uint G1ParRemoveSelfForwardPtrsTask::num_failed_regions() const {
return Atomic::load(&_num_failed_regions);
return _evac_failure_regions->num_regions_failed_evacuation();
}
6 changes: 0 additions & 6 deletions src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ class G1PostEvacuateCollectionSetCleanupTask1::RemoveSelfForwardPtrsTask : publi
_task(evac_failure_regions),
_evac_failure_regions(evac_failure_regions) { }

~RemoveSelfForwardPtrsTask() {
assert(_task.num_failed_regions() == _evac_failure_regions->num_regions_failed_evacuation(),
"Removed regions %u inconsistent with expected %u",
_task.num_failed_regions(), _evac_failure_regions->num_regions_failed_evacuation());
}

double worker_cost() const override {
assert(_evac_failure_regions->evacuation_failed(), "Should not call this if not executed");
return _evac_failure_regions->num_regions_failed_evacuation();
Expand Down

1 comment on commit b231f5b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.