RFR: 8358483: G1: Remove G1HeapRegionManager::num_available_regions
Thomas Schatzl
tschatzl at openjdk.org
Wed Jun 11 09:19:28 UTC 2025
On Tue, 10 Jun 2025 18:12:06 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>
> On rereading the surrounding code, the early-return logic can even precede the following, right?
>
> ```
> // early-return based on obj_regions vs num_available_regions
> G1HeapRegion* humongous_start = _hrm.allocate_humongous(obj_regions);
> ```
I think so too; this can be an argument for moving this out; an alternative that seems to be better could be moving all the code related to `G1HeapRegionManager` in this method into it. Both `allocate_humongous` and `expand_and_allocate_humongous` are only called in this one method of `G1CollectedHeap`.
Then the (public) interface for `G1HeapRegionManager` could be even smaller; there also seems to be some opportunity to flatten out a few methods in `G1HeapRegionManager` along the way.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25611#issuecomment-2961870840
More information about the hotspot-gc-dev
mailing list