From ce7a890fb434d15da51dd7e21847c4a4bbabf99f Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 10 Mar 2026 10:16:29 +0000 Subject: [PATCH] 8379200: G1: Remove G1HeapRegion completion facility Reviewed-by: ayang, iwalulya --- src/hotspot/share/gc/g1/g1CollectionSet.cpp | 3 +-- src/hotspot/share/gc/g1/g1ConcurrentMark.cpp | 5 ---- src/hotspot/share/gc/g1/g1HeapRegion.hpp | 26 ------------------- .../share/gc/g1/g1HeapRegionManager.cpp | 2 -- 4 files changed, 1 insertion(+), 35 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.cpp b/src/hotspot/share/gc/g1/g1CollectionSet.cpp index abfddf860e6..39acaaab913 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -174,7 +174,6 @@ void G1CollectionSet::iterate(G1HeapRegionClosure* cl) const { G1HeapRegion* r = _g1h->region_at(_regions[i]); bool result = cl->do_heap_region(r); if (result) { - cl->set_incomplete(); return; } } diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp index b4a5d673fd2..a2114d8d6b6 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp @@ -817,10 +817,6 @@ public: SuspendibleThreadSetJoiner sts_join(_suspendible); G1CollectedHeap::heap()->heap_region_par_iterate_from_worker_offset(&_cl, &_hr_claimer, worker_id); } - - bool is_complete() { - return _cl.is_complete(); - } }; void G1ConcurrentMark::clear_bitmap(WorkerThreads* workers, bool may_yield) { @@ -835,7 +831,6 @@ void G1ConcurrentMark::clear_bitmap(WorkerThreads* workers, bool may_yield) { log_debug(gc, ergo)("Running %s with %u workers for %zu work units.", cl.name(), num_workers, num_chunks); workers->run_task(&cl, num_workers); - guarantee(may_yield || cl.is_complete(), "Must have completed iteration when not yielding."); } void G1ConcurrentMark::cleanup_for_next_mark() { diff --git a/src/hotspot/share/gc/g1/g1HeapRegion.hpp b/src/hotspot/share/gc/g1/g1HeapRegion.hpp index 2b4b640d52b..ec9cab26049 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegion.hpp +++ b/src/hotspot/share/gc/g1/g1HeapRegion.hpp @@ -567,41 +567,15 @@ public: // G1HeapRegionClosure is used for iterating over regions. // Terminates the iteration when the "do_heap_region" method returns "true". class G1HeapRegionClosure : public StackObj { - friend class G1HeapRegionManager; - friend class G1CollectionSet; - friend class G1CollectionSetCandidates; - - bool _is_complete; - void set_incomplete() { _is_complete = false; } - public: - G1HeapRegionClosure(): _is_complete(true) {} - // Typically called on each region until it returns true. virtual bool do_heap_region(G1HeapRegion* r) = 0; - - // True after iteration if the closure was applied to all heap regions - // and returned "false" in all cases. - bool is_complete() { return _is_complete; } }; class G1HeapRegionIndexClosure : public StackObj { - friend class G1HeapRegionManager; - friend class G1CollectionSet; - friend class G1CollectionSetCandidates; - - bool _is_complete; - void set_incomplete() { _is_complete = false; } - public: - G1HeapRegionIndexClosure(): _is_complete(true) {} - // Typically called on each region until it returns true. virtual bool do_heap_region_index(uint region_index) = 0; - - // True after iteration if the closure was applied to all heap regions - // and returned "false" in all cases. - bool is_complete() { return _is_complete; } }; #endif // SHARE_GC_G1_G1HEAPREGION_HPP diff --git a/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp b/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp index fdd3b919590..3c0318827ef 100644 --- a/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp +++ b/src/hotspot/share/gc/g1/g1HeapRegionManager.cpp @@ -511,7 +511,6 @@ void G1HeapRegionManager::iterate(G1HeapRegionClosure* blk) const { guarantee(at(i) != nullptr, "Tried to access region %u that has a null G1HeapRegion*", i); bool res = blk->do_heap_region(at(i)); if (res) { - blk->set_incomplete(); return; } } @@ -526,7 +525,6 @@ void G1HeapRegionManager::iterate(G1HeapRegionIndexClosure* blk) const { } bool res = blk->do_heap_region_index(i); if (res) { - blk->set_incomplete(); return; } }