< prev index next >
src/share/vm/gc/g1/concurrentMark.cpp
Print this page
@@ -1177,26 +1177,38 @@
}
}
};
void ConcurrentMark::scanRootRegions() {
+ double scan_start = os::elapsedTime();
+
// Start of concurrent marking.
ClassLoaderDataGraph::clear_claimed_marks();
// scan_in_progress() will have been set to true only if there was
// at least one root region to scan. So, if it's false, we
// should not attempt to do any further work.
if (root_regions()->scan_in_progress()) {
+ if (G1Log::fine()) {
+ gclog_or_tty->gclog_stamp(concurrent_gc_id());
+ gclog_or_tty->print_cr("[GC concurrent-root-region-scan-start]");
+ }
+
_parallel_marking_threads = calc_parallel_marking_threads();
assert(parallel_marking_threads() <= max_parallel_marking_threads(),
"Maximum number of marking threads exceeded");
uint active_workers = MAX2(1U, parallel_marking_threads());
CMRootRegionScanTask task(this);
_parallel_workers->set_active_workers(active_workers);
_parallel_workers->run_task(&task);
+ if (G1Log::fine()) {
+ gclog_or_tty->gclog_stamp(concurrent_gc_id());
+ gclog_or_tty->print_cr("[GC concurrent-root-region-scan-end, %1.7lf secs]", os::elapsedTime() - scan_start);
+ }
+
// It's possible that has_aborted() is true here without actually
// aborting the survivor scan earlier. This is OK as it's
// mainly used for sanity checking.
root_regions()->scan_finished();
}
@@ -2991,10 +3003,15 @@
}
}
// abandon current marking iteration due to a Full GC
void ConcurrentMark::abort() {
+ if (!cmThread()->during_cycle() || _has_aborted) {
+ // We haven't started a concurrent cycle or we have already aborted it. No need to do anything.
+ return;
+ }
+
// Clear all marks in the next bitmap for the next marking cycle. This will allow us to skip the next
// concurrent bitmap clearing.
_nextMarkBitMap->clearAll();
// Note we cannot clear the previous marking bitmap here
@@ -3008,16 +3025,12 @@
for (uint i = 0; i < _max_worker_id; ++i) {
_tasks[i]->clear_region_fields();
}
_first_overflow_barrier_sync.abort();
_second_overflow_barrier_sync.abort();
- const GCId& gc_id = _g1h->gc_tracer_cm()->gc_id();
- if (!gc_id.is_undefined()) {
- // We can do multiple full GCs before ConcurrentMarkThread::run() gets a chance
- // to detect that it was aborted. Only keep track of the first GC id that we aborted.
- _aborted_gc_id = gc_id;
- }
+ _aborted_gc_id = _g1h->gc_tracer_cm()->gc_id();
+ assert(!_aborted_gc_id.is_undefined(), "ConcurrentMark::abort() executed more than once?");
_has_aborted = true;
SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
satb_mq_set.abandon_partial_marking();
// This can be called either during or outside marking, we'll read
< prev index next >