< prev index next >
src/hotspot/share/runtime/objectMonitor.cpp
Print this page
rev 51675 : imported patch 8210513
@@ -527,11 +527,11 @@
// that periodically iterated over all the threads (or active monitors) and unparked
// successors where there was risk of stranding. This would help eliminate the
// timer scalability issues we see on some platforms as we'd only have one thread
// -- the checker -- parked on a timer.
- if ((SyncFlags & 16) == 0 && nxt == NULL && _EntryList == NULL) {
+ if (nxt == NULL && _EntryList == NULL) {
// Try to assume the role of responsible thread for the monitor.
// CONSIDER: ST vs CAS vs { if (Responsible==null) Responsible=Self }
Atomic::replace_if_null(Self, &_Responsible);
}
@@ -553,16 +553,12 @@
for (;;) {
if (TryLock(Self) > 0) break;
assert(_owner != Self, "invariant");
- if ((SyncFlags & 2) && _Responsible == NULL) {
- Atomic::replace_if_null(Self, &_Responsible);
- }
-
// park self
- if (_Responsible == Self || (SyncFlags & 1)) {
+ if (_Responsible == Self) {
TEVENT(Inflated enter - park TIMED);
Self->_ParkEvent->park((jlong) recheckInterval);
// Increase the recheckInterval, but clamp the value.
recheckInterval *= 8;
if (recheckInterval > MAX_RECHECK_INTERVAL) {
@@ -673,13 +669,10 @@
// Critically, any prior STs to _succ or EntryList must be visible before
// the ST of null into _owner in the *subsequent* (following) corresponding
// monitorexit. Recall too, that in 1-0 mode monitorexit does not necessarily
// execute a serializing instruction.
- if (SyncFlags & 8) {
- OrderAccess::fence();
- }
return;
}
// ReenterI() is a specialized inline form of the latter half of the
// contended slow-path from EnterI(). We use ReenterI() only for
@@ -717,15 +710,11 @@
ThreadBlockInVM tbivm(jt);
// cleared by handle_special_suspend_equivalent_condition()
// or java_suspend_self()
jt->set_suspend_equivalent();
- if (SyncFlags & 1) {
- Self->_ParkEvent->park((jlong)MAX_RECHECK_INTERVAL);
- } else {
Self->_ParkEvent->park();
- }
// were we externally suspended while we were waiting?
for (;;) {
if (!ExitSuspendEquivalent(jt)) break;
if (_succ == Self) { _succ = NULL; OrderAccess::fence(); }
@@ -935,13 +924,11 @@
return;
}
// Invariant: after setting Responsible=null an thread must execute
// a MEMBAR or other serializing instruction before fetching EntryList|cxq.
- if ((SyncFlags & 4) == 0) {
_Responsible = NULL;
- }
#if INCLUDE_JFR
// get the owner's thread id for the MonitorEnter event
// if it is enabled and the thread isn't suspended
if (not_suspended && EventJavaMonitorEnter::is_enabled()) {
@@ -1472,13 +1459,12 @@
Thread::SpinAcquire(&_WaitSetLock, "WaitSet - add");
AddWaiter(&node);
Thread::SpinRelease(&_WaitSetLock);
- if ((SyncFlags & 4) == 0) {
_Responsible = NULL;
- }
+
intptr_t save = _recursions; // record the old recursion count
_waiters++; // increment the number of waiters
_recursions = 0; // set the recursion level to be 1
exit(true, Self); // exit the monitor
guarantee(_owner != Self, "invariant");
@@ -1620,14 +1606,10 @@
// Verify a few postconditions
assert(_owner == Self, "invariant");
assert(_succ != Self, "invariant");
assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
- if (SyncFlags & 32) {
- OrderAccess::fence();
- }
-
// check if the notification happened
if (!WasNotified) {
// no, it could be timeout or Thread.interrupt() or both
// check for interrupt event, otherwise it is timeout
if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) {
@@ -1757,13 +1739,11 @@
// option is to force all notify() operations to behave as notifyAll().
//
// Note: We can also detect many such problems with a "minimum wait".
// When the "minimum wait" is set to a small non-zero timeout value
// and the program does not hang whereas it did absent "minimum wait",
-// that suggests a lost wakeup bug. The '-XX:SyncFlags=1' option uses
-// a "minimum wait" for all park() operations; see the recheckInterval
-// variable and MAX_RECHECK_INTERVAL.
+// that suggests a lost wakeup bug.
void ObjectMonitor::notify(TRAPS) {
CHECK_OWNER();
if (_WaitSet == NULL) {
TEVENT(Empty-Notify);
< prev index next >