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:16 UTC 2026


On Tue, 10 Feb 2026 20:40:14 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> 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[]

We're trying to avoid the costs of "finding" the left-most and right-most empty regions, so that assert won't work here.

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

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


More information about the hotspot-gc-dev mailing list