RFR: 8358483: G1: Remove G1HeapRegionManager::num_available_regions

Albert Mingkun Yang ayang at openjdk.org
Thu Jun 5 08:52:52 UTC 2025


On Tue, 3 Jun 2025 09:10:28 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Simple cleanup of moving an API from `G1HeapRegionManager` to `G1CollectedHeap`.
> 
> Test: tier1

> Perhaps we disagree on whether `num_available_regions()` should be considered a basic API.

Thank you for the term; I was having a difficult time finding an accurate word for it. Since its implementation involves calculations based on other counters, I tend to view it as a "compound" API -- better suited at the level of the owner of `G1HeapRegionManager` rather than being part of its core interface. Hence, the suggestion in this PR.

(There are other "compound" APIs, e.g. `uint num_used_regions() const { return num_committed_regions() - num_free_regions(); }`, which I think also belongs to `G1CollectedHeap`.)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25611#issuecomment-2943305990


More information about the hotspot-gc-dev mailing list