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

David Holmes dholmes at openjdk.java.net
Tue Jun 22 00:02:37 UTC 2021


On Tue, 11 May 2021 15:01:18 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> I changed the _contentions and _waiters fields from jint to int and ran tests tier1-3.  Tested tier1 with linux, mac, windows platforms. Also changed the _previous_owner_tid to unintptr_t from jlong, since that's what the cast did.

Looks fine apart from use of INT32_MIN instead of INT_MIN.

Thanks,
David

src/hotspot/share/runtime/objectMonitor.cpp line 548:

> 546:     set_owner_from(NULL, DEFLATER_MARKER);
> 547:     assert(contentions() >= 0, "must be non-negative: contentions=%d", contentions());
> 548:     _contentions = INT32_MIN; // minimum negative int

INT_MIN (unless you want to change the type to int32_t)

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?

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

Marked as reviewed by dholmes (Reviewer).

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


More information about the serviceability-dev mailing list