8225453: is_busy diagnostics and other baseline cleanups from Async Monitor Deflation project

Reviewed-by: dholmes, rehn, coleenp
This commit is contained in:
Daniel D. Daugherty 2019-06-12 10:52:45 -04:00
parent f93ae041ad
commit d02937254d
4 changed files with 44 additions and 31 deletions

View file

@ -245,9 +245,7 @@ void ObjectMonitor::enter(TRAPS) {
void * cur = Atomic::cmpxchg(Self, &_owner, (void*)NULL);
if (cur == NULL) {
// Either ASSERT _recursions == 0 or explicitly set _recursions = 0.
assert(_recursions == 0, "invariant");
assert(_owner == Self, "invariant");
return;
}
@ -405,9 +403,7 @@ int ObjectMonitor::TryLock(Thread * Self) {
void * own = _owner;
if (own != NULL) return 0;
if (Atomic::replace_if_null(Self, &_owner)) {
// Either guarantee _recursions == 0 or set _recursions = 0.
assert(_recursions == 0, "invariant");
assert(_owner == Self, "invariant");
return 1;
}
// The lock had been free momentarily, but we lost the race to the lock.
@ -417,6 +413,15 @@ int ObjectMonitor::TryLock(Thread * Self) {
return -1;
}
// Convert the fields used by is_busy() to a string that can be
// used for diagnostic output.
const char* ObjectMonitor::is_busy_to_string(stringStream* ss) {
ss->print("is_busy: contentions=%d, waiters=%d, owner=" INTPTR_FORMAT
", cxq=" INTPTR_FORMAT ", EntryList=" INTPTR_FORMAT, _contentions,
_waiters, p2i(_owner), p2i(_cxq), p2i(_EntryList));
return ss->base();
}
#define MAX_RECHECK_INTERVAL 1000
void ObjectMonitor::EnterI(TRAPS) {