RFR: 8263446: Avoid unary minus over unsigned type in ObjectSynchronizer::dec_in_use_list_ceiling

Erik Österlund eosterlund at openjdk.java.net
Fri Mar 12 16:13:17 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`

Marked as reviewed by eosterlund (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/2939


More information about the hotspot-runtime-dev mailing list