< prev index next >
src/share/vm/gc/g1/concurrentMark.cpp
Print this page
@@ -2991,10 +2991,15 @@
}
}
// abandon current marking iteration due to a Full GC
void ConcurrentMark::abort() {
+ if (_has_aborted || !cmThread()->during_cycle()) {
+ // We have already aborted or we never started a concurrent cycle. 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 +3013,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(), "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 >