RFR: 8377011: Shenandoah: assert_bounds should be only called when boundaries have changed [v2]

Kelvin Nilsen kdnilsen at openjdk.org
Wed Feb 11 09:30:14 UTC 2026


On Sat, 7 Feb 2026 01:35:40 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> Xiaolong Peng has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add assert_bounds_not_changed as Kelvin suggested
>
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 1197:
> 
>> 1195:          "Mutator humongous waste must match");
>> 1196: }
>> 1197: 
> 
> I realize I requested/suggested this, but upon further thought, I wonder if this is too strong.
> 
> IIRC, sometimes the leftmost_empty(partition) does not represent the left-most empty partition.  Sometimes it is just a left-most bound on the first empty partition.  The less demanding sanity check is probably:
> 
> assert((leftmost_empty(partition) == _max) || (leftmost_empty(partition >= leftmost(partition))
> 
> Similarly for rightmost_empty(partition).
> 
> As rewritten, I believe this is sufficient to handle the case that leftmost(partition) == _max or rightmost(partition) == -1.  Whenever leftmost(partition) == max or righmost(partition) == -1, the leftmost_empty(partition) should equal _max and righmost_empty(partition) should equal -1.

In the existing assert_bounds() implementation, I note that we assert the following:
1. The left-most found empty region is >= _leftmosts_empty[]
2. The right-most found empty region is <= _righmosts_empty[]

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29537#discussion_r2790171950


More information about the hotspot-gc-dev mailing list