Skip to content

Commit f37674a

Browse files
author
Thomas Schatzl
committed
8304711: Combine G1 root region abort and wait into a single method
Reviewed-by: ayang, iwalulya
1 parent 7f9e691 commit f37674a

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,11 @@ void G1ConcurrentMark::add_root_region(HeapRegion* r) {
994994
root_regions()->add(r->top_at_mark_start(), r->top());
995995
}
996996

997+
void G1ConcurrentMark::root_region_scan_abort_and_wait() {
998+
root_regions()->abort();
999+
root_regions()->wait_until_scan_finished();
1000+
}
1001+
9971002
void G1ConcurrentMark::concurrent_cycle_start() {
9981003
_gc_timer_cm->register_gc_start();
9991004

@@ -2000,8 +2005,7 @@ bool G1ConcurrentMark::concurrent_cycle_abort() {
20002005
// be moving objects / updating references. So let's wait until
20012006
// they are done. By telling them to abort, they should complete
20022007
// early.
2003-
root_regions()->abort();
2004-
root_regions()->wait_until_scan_finished();
2008+
root_region_scan_abort_and_wait();
20052009

20062010
// We haven't started a concurrent cycle no need to do anything; we might have
20072011
// aborted the marking because of shutting down though. In this case the marking

src/hotspot/share/gc/g1/g1ConcurrentMark.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ class G1CMMarkStack {
219219
// Typically they contain the areas from TAMS to top of the regions.
220220
// We could scan and mark through these objects during the concurrent start pause,
221221
// but for pause time reasons we move this work to the concurrent phase.
222-
// We need to complete this procedure before the next GC because it might determine
223-
// that some of these "root objects" are dead, potentially dropping some required
224-
// references.
222+
// We need to complete this procedure before we can evacuate a particular region
223+
// because evacuation might determine that some of these "root objects" are dead,
224+
// potentially dropping some required references.
225225
// Root MemRegions comprise of the contents of survivor regions at the end
226226
// of the GC, and any objects copied into the old gen during GC.
227227
class G1CMRootMemRegions {
228228
// The set of root MemRegions.
229-
MemRegion* _root_regions;
229+
MemRegion* _root_regions;
230230
size_t const _max_regions;
231231

232232
volatile size_t _num_root_regions; // Actual number of root regions.
@@ -557,6 +557,7 @@ class G1ConcurrentMark : public CHeapObj<mtGC> {
557557
void scan_root_regions();
558558
bool wait_until_root_region_scan_finished();
559559
void add_root_region(HeapRegion* r);
560+
void root_region_scan_abort_and_wait();
560561

561562
private:
562563
G1CMRootMemRegions* root_regions() { return &_root_regions; }

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ void G1ConcurrentMarkThread::stop_service() {
142142
if (in_progress()) {
143143
// We are not allowed to abort the marking threads during root region scan.
144144
// Needs to be done separately.
145-
_cm->root_regions()->abort();
146-
_cm->root_regions()->wait_until_scan_finished();
145+
_cm->root_region_scan_abort_and_wait();
147146

148147
_cm->abort_marking_threads();
149148
}

0 commit comments

Comments
 (0)