--- old/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp 2020-07-03 14:17:55.654804730 +0800 +++ new/src/hotspot/share/gc/g1/g1ConcurrentMarkThread.cpp 2020-07-03 14:17:55.657804826 +0800 @@ -156,7 +156,7 @@ HandleMark hm; double cycle_start = os::elapsedVTime(); - { + if (!_cm->aborted_by_initial_mark()) { G1ConcPhaseTimer p(_cm, "Concurrent Clear Claimed Marks"); ClassLoaderDataGraph::clear_claimed_marks(); } @@ -169,7 +169,7 @@ // without the root regions have been scanned which would be a // correctness issue. - { + if (!_cm->aborted_by_initial_mark()) { G1ConcPhaseTimer p(_cm, "Concurrent Scan Root Regions"); _cm->scan_root_regions(); } @@ -182,8 +182,10 @@ // a scope. Also, the timer doesn't support nesting. // Mimicking the same log output instead. jlong mark_start = os::elapsed_counter(); - log_info(gc, marking)("Concurrent Mark (%.3fs)", - TimeHelper::counter_to_seconds(mark_start)); + if (!_cm->aborted_by_initial_mark()) { + log_info(gc, marking)("Concurrent Mark (%.3fs)", + TimeHelper::counter_to_seconds(mark_start)); + } for (uint iter = 1; !_cm->has_aborted(); ++iter) { // Concurrent marking. { @@ -256,7 +258,8 @@ // suspended by a collection pause. // We may have aborted just before the remark. Do not bother clearing the // bitmap then, as it has been done during mark abort. - if (!_cm->has_aborted()) { + if (!_cm->aborted_by_fullgc()) { + // We still need to cleanup bitmap if aborted by initial mark G1ConcPhaseTimer p(_cm, "Concurrent Cleanup for Next Mark"); _cm->cleanup_for_next_mark(); }