RFR: 8358483: G1: Remove G1HeapRegionManager::num_available_regions
Thomas Schatzl
tschatzl at openjdk.org
Thu Jun 12 11:40:38 UTC 2025
On Wed, 11 Jun 2025 14:34:22 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
> > an alternative that seems to be better could be moving all the code related to G1HeapRegionManager in this method into it.
>
> If I understand you correctly, the suggestion is to merge `expand_and_allocate_humongous` into `allocate_humongous`. However, in that case the caller (g1-heap) doesn't know whether expansion happened or not. (The heap needs to call `record_new_heap_size` when expanding.)
>
> ```
> G1HeapRegion* humongous_start = _hrm.allocate_humongous(obj_regions);
> if (humongous_start == nullptr) {
> humongous_start = _hrm.expand_and_allocate_humongous(obj_regions);
> if (humongous_start != nullptr) {
> policy()->record_new_heap_size(num_committed_regions());
> ```
An additional return parameter could handle that, like I prototyped at https://github.com/openjdk/jdk/commit/5cf6f2545062c6e5fb582070f4a0b6e9a25731de . However overall I think the change as is is okay.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25611#issuecomment-2966299998
More information about the hotspot-gc-dev
mailing list