RFR: 8256306: ObjectMonitor::_contentions field should not be 'jint'

Coleen Phillimore coleenp at openjdk.java.net
Tue Jun 22 16:00:33 UTC 2021


On Tue, 22 Jun 2021 15:43:34 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> src/hotspot/share/runtime/objectMonitor.cpp line 575:
>> 
>>> 573:     // Make a zero contentions field negative to force any contending threads
>>> 574:     // to retry. This is the second part of the async deflation dance.
>>> 575:     if (Atomic::cmpxchg(&_contentions, (int)0, INT32_MIN) != 0) {
>> 
>> INT_MIN
>> 
>> Do we really need the cast on 0?
>
> The original cast of `(jint)0` was to get the right `cmpxchg()` selected.
> I _think_ that with the switch to INT32_MIN, a regular `0` instead of `(int)0`
> should compile.

Yes, changing to INT_MIN is more correct and I don't need the cast to int now for zero.  Recompiling on all platforms, including the picky ones for verification.  Thanks!

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

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


More information about the serviceability-dev mailing list