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:29:07 UTC 2021


On Thu, 11 Mar 2021 13:18:11 GMT, Andrew Haley <aph at openjdk.org> wrote:

> Surely SonarCloud is simply wrong about this. Unary minus on unsigned is well-defined in C and C++.

Yes, it yields another unsigned value. I'd prefer `Atomic::sub` to do this for us, and check stuff along the way. More on that Sonar rule: https://rules.sonarsource.com/c/RSPEC-876

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

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


More information about the hotspot-runtime-dev mailing list