RFR: Enforce max regions [v3]
Kelvin Nilsen
kdnilsen at openjdk.org
Wed Dec 7 21:20:00 UTC 2022
On Wed, 7 Dec 2022 20:25:23 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:
>> Kelvin Nilsen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix white space and add an assertion
>
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 103:
>
>> 101: switch (req.affiliation()) {
>> 102: case ShenandoahRegionAffiliation::OLD_GENERATION:
>> 103: if (_heap->old_generation()->adjusted_unaffiliated_regions() <= 0) {
>
> Re "<=" : I am guessing this is because adjusted unaffiliated_regions can go negative for periods of time while GC is in progress in a tight heap situation?
>
> Unfortunately, the signature of this is a size_t (unsigned), so a "<=" comparison with "0" should have been flagged by the compiler? Or does the compiler silently treated as "==", without issuing a warning about the comparison? In any case, worth thinking about a related question in the definition of adjusted_unaffiliated_count(), and adjusting accordingly.
This is really a test for ==, and the compiler doesn't complain because the test is meaningful as written (though perhaps confusing as written). OTOH, writing it this way makes the code more "future proof" in case someone changes the return type to signed.
-------------
PR: https://git.openjdk.org/shenandoah/pull/179
More information about the shenandoah-dev
mailing list