mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-03 10:20:57 +00:00
8383486: G1: Revise documentation about root scanning
Reviewed-by: stefank, ayang
This commit is contained in:
parent
106f34807c
commit
79e95a1b35
@ -280,9 +280,9 @@ private:
|
||||
// Typically they contain the areas from TAMS to top of the regions.
|
||||
// We could scan and mark through these objects during the concurrent start pause,
|
||||
// but for pause time reasons we move this work to the concurrent phase.
|
||||
// We need to complete this procedure before we can evacuate a particular region
|
||||
// because evacuation might determine that some of these "root objects" are dead,
|
||||
// potentially dropping some required references.
|
||||
// Garbage collections that evacuate must either complete or abort this procedure
|
||||
// before they can move objects because evacuation might determine that some of these
|
||||
// "root objects" are dead, potentially dropping some references.
|
||||
// Root MemRegions comprise of the contents of survivor regions at the end
|
||||
// of the GC, and any objects copied into the old gen during GC.
|
||||
class G1CMRootMemRegions {
|
||||
|
||||
@ -263,23 +263,6 @@ void G1ConcurrentMarkThread::concurrent_mark_cycle_do() {
|
||||
HandleMark hm(Thread::current());
|
||||
ResourceMark rm;
|
||||
|
||||
// We have to ensure that we finish scanning the root regions
|
||||
// before the next GC takes place. To ensure this we have to
|
||||
// make sure that we do not join the STS until the root regions
|
||||
// have been scanned. If we did then it's possible that a
|
||||
// subsequent GC could block us from joining the STS and proceed
|
||||
// without the root regions have been scanned which would be a
|
||||
// correctness issue.
|
||||
//
|
||||
// So do not return before the scan root regions phase as a GC waits for a
|
||||
// notification from it.
|
||||
//
|
||||
// For the same reason ConcurrentGCBreakpoints (in the phase methods) before
|
||||
// here risk deadlock, because a young GC must wait for root region scanning.
|
||||
//
|
||||
// We can not easily abort before root region scan either because of the
|
||||
// reasons mentioned in G1CollectedHeap::abort_concurrent_cycle().
|
||||
|
||||
// Phase 1: Scan root regions.
|
||||
if (phase_scan_root_regions()) return;
|
||||
|
||||
|
||||
@ -246,8 +246,6 @@ G1YoungGCAllocationFailureInjector* G1YoungCollector::allocation_failure_injecto
|
||||
|
||||
void G1YoungCollector::complete_root_region_scan() {
|
||||
Ticks start = Ticks::now();
|
||||
// We have to complete root region scan as it's the only way to ensure that all the
|
||||
// objects on them have been correctly scanned before we start moving them during the GC.
|
||||
if (concurrent_mark()->complete_root_regions_scan_in_safepoint()) {
|
||||
phase_times()->record_root_region_scan_time((Ticks::now() - start).seconds() * MILLIUNITS);
|
||||
}
|
||||
@ -1138,9 +1136,7 @@ void G1YoungCollector::collect() {
|
||||
// Individual parallel phases may override this.
|
||||
set_young_collection_default_active_worker_threads();
|
||||
|
||||
// Wait for root region scan here to make sure that it is done before any
|
||||
// use of the STW workers to maximize cpu use (i.e. all cores are available
|
||||
// just to do that).
|
||||
// Complete root region scan before moving any objects to preserve the SATB invariant.
|
||||
complete_root_region_scan();
|
||||
|
||||
G1YoungGCVerifierMark vm(this);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user