From b3ed9b0156708b196a97978f56da2a5db706d9cc Mon Sep 17 00:00:00 2001 From: Leo Korinth Date: Tue, 13 Jan 2026 23:16:00 +0100 Subject: [PATCH] Stefan J 1 --- src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 8 +++----- src/hotspot/share/gc/g1/g1ConcurrentMark.cpp | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 784524396ac..5e79ca7d019 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -1634,7 +1634,8 @@ jint G1CollectedHeap::initialize() { } bool G1CollectedHeap::concurrent_mark_is_terminating() const { - assert(_cm != nullptr, "thread must exist in order to check if mark is terminating"); + assert(_cm != nullptr, "_cm must have been created"); + assert(_cm->is_fully_initialized(), "thread must exist in order to check if mark is terminating"); return _cm->cm_thread()->should_terminate(); } @@ -2422,9 +2423,6 @@ void G1CollectedHeap::print_gc_on(outputStream* st) const { void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const { workers()->threads_do(tc); - if (_cm->is_fully_initialized()) { - tc->do_thread(_cm->cm_thread()); - } _cm->threads_do(tc); _cr->threads_do(tc); tc->do_thread(_service_thread); @@ -2545,8 +2543,8 @@ HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size, } void G1CollectedHeap::start_concurrent_cycle(bool concurrent_operation_is_full_mark) { - assert(!_cm->in_progress(), "Can not start concurrent operation while in progress"); assert(_cm->is_fully_initialized(), "sanity"); + assert(!_cm->in_progress(), "Can not start concurrent operation while in progress"); MutexLocker x(G1CGC_lock, Mutex::_no_safepoint_check_flag); if (concurrent_operation_is_full_mark) { _cm->post_concurrent_mark_start(); diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index 0d357715e06..5e2ea4b0111 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -1978,6 +1978,7 @@ void G1ConcurrentMark::print_summary_info() { void G1ConcurrentMark::threads_do(ThreadClosure* tc) const { if (is_fully_initialized()) { // they are initialized late + tc->do_thread(_cm_thread); _concurrent_workers->threads_do(tc); } }