< prev index next >

src/hotspot/share/runtime/objectMonitor.cpp

Print this page

 317 
 318 // -----------------------------------------------------------------------------
 319 // Enter support
 320 
 321 bool ObjectMonitor::enter(JavaThread* current) {
 322   // The following code is ordered to check the most common cases first
 323   // and to reduce RTS->RTO cache line upgrades on SPARC and IA32 processors.
 324 
 325   void* cur = try_set_owner_from(NULL, current);
 326   if (cur == NULL) {
 327     assert(_recursions == 0, "invariant");
 328     return true;
 329   }
 330 
 331   if (cur == current) {
 332     // TODO-FIXME: check for integer overflow!  BUGID 6557169.
 333     _recursions++;
 334     return true;
 335   }
 336 
 337   if (current->is_lock_owned((address)cur)) {
 338     assert(_recursions == 0, "internal state error");
 339     _recursions = 1;
 340     set_owner_from_BasicLock(cur, current);  // Convert from BasicLock* to Thread*.
 341     return true;
 342   }
 343 
 344   // We've encountered genuine contention.
 345   assert(current->_Stalled == 0, "invariant");
 346   current->_Stalled = intptr_t(this);
 347 
 348   // Try one round of spinning *before* enqueueing current
 349   // and before going through the awkward and expensive state
 350   // transitions.  The following spin is strictly optional ...
 351   // Note that if we acquire the monitor from an initial spin
 352   // we forgo posting JVMTI events and firing DTRACE probes.
 353   if (TrySpin(current) > 0) {
 354     assert(owner_raw() == current, "must be current: owner=" INTPTR_FORMAT, p2i(owner_raw()));
 355     assert(_recursions == 0, "must be 0: recursions=" INTX_FORMAT, _recursions);
 356     assert(object()->mark() == markWord::encode(this),
 357            "object mark must match encoded this: mark=" INTPTR_FORMAT
 358            ", encoded this=" INTPTR_FORMAT, object()->mark().value(),
 359            markWord::encode(this).value());
 360     current->_Stalled = 0;
 361     return true;
 362   }

 583             p2i(_EntryList));
 584 
 585   if (obj != NULL) {
 586     if (log_is_enabled(Trace, monitorinflation)) {
 587       ResourceMark rm;
 588       log_trace(monitorinflation)("deflate_monitor: object=" INTPTR_FORMAT
 589                                   ", mark=" INTPTR_FORMAT ", type='%s'",
 590                                   p2i(obj), obj->mark().value(),
 591                                   obj->klass()->external_name());
 592     }
 593 
 594     // Install the old mark word if nobody else has already done it.
 595     install_displaced_markword_in_object(obj);
 596   }
 597 
 598   // We leave owner == DEFLATER_MARKER and contentions < 0
 599   // to force any racing threads to retry.
 600   return true;  // Success, ObjectMonitor has been deflated.
 601 }
 602 
















 603 // Install the displaced mark word (dmw) of a deflating ObjectMonitor
 604 // into the header of the object associated with the monitor. This
 605 // idempotent method is called by a thread that is deflating a
 606 // monitor and by other threads that have detected a race with the
 607 // deflation process.
 608 void ObjectMonitor::install_displaced_markword_in_object(const oop obj) {
 609   // This function must only be called when (owner == DEFLATER_MARKER
 610   // && contentions <= 0), but we can't guarantee that here because
 611   // those values could change when the ObjectMonitor gets moved from
 612   // the global free list to a per-thread free list.
 613 
 614   guarantee(obj != NULL, "must be non-NULL");
 615 
 616   // Separate loads in is_being_async_deflated(), which is almost always
 617   // called before this function, from the load of dmw/header below.
 618 
 619   // _contentions and dmw/header may get written by different threads.
 620   // Make sure to observe them in the same order when having several observers.
 621   OrderAccess::loadload_for_IRIW();
 622 

1118 // the timer expires.  If the lock is high traffic then the stranding latency
1119 // will be low due to (a).  If the lock is low traffic then the odds of
1120 // stranding are lower, although the worst-case stranding latency
1121 // is longer.  Critically, we don't want to put excessive load in the
1122 // platform's timer subsystem.  We want to minimize both the timer injection
1123 // rate (timers created/sec) as well as the number of timers active at
1124 // any one time.  (more precisely, we want to minimize timer-seconds, which is
1125 // the integral of the # of active timers at any instant over time).
1126 // Both impinge on OS scalability.  Given that, at most one thread parked on
1127 // a monitor will use a timer.
1128 //
1129 // There is also the risk of a futile wake-up. If we drop the lock
1130 // another thread can reacquire the lock immediately, and we can
1131 // then wake a thread unnecessarily. This is benign, and we've
1132 // structured the code so the windows are short and the frequency
1133 // of such futile wakups is low.
1134 
1135 void ObjectMonitor::exit(JavaThread* current, bool not_suspended) {
1136   void* cur = owner_raw();
1137   if (current != cur) {
1138     if (current->is_lock_owned((address)cur)) {
1139       assert(_recursions == 0, "invariant");
1140       set_owner_from_BasicLock(cur, current);  // Convert from BasicLock* to Thread*.
1141       _recursions = 0;
1142     } else {
1143       // Apparent unbalanced locking ...
1144       // Naively we'd like to throw IllegalMonitorStateException.
1145       // As a practical matter we can neither allocate nor throw an
1146       // exception as ::exit() can be called from leaf routines.
1147       // see x86_32.ad Fast_Unlock() and the I1 and I2 properties.
1148       // Upon deeper reflection, however, in a properly run JVM the only
1149       // way we should encounter this situation is in the presence of
1150       // unbalanced JNI locking. TODO: CheckJNICalls.
1151       // See also: CR4414101
1152 #ifdef ASSERT
1153       LogStreamHandle(Error, monitorinflation) lsh;
1154       lsh.print_cr("ERROR: ObjectMonitor::exit(): thread=" INTPTR_FORMAT
1155                     " is exiting an ObjectMonitor it does not own.", p2i(current));
1156       lsh.print_cr("The imbalance is possibly caused by JNI locking.");
1157       print_debug_style_on(&lsh);
1158       assert(false, "Non-balanced monitor enter/exit!");
1159 #endif
1160       return;
1161     }
1162   }
1163 
1164   if (_recursions != 0) {
1165     _recursions--;        // this is simple recursive enter
1166     return;
1167   }
1168 
1169   // Invariant: after setting Responsible=null an thread must execute
1170   // a MEMBAR or other serializing instruction before fetching EntryList|cxq.
1171   _Responsible = NULL;
1172 
1173 #if INCLUDE_JFR
1174   // get the owner's thread id for the MonitorEnter event
1175   // if it is enabled and the thread isn't suspended
1176   if (not_suspended && EventJavaMonitorEnter::is_enabled()) {
1177     _previous_owner_tid = JFR_THREAD_ID(current);
1178   }
1179 #endif
1180 
1181   for (;;) {

1338 
1339   // Maintain stats and report events to JVMTI
1340   OM_PERFDATA_OP(Parks, inc());
1341 }
1342 
1343 
1344 // -----------------------------------------------------------------------------
1345 // Class Loader deadlock handling.
1346 //
1347 // complete_exit exits a lock returning recursion count
1348 // complete_exit/reenter operate as a wait without waiting
1349 // complete_exit requires an inflated monitor
1350 // The _owner field is not always the Thread addr even with an
1351 // inflated monitor, e.g. the monitor can be inflated by a non-owning
1352 // thread due to contention.
1353 intx ObjectMonitor::complete_exit(JavaThread* current) {
1354   assert(InitDone, "Unexpectedly not initialized");
1355 
1356   void* cur = owner_raw();
1357   if (current != cur) {
1358     if (current->is_lock_owned((address)cur)) {
1359       assert(_recursions == 0, "internal state error");
1360       set_owner_from_BasicLock(cur, current);  // Convert from BasicLock* to Thread*.
1361       _recursions = 0;
1362     }
1363   }
1364 
1365   guarantee(current == owner_raw(), "complete_exit not owner");
1366   intx save = _recursions; // record the old recursion count
1367   _recursions = 0;         // set the recursion level to be 0
1368   exit(current);           // exit the monitor
1369   guarantee(owner_raw() != current, "invariant");
1370   return save;
1371 }
1372 
1373 // reenter() enters a lock and sets recursion count
1374 // complete_exit/reenter operate as a wait without waiting
1375 bool ObjectMonitor::reenter(intx recursions, JavaThread* current) {
1376 
1377   guarantee(owner_raw() != current, "reenter already owner");
1378   if (!enter(current)) {
1379     return false;
1380   }
1381   // Entered the monitor.
1382   guarantee(_recursions == 0, "reenter recursion");

1387 // Checks that the current THREAD owns this monitor and causes an
1388 // immediate return if it doesn't. We don't use the CHECK macro
1389 // because we want the IMSE to be the only exception that is thrown
1390 // from the call site when false is returned. Any other pending
1391 // exception is ignored.
1392 #define CHECK_OWNER()                                                  \
1393   do {                                                                 \
1394     if (!check_owner(THREAD)) {                                        \
1395        assert(HAS_PENDING_EXCEPTION, "expected a pending IMSE here."); \
1396        return;                                                         \
1397      }                                                                 \
1398   } while (false)
1399 
1400 // Returns true if the specified thread owns the ObjectMonitor.
1401 // Otherwise returns false and throws IllegalMonitorStateException
1402 // (IMSE). If there is a pending exception and the specified thread
1403 // is not the owner, that exception will be replaced by the IMSE.
1404 bool ObjectMonitor::check_owner(TRAPS) {
1405   JavaThread* current = THREAD;
1406   void* cur = owner_raw();

1407   if (cur == current) {
1408     return true;
1409   }
1410   if (current->is_lock_owned((address)cur)) {
1411     set_owner_from_BasicLock(cur, current);  // Convert from BasicLock* to Thread*.
1412     _recursions = 0;
1413     return true;
1414   }
1415   THROW_MSG_(vmSymbols::java_lang_IllegalMonitorStateException(),
1416              "current thread is not owner", false);
1417 }
1418 
1419 static void post_monitor_wait_event(EventJavaMonitorWait* event,
1420                                     ObjectMonitor* monitor,
1421                                     uint64_t notifier_tid,
1422                                     jlong timeout,
1423                                     bool timedout) {
1424   assert(event != NULL, "invariant");
1425   assert(monitor != NULL, "invariant");
1426   event->set_monitorClass(monitor->object()->klass());
1427   event->set_timeout(timeout);
1428   // Set an address that is 'unique enough', such that events close in
1429   // time and with the same address are likely (but not guaranteed) to
1430   // belong to the same object.
1431   event->set_address((uintptr_t)monitor);
1432   event->set_notifier(notifier_tid);
1433   event->set_timedOut(timedout);
1434   event->commit();

1996   }
1997   return 0;
1998 }
1999 
2000 // NotRunnable() -- informed spinning
2001 //
2002 // Don't bother spinning if the owner is not eligible to drop the lock.
2003 // Spin only if the owner thread is _thread_in_Java or _thread_in_vm.
2004 // The thread must be runnable in order to drop the lock in timely fashion.
2005 // If the _owner is not runnable then spinning will not likely be
2006 // successful (profitable).
2007 //
2008 // Beware -- the thread referenced by _owner could have died
2009 // so a simply fetch from _owner->_thread_state might trap.
2010 // Instead, we use SafeFetchXX() to safely LD _owner->_thread_state.
2011 // Because of the lifecycle issues, the _thread_state values
2012 // observed by NotRunnable() might be garbage.  NotRunnable must
2013 // tolerate this and consider the observed _thread_state value
2014 // as advisory.
2015 //
2016 // Beware too, that _owner is sometimes a BasicLock address and sometimes
2017 // a thread pointer.
2018 // Alternately, we might tag the type (thread pointer vs basiclock pointer)
2019 // with the LSB of _owner.  Another option would be to probabilistically probe
2020 // the putative _owner->TypeTag value.
2021 //
2022 // Checking _thread_state isn't perfect.  Even if the thread is
2023 // in_java it might be blocked on a page-fault or have been preempted
2024 // and sitting on a ready/dispatch queue.
2025 //
2026 // The return value from NotRunnable() is *advisory* -- the
2027 // result is based on sampling and is not necessarily coherent.
2028 // The caller must tolerate false-negative and false-positive errors.
2029 // Spinning, in general, is probabilistic anyway.
2030 
2031 
2032 int ObjectMonitor::NotRunnable(JavaThread* current, JavaThread* ox) {
2033   // Check ox->TypeTag == 2BAD.
2034   if (ox == NULL) return 0;
2035 
2036   // Avoid transitive spinning ...
2037   // Say T1 spins or blocks trying to acquire L.  T1._Stalled is set to L.
2038   // Immediately after T1 acquires L it's possible that T2, also
2039   // spinning on L, will see L.Owner=T1 and T1._Stalled=L.
2040   // This occurs transiently after T1 acquired L but before
2041   // T1 managed to clear T1.Stalled.  T2 does not need to abort

 317 
 318 // -----------------------------------------------------------------------------
 319 // Enter support
 320 
 321 bool ObjectMonitor::enter(JavaThread* current) {
 322   // The following code is ordered to check the most common cases first
 323   // and to reduce RTS->RTO cache line upgrades on SPARC and IA32 processors.
 324 
 325   void* cur = try_set_owner_from(NULL, current);
 326   if (cur == NULL) {
 327     assert(_recursions == 0, "invariant");
 328     return true;
 329   }
 330 
 331   if (cur == current) {
 332     // TODO-FIXME: check for integer overflow!  BUGID 6557169.
 333     _recursions++;
 334     return true;
 335   }
 336 
 337   assert(cur == ANONYMOUS_OWNER || !current->is_lock_owned((address)cur), "precondition");





 338 
 339   // We've encountered genuine contention.
 340   assert(current->_Stalled == 0, "invariant");
 341   current->_Stalled = intptr_t(this);
 342 
 343   // Try one round of spinning *before* enqueueing current
 344   // and before going through the awkward and expensive state
 345   // transitions.  The following spin is strictly optional ...
 346   // Note that if we acquire the monitor from an initial spin
 347   // we forgo posting JVMTI events and firing DTRACE probes.
 348   if (TrySpin(current) > 0) {
 349     assert(owner_raw() == current, "must be current: owner=" INTPTR_FORMAT, p2i(owner_raw()));
 350     assert(_recursions == 0, "must be 0: recursions=" INTX_FORMAT, _recursions);
 351     assert(object()->mark() == markWord::encode(this),
 352            "object mark must match encoded this: mark=" INTPTR_FORMAT
 353            ", encoded this=" INTPTR_FORMAT, object()->mark().value(),
 354            markWord::encode(this).value());
 355     current->_Stalled = 0;
 356     return true;
 357   }

 578             p2i(_EntryList));
 579 
 580   if (obj != NULL) {
 581     if (log_is_enabled(Trace, monitorinflation)) {
 582       ResourceMark rm;
 583       log_trace(monitorinflation)("deflate_monitor: object=" INTPTR_FORMAT
 584                                   ", mark=" INTPTR_FORMAT ", type='%s'",
 585                                   p2i(obj), obj->mark().value(),
 586                                   obj->klass()->external_name());
 587     }
 588 
 589     // Install the old mark word if nobody else has already done it.
 590     install_displaced_markword_in_object(obj);
 591   }
 592 
 593   // We leave owner == DEFLATER_MARKER and contentions < 0
 594   // to force any racing threads to retry.
 595   return true;  // Success, ObjectMonitor has been deflated.
 596 }
 597 
 598 // We might access the dead object headers for parsable heap walk, make sure
 599 // headers are in correct shape, e.g. monitors deflated.
 600 void ObjectMonitor::maybe_deflate_dead(oop* p) {
 601   oop obj = *p;
 602   assert(obj != NULL, "must not yet been cleared");
 603   markWord mark = obj->mark();
 604   if (mark.has_monitor()) {
 605     ObjectMonitor* monitor = mark.monitor();
 606     if (p == monitor->_object.ptr_raw()) {
 607       assert(monitor->object_peek() == obj, "lock object must match");
 608       markWord dmw = monitor->header();
 609       obj->set_mark(dmw);
 610     }
 611   }
 612 }
 613 
 614 // Install the displaced mark word (dmw) of a deflating ObjectMonitor
 615 // into the header of the object associated with the monitor. This
 616 // idempotent method is called by a thread that is deflating a
 617 // monitor and by other threads that have detected a race with the
 618 // deflation process.
 619 void ObjectMonitor::install_displaced_markword_in_object(const oop obj) {
 620   // This function must only be called when (owner == DEFLATER_MARKER
 621   // && contentions <= 0), but we can't guarantee that here because
 622   // those values could change when the ObjectMonitor gets moved from
 623   // the global free list to a per-thread free list.
 624 
 625   guarantee(obj != NULL, "must be non-NULL");
 626 
 627   // Separate loads in is_being_async_deflated(), which is almost always
 628   // called before this function, from the load of dmw/header below.
 629 
 630   // _contentions and dmw/header may get written by different threads.
 631   // Make sure to observe them in the same order when having several observers.
 632   OrderAccess::loadload_for_IRIW();
 633 

1129 // the timer expires.  If the lock is high traffic then the stranding latency
1130 // will be low due to (a).  If the lock is low traffic then the odds of
1131 // stranding are lower, although the worst-case stranding latency
1132 // is longer.  Critically, we don't want to put excessive load in the
1133 // platform's timer subsystem.  We want to minimize both the timer injection
1134 // rate (timers created/sec) as well as the number of timers active at
1135 // any one time.  (more precisely, we want to minimize timer-seconds, which is
1136 // the integral of the # of active timers at any instant over time).
1137 // Both impinge on OS scalability.  Given that, at most one thread parked on
1138 // a monitor will use a timer.
1139 //
1140 // There is also the risk of a futile wake-up. If we drop the lock
1141 // another thread can reacquire the lock immediately, and we can
1142 // then wake a thread unnecessarily. This is benign, and we've
1143 // structured the code so the windows are short and the frequency
1144 // of such futile wakups is low.
1145 
1146 void ObjectMonitor::exit(JavaThread* current, bool not_suspended) {
1147   void* cur = owner_raw();
1148   if (current != cur) {
1149     assert(!current->is_lock_owned((address)cur), "no stack-locking");
1150     // Apparent unbalanced locking ...
1151     // Naively we'd like to throw IllegalMonitorStateException.
1152     // As a practical matter we can neither allocate nor throw an
1153     // exception as ::exit() can be called from leaf routines.
1154     // see x86_32.ad Fast_Unlock() and the I1 and I2 properties.
1155     // Upon deeper reflection, however, in a properly run JVM the only
1156     // way we should encounter this situation is in the presence of
1157     // unbalanced JNI locking. TODO: CheckJNICalls.
1158     // See also: CR4414101




1159 #ifdef ASSERT
1160     LogStreamHandle(Error, monitorinflation) lsh;
1161     lsh.print_cr("ERROR: ObjectMonitor::exit(): thread=" INTPTR_FORMAT
1162                   " is exiting an ObjectMonitor it does not own.", p2i(current));
1163     lsh.print_cr("The imbalance is possibly caused by JNI locking.");
1164     print_debug_style_on(&lsh);
1165     assert(false, "Non-balanced monitor enter/exit! " PTR_FORMAT, p2i(object()));
1166 #endif
1167     return;

1168   }
1169 
1170   if (_recursions != 0) {
1171     _recursions--;        // this is simple recursive enter
1172     return;
1173   }
1174 
1175   // Invariant: after setting Responsible=null an thread must execute
1176   // a MEMBAR or other serializing instruction before fetching EntryList|cxq.
1177   _Responsible = NULL;
1178 
1179 #if INCLUDE_JFR
1180   // get the owner's thread id for the MonitorEnter event
1181   // if it is enabled and the thread isn't suspended
1182   if (not_suspended && EventJavaMonitorEnter::is_enabled()) {
1183     _previous_owner_tid = JFR_THREAD_ID(current);
1184   }
1185 #endif
1186 
1187   for (;;) {

1344 
1345   // Maintain stats and report events to JVMTI
1346   OM_PERFDATA_OP(Parks, inc());
1347 }
1348 
1349 
1350 // -----------------------------------------------------------------------------
1351 // Class Loader deadlock handling.
1352 //
1353 // complete_exit exits a lock returning recursion count
1354 // complete_exit/reenter operate as a wait without waiting
1355 // complete_exit requires an inflated monitor
1356 // The _owner field is not always the Thread addr even with an
1357 // inflated monitor, e.g. the monitor can be inflated by a non-owning
1358 // thread due to contention.
1359 intx ObjectMonitor::complete_exit(JavaThread* current) {
1360   assert(InitDone, "Unexpectedly not initialized");
1361 
1362   void* cur = owner_raw();
1363   if (current != cur) {
1364     assert(!current->is_lock_owned((address)cur), "no stack-locking");




1365   }
1366 
1367   guarantee(current == owner_raw(), "complete_exit not owner");
1368   intx save = _recursions; // record the old recursion count
1369   _recursions = 0;         // set the recursion level to be 0
1370   exit(current);           // exit the monitor
1371   guarantee(owner_raw() != current, "invariant");
1372   return save;
1373 }
1374 
1375 // reenter() enters a lock and sets recursion count
1376 // complete_exit/reenter operate as a wait without waiting
1377 bool ObjectMonitor::reenter(intx recursions, JavaThread* current) {
1378 
1379   guarantee(owner_raw() != current, "reenter already owner");
1380   if (!enter(current)) {
1381     return false;
1382   }
1383   // Entered the monitor.
1384   guarantee(_recursions == 0, "reenter recursion");

1389 // Checks that the current THREAD owns this monitor and causes an
1390 // immediate return if it doesn't. We don't use the CHECK macro
1391 // because we want the IMSE to be the only exception that is thrown
1392 // from the call site when false is returned. Any other pending
1393 // exception is ignored.
1394 #define CHECK_OWNER()                                                  \
1395   do {                                                                 \
1396     if (!check_owner(THREAD)) {                                        \
1397        assert(HAS_PENDING_EXCEPTION, "expected a pending IMSE here."); \
1398        return;                                                         \
1399      }                                                                 \
1400   } while (false)
1401 
1402 // Returns true if the specified thread owns the ObjectMonitor.
1403 // Otherwise returns false and throws IllegalMonitorStateException
1404 // (IMSE). If there is a pending exception and the specified thread
1405 // is not the owner, that exception will be replaced by the IMSE.
1406 bool ObjectMonitor::check_owner(TRAPS) {
1407   JavaThread* current = THREAD;
1408   void* cur = owner_raw();
1409   assert(cur != ANONYMOUS_OWNER, "no anon owner here");
1410   if (cur == current) {
1411     return true;
1412   }





1413   THROW_MSG_(vmSymbols::java_lang_IllegalMonitorStateException(),
1414              "current thread is not owner", false);
1415 }
1416 
1417 static void post_monitor_wait_event(EventJavaMonitorWait* event,
1418                                     ObjectMonitor* monitor,
1419                                     uint64_t notifier_tid,
1420                                     jlong timeout,
1421                                     bool timedout) {
1422   assert(event != NULL, "invariant");
1423   assert(monitor != NULL, "invariant");
1424   event->set_monitorClass(monitor->object()->klass());
1425   event->set_timeout(timeout);
1426   // Set an address that is 'unique enough', such that events close in
1427   // time and with the same address are likely (but not guaranteed) to
1428   // belong to the same object.
1429   event->set_address((uintptr_t)monitor);
1430   event->set_notifier(notifier_tid);
1431   event->set_timedOut(timedout);
1432   event->commit();

1994   }
1995   return 0;
1996 }
1997 
1998 // NotRunnable() -- informed spinning
1999 //
2000 // Don't bother spinning if the owner is not eligible to drop the lock.
2001 // Spin only if the owner thread is _thread_in_Java or _thread_in_vm.
2002 // The thread must be runnable in order to drop the lock in timely fashion.
2003 // If the _owner is not runnable then spinning will not likely be
2004 // successful (profitable).
2005 //
2006 // Beware -- the thread referenced by _owner could have died
2007 // so a simply fetch from _owner->_thread_state might trap.
2008 // Instead, we use SafeFetchXX() to safely LD _owner->_thread_state.
2009 // Because of the lifecycle issues, the _thread_state values
2010 // observed by NotRunnable() might be garbage.  NotRunnable must
2011 // tolerate this and consider the observed _thread_state value
2012 // as advisory.
2013 //






2014 // Checking _thread_state isn't perfect.  Even if the thread is
2015 // in_java it might be blocked on a page-fault or have been preempted
2016 // and sitting on a ready/dispatch queue.
2017 //
2018 // The return value from NotRunnable() is *advisory* -- the
2019 // result is based on sampling and is not necessarily coherent.
2020 // The caller must tolerate false-negative and false-positive errors.
2021 // Spinning, in general, is probabilistic anyway.
2022 
2023 
2024 int ObjectMonitor::NotRunnable(JavaThread* current, JavaThread* ox) {
2025   // Check ox->TypeTag == 2BAD.
2026   if (ox == NULL) return 0;
2027 
2028   // Avoid transitive spinning ...
2029   // Say T1 spins or blocks trying to acquire L.  T1._Stalled is set to L.
2030   // Immediately after T1 acquires L it's possible that T2, also
2031   // spinning on L, will see L.Owner=T1 and T1._Stalled=L.
2032   // This occurs transiently after T1 acquired L but before
2033   // T1 managed to clear T1.Stalled.  T2 does not need to abort
< prev index next >