RFR: 8324649: Shenandoah: refactor implementation of free set [v4]

Kelvin Nilsen kdnilsen at openjdk.org
Wed Jan 31 00:59:02 UTC 2024


On Mon, 29 Jan 2024 00:08:52 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:

>> Kelvin Nilsen has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Fix typo in comment
>>  - Remove unnecessary include
>
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 423:
> 
>> 421:       // Allocate within mutator free from high memory to low so as to preserve low memory for humongous allocations
>> 422:       if (!_free_sets.is_empty(Mutator)) {
>> 423:         // Use signed idx.  Otherwise, loop will never terminate.
> 
> Can you use `ssize_t` for the index and the return values from the methods? (I assume the problem you have in mind arises when `leftmost` below is 0?

The problem happens when leftmost is zero.  If we decrement idx beyond zero, we would get MAXINT rather than -1, so the test that idx >= leftmost is always true and loop never terminates...  I think I discovered this the hard way... :(

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17561#discussion_r1472179732


More information about the hotspot-gc-dev mailing list