RFR: 8367754: G1: Add a fast path in heap resize related method [v3]

Thomas Schatzl tschatzl at openjdk.org
Fri Sep 19 07:40:10 UTC 2025


On Fri, 19 Sep 2025 07:24:13 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Guanqiang Han has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update TestHeapResizeAfterGC.java
>>   
>>   correct format error
>
> src/hotspot/share/gc/g1/g1CollectedHeap.cpp line 894:
> 
>> 892:   // cannot expand or shrink.
>> 893:   if (is_fixed_size_heap()) {
>> 894:     log_debug(gc, ergo, heap)("Skip heap resize after full collection.");
> 
> The comment should explain why we skip too. I.e. `Skip heap resize after full collection because heap size is fixed` or so.

I also think the checks should be placed in `full_collection_resize_amount/young_collection_resize_amount` instead. This is a resizing decision, so just return 0.

The early return could (not right now) skip important code (like not setting the heap resize time). Actually not sure if the current code will or will not print garbage in the logs already.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27349#discussion_r2362032222


More information about the hotspot-gc-dev mailing list