RFR: 8248149: G1: change _cleaning_claimed from int to bool
Thomas Schatzl
tschatzl at openjdk.org
Thu Jun 15 11:03:58 UTC 2023
On Thu, 15 Jun 2023 10:49:53 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Hi all,
>>
>> please review this change to fix some claim variable from `int` to `bool` as it should be.
>>
>> Testing: gha
>>
>> Thanks,
>> Thomas
>
> src/hotspot/share/gc/g1/g1ParallelCleaning.cpp line 43:
>
>> 41: }
>> 42:
>> 43: return !Atomic::cmpxchg(&_cleaning_claimed, false, true);
>
> It might be an int because making it a bool may involve a byte-sized cmpxchg, which has a not very
> nice implementation on some platforms. Though even with that the claim cost is likely dwarfed by
> other costs here.
I prefer to believe that when this has been implemented, there has been no cmpxchg overload for bools before the atomics refactoring. We did not go back and look for these kind of mismatches.
There should be no visible performance difference, so I prefer using the more appropriate type.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14487#discussion_r1230838203
More information about the hotspot-gc-dev
mailing list