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

Aleksey Shipilev shade at openjdk.java.net
Thu Mar 11 13:20:25 UTC 2021


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`

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

Commit messages:
 - 8263446: Avoid unary minus over unsigned type in ObjectSynchronizer::dec_in_use_list_ceiling

Changes: https://git.openjdk.java.net/jdk/pull/2939/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2939&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263446
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2939.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2939/head:pull/2939

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


More information about the hotspot-runtime-dev mailing list