965 while (hr != NULL) {
966 _cm->scanRootRegion(hr);
967 hr = root_regions->claim_next();
968 }
969 }
970 };
971
972 void G1ConcurrentMark::scan_root_regions() {
973 // scan_in_progress() will have been set to true only if there was
974 // at least one root region to scan. So, if it's false, we
975 // should not attempt to do any further work.
976 if (root_regions()->scan_in_progress()) {
977 assert(!has_aborted(), "Aborting before root region scanning is finished not supported.");
978
979 _parallel_marking_threads = MIN2(calc_parallel_marking_threads(),
980 // We distribute work on a per-region basis, so starting
981 // more threads than that is useless.
982 root_regions()->num_root_regions());
983 assert(parallel_marking_threads() <= max_parallel_marking_threads(),
984 "Maximum number of marking threads exceeded");
985 _parallel_workers->add_workers(_parallel_marking_threads, false);
986
987 G1CMRootRegionScanTask task(this);
988 log_debug(gc, ergo)("Running %s using %u workers for %u work units.",
989 task.name(), _parallel_marking_threads, root_regions()->num_root_regions());
990 _parallel_workers->run_task(&task, _parallel_marking_threads);
991
992 // It's possible that has_aborted() is true here without actually
993 // aborting the survivor scan earlier. This is OK as it's
994 // mainly used for sanity checking.
995 root_regions()->scan_finished();
996 }
997 }
998
999 void G1ConcurrentMark::concurrent_cycle_start() {
1000 _gc_timer_cm->register_gc_start();
1001
1002 _gc_tracer_cm->report_gc_start(GCCause::_no_gc /* first parameter is not used */, _gc_timer_cm->gc_start());
1003
1004 _g1h->trace_heap_before_gc(_gc_tracer_cm);
1005 }
|
965 while (hr != NULL) {
966 _cm->scanRootRegion(hr);
967 hr = root_regions->claim_next();
968 }
969 }
970 };
971
972 void G1ConcurrentMark::scan_root_regions() {
973 // scan_in_progress() will have been set to true only if there was
974 // at least one root region to scan. So, if it's false, we
975 // should not attempt to do any further work.
976 if (root_regions()->scan_in_progress()) {
977 assert(!has_aborted(), "Aborting before root region scanning is finished not supported.");
978
979 _parallel_marking_threads = MIN2(calc_parallel_marking_threads(),
980 // We distribute work on a per-region basis, so starting
981 // more threads than that is useless.
982 root_regions()->num_root_regions());
983 assert(parallel_marking_threads() <= max_parallel_marking_threads(),
984 "Maximum number of marking threads exceeded");
985
986 G1CMRootRegionScanTask task(this);
987 log_debug(gc, ergo)("Running %s using %u workers for %u work units.",
988 task.name(), _parallel_marking_threads, root_regions()->num_root_regions());
989 _parallel_workers->run_task(&task, _parallel_marking_threads);
990
991 // It's possible that has_aborted() is true here without actually
992 // aborting the survivor scan earlier. This is OK as it's
993 // mainly used for sanity checking.
994 root_regions()->scan_finished();
995 }
996 }
997
998 void G1ConcurrentMark::concurrent_cycle_start() {
999 _gc_timer_cm->register_gc_start();
1000
1001 _gc_tracer_cm->report_gc_start(GCCause::_no_gc /* first parameter is not used */, _gc_timer_cm->gc_start());
1002
1003 _g1h->trace_heap_before_gc(_gc_tracer_cm);
1004 }
|