Loading... (original) (raw)

The fix for

JDK-8151336

introduced this code in do_collection_pause_at_safepoint():

// We should not be doing initial mark unless the conc mark thread is running
if (!_cmThread->should_terminate()) {
// This call will decide whether this pause is an initial-mark
// pause. If it is, during_initial_mark_pause() will return true
// for the duration of this pause.
g1_policy()->decide_on_conc_mark_initiation();
}

Ideally the check " if (!_cmThread->should_terminate())" should be inside decide_on_conc_mark_initiation() but G1CollectorPolicy does not know about the concurrent mark thread.

Most of what decide_on_conc_mark_initiation() does is based on the information in G1CollectorState. So, it would be more natural to add a variable in G1CollectorState to keep track of whether or not the concurrent mark thread is still running.