8371720: G1: Move concurrent mark initialization to first concurrent start pause

Reviewed-by: iwalulya
This commit is contained in:
Thomas Schatzl 2026-06-29 10:49:58 +00:00
parent 9ee63d6359
commit 027eb8b416
2 changed files with 8 additions and 2 deletions

View File

@ -2723,13 +2723,14 @@ void G1CollectedHeap::do_collection_pause_at_safepoint(size_t allocation_word_si
_bytes_used_during_gc = 0;
_cm->fully_initialize();
policy()->decide_on_concurrent_start_pause();
// Record whether this pause may need to trigger a concurrent operation. Later,
// when we signal the G1ConcurrentMarkThread, the collector state has already
// been reset for the next pause.
bool should_start_concurrent_mark_operation = collector_state()->is_in_concurrent_start_gc();
if (should_start_concurrent_mark_operation) {
_cm->fully_initialize();
}
// Perform the collection.
G1YoungCollector collector(gc_cause(), allocation_word_size);

View File

@ -569,6 +569,11 @@ public:
uint worker_id_offset() const { return _worker_id_offset; }
// Fully allocates and initializes data structures for the concurrent cycle.
// Methods that use concurrent cycle state such as the concurrent mark threads,
// tasks, marking stack, statistics, TAMS or TARS require this initialization.
// Callers that run before the first concurrent start pause, which calls this,
// should guard calls with is_fully_initialized().
void fully_initialize();
bool is_fully_initialized() const { return _cm_thread != nullptr; }