Skip to content

Commit 8f205f4

Browse files
author
Thomas Schatzl
committed
8349213: G1: Clearing bitmaps during collection set merging not claimed by region
Reviewed-by: kbarrett Backport-of: 8e8582949669d5f3dcb68886ccb6a719393d1a9e
1 parent c14b3c2 commit 8f205f4

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

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

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,22 +1161,6 @@ class G1MergeHeapRootsTask : public WorkerTask {
11611161
}
11621162
};
11631163

1164-
// Helper to allow two closure to be applied when
1165-
// iterating through the collection set.
1166-
class G1CombinedClosure : public G1HeapRegionClosure {
1167-
G1HeapRegionClosure* _closure1;
1168-
G1HeapRegionClosure* _closure2;
1169-
public:
1170-
G1CombinedClosure(G1HeapRegionClosure* cl1, G1HeapRegionClosure* cl2) :
1171-
_closure1(cl1),
1172-
_closure2(cl2) { }
1173-
1174-
bool do_heap_region(G1HeapRegion* hr) {
1175-
return _closure1->do_heap_region(hr) ||
1176-
_closure2->do_heap_region(hr);
1177-
}
1178-
};
1179-
11801164
// Visitor for the remembered sets of humongous candidate regions to merge their
11811165
// remembered set into the card table.
11821166
class G1FlushHumongousCandidateRemSets : public G1HeapRegionIndexClosure {
@@ -1277,6 +1261,7 @@ class G1MergeHeapRootsTask : public WorkerTask {
12771261
};
12781262

12791263
uint _num_workers;
1264+
G1HeapRegionClaimer _hr_claimer;
12801265
G1RemSetScanState* _scan_state;
12811266

12821267
// To mitigate contention due multiple threads accessing and popping BufferNodes from a shared
@@ -1306,6 +1291,7 @@ class G1MergeHeapRootsTask : public WorkerTask {
13061291
G1MergeHeapRootsTask(G1RemSetScanState* scan_state, uint num_workers, bool initial_evacuation) :
13071292
WorkerTask("G1 Merge Heap Roots"),
13081293
_num_workers(num_workers),
1294+
_hr_claimer(num_workers),
13091295
_scan_state(scan_state),
13101296
_dirty_card_buffers(nullptr),
13111297
_initial_evacuation(initial_evacuation),
@@ -1395,14 +1381,13 @@ class G1MergeHeapRootsTask : public WorkerTask {
13951381
{
13961382
// 2. collection set
13971383
G1MergeCardSetClosure merge(_scan_state);
1398-
G1ClearBitmapClosure clear(g1h);
1399-
G1CombinedClosure combined(&merge, &clear);
14001384

14011385
if (_initial_evacuation) {
14021386
G1HeapRegionRemSet::iterate_for_merge(g1h->young_regions_cardset(), merge);
14031387
}
14041388

1405-
g1h->collection_set_iterate_increment_from(&combined, nullptr, worker_id);
1389+
g1h->collection_set_iterate_increment_from(&merge, worker_id);
1390+
14061391
G1MergeCardSetStats stats = merge.stats();
14071392

14081393
for (uint i = 0; i < G1GCPhaseTimes::MergeRSContainersSentinel; i++) {
@@ -1411,6 +1396,12 @@ class G1MergeHeapRootsTask : public WorkerTask {
14111396
}
14121397
}
14131398

1399+
// Preparation for evacuation failure handling.
1400+
{
1401+
G1ClearBitmapClosure clear(g1h);
1402+
g1h->collection_set_iterate_increment_from(&clear, &_hr_claimer, worker_id);
1403+
}
1404+
14141405
// Now apply the closure to all remaining log entries.
14151406
if (_initial_evacuation) {
14161407
assert(merge_remset_phase == G1GCPhaseTimes::MergeRS, "Wrong merge phase");

0 commit comments

Comments
 (0)