RFR: 8263446: Avoid unary minus over unsigned type in ObjectSynchronizer::dec_in_use_list_ceiling
Daniel D.Daugherty
dcubed at openjdk.java.net
Sat Mar 13 13:53:05 UTC 2021
On Thu, 11 Mar 2021 13:14:01 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> SonarCloud complains:
> Unary minus should not be applied to an unsigned expression
>
> Here:
>
> void ObjectSynchronizer::dec_in_use_list_ceiling() {
> Atomic::add(&_in_use_list_ceiling, -AvgMonitorsPerThreadEstimate);
> }
>
> We can instead use `Atomic::sub`.
>
> Additional testing:
> - [x] Linux x86_64 fastdebug `hotspot:tier1`
Since @fisk no longer objects to making that change,
I withdraw my objection also.
Historical note: @dholmes-ora had previously requested that I make
exactly this change in a different code review and I rejected that request
for the same reason that I objected to this PR.
My apologies to @dholmes-ora.
-------------
Marked as reviewed by dcubed (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2939
More information about the hotspot-runtime-dev
mailing list