< prev index next >
src/hotspot/share/runtime/objectMonitor.cpp
Print this page
rev 54415 : 8222295: more baseline cleanups from Async Monitor Deflation project
@@ -274,13 +274,17 @@
// and before going through the awkward and expensive state
// transitions. The following spin is strictly optional ...
// Note that if we acquire the monitor from an initial spin
// we forgo posting JVMTI events and firing DTRACE probes.
if (TrySpin(Self) > 0) {
- assert(_owner == Self, "invariant");
- assert(_recursions == 0, "invariant");
- assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
+ assert(_owner == Self, "must be Self: owner=" INTPTR_FORMAT, p2i(_owner));
+ assert(_recursions == 0, "must be 0: recursions=" INTPTR_FORMAT,
+ _recursions);
+ assert(((oop)object())->mark() == markOopDesc::encode(this),
+ "object mark must match encoded this: mark=" INTPTR_FORMAT
+ ", encoded this=" INTPTR_FORMAT, p2i(((oop)object())->mark()),
+ p2i(markOopDesc::encode(this)));
Self->_Stalled = 0;
return;
}
assert(_owner != Self, "invariant");
@@ -288,15 +292,15 @@
assert(Self->is_Java_thread(), "invariant");
JavaThread * jt = (JavaThread *) Self;
assert(!SafepointSynchronize::is_at_safepoint(), "invariant");
assert(jt->thread_state() != _thread_blocked, "invariant");
assert(this->object() != NULL, "invariant");
- assert(_count >= 0, "invariant");
+ assert(_contentions >= 0, "invariant");
// Prevent deflation at STW-time. See deflate_idle_monitors() and is_busy().
// Ensure the object-monitor relationship remains stable while there's contention.
- Atomic::inc(&_count);
+ Atomic::inc(&_contentions);
JFR_ONLY(JfrConditionalFlushWithStacktrace<EventJavaMonitorEnter> flush(jt);)
EventJavaMonitorEnter event;
if (event.should_commit()) {
event.set_monitorClass(((oop)this->object())->klass());
@@ -353,12 +357,12 @@
// as having "-locked" the monitor, but the OS and java.lang.Thread
// states will still report that the thread is blocked trying to
// acquire it.
}
- Atomic::dec(&_count);
- assert(_count >= 0, "invariant");
+ Atomic::dec(&_contentions);
+ assert(_contentions >= 0, "invariant");
Self->_Stalled = 0;
// Must either set _recursions = 0 or ASSERT _recursions == 0.
assert(_recursions == 0, "invariant");
assert(_owner == Self, "invariant");
@@ -807,11 +811,11 @@
//
// We'd like to assert that: (THREAD->thread_state() != _thread_blocked) ;
// There's one exception to the claim above, however. EnterI() can call
// exit() to drop a lock if the acquirer has been externally suspended.
// In that case exit() is called with _thread_state as _thread_blocked,
-// but the monitor's _count field is > 0, which inhibits reclamation.
+// but the monitor's _contentions field is > 0, which inhibits reclamation.
//
// 1-0 exit
// ~~~~~~~~
// ::exit() uses a canonical 1-1 idiom with a MEMBAR although some of
// the fast-path operators have been optimized so the common ::exit()
< prev index next >