@@ -341,7 +341,7 @@ bool ObjectMonitor::enter(TRAPS) {
341
341
// Note that if we acquire the monitor from an initial spin
342
342
// we forgo posting JVMTI events and firing DTRACE probes.
343
343
if (TrySpin (Self) > 0 ) {
344
- assert (_owner == Self, " must be Self: owner=" INTPTR_FORMAT, p2i (_owner ));
344
+ assert (owner_raw () == Self, " must be Self: owner=" INTPTR_FORMAT, p2i (owner_raw () ));
345
345
assert (_recursions == 0 , " must be 0: recursions=" INTX_FORMAT, _recursions);
346
346
assert (object ()->mark () == markWord::encode (this ),
347
347
" object mark must match encoded this: mark=" INTPTR_FORMAT
@@ -351,7 +351,7 @@ bool ObjectMonitor::enter(TRAPS) {
351
351
return true ;
352
352
}
353
353
354
- assert (_owner != Self, " invariant" );
354
+ assert (owner_raw () != Self, " invariant" );
355
355
assert (_succ != Self, " invariant" );
356
356
JavaThread * jt = Self->as_Java_thread ();
357
357
assert (!SafepointSynchronize::is_at_safepoint (), " invariant" );
@@ -442,7 +442,7 @@ bool ObjectMonitor::enter(TRAPS) {
442
442
443
443
// Must either set _recursions = 0 or ASSERT _recursions == 0.
444
444
assert (_recursions == 0 , " invariant" );
445
- assert (_owner == Self, " invariant" );
445
+ assert (owner_raw () == Self, " invariant" );
446
446
assert (_succ != Self, " invariant" );
447
447
assert (object ()->mark () == markWord::encode (this ), " invariant" );
448
448
@@ -480,7 +480,7 @@ bool ObjectMonitor::enter(TRAPS) {
480
480
// Callers must compensate as needed.
481
481
482
482
int ObjectMonitor::TryLock (Thread * Self) {
483
- void * own = _owner ;
483
+ void * own = owner_raw () ;
484
484
if (own != NULL ) return 0 ;
485
485
if (try_set_owner_from (NULL , Self) == NULL ) {
486
486
assert (_recursions == 0 , " invariant" );
@@ -660,8 +660,8 @@ const char* ObjectMonitor::is_busy_to_string(stringStream* ss) {
660
660
} else {
661
661
ss->print (" contentions=0" );
662
662
}
663
- if (_owner != DEFLATER_MARKER ) {
664
- ss->print (" owner=" INTPTR_FORMAT, p2i (_owner ));
663
+ if (! owner_is_DEFLATER_MARKER () ) {
664
+ ss->print (" owner=" INTPTR_FORMAT, p2i (owner_raw () ));
665
665
} else {
666
666
// We report NULL instead of DEFLATER_MARKER here because is_busy()
667
667
// ignores DEFLATER_MARKER values.
@@ -681,7 +681,7 @@ void ObjectMonitor::EnterI(TRAPS) {
681
681
// Try the lock - TATAS
682
682
if (TryLock (Self) > 0 ) {
683
683
assert (_succ != Self, " invariant" );
684
- assert (_owner == Self, " invariant" );
684
+ assert (owner_raw () == Self, " invariant" );
685
685
assert (_Responsible != Self, " invariant" );
686
686
return ;
687
687
}
@@ -714,15 +714,15 @@ void ObjectMonitor::EnterI(TRAPS) {
714
714
// effects.
715
715
716
716
if (TrySpin (Self) > 0 ) {
717
- assert (_owner == Self, " invariant" );
717
+ assert (owner_raw () == Self, " invariant" );
718
718
assert (_succ != Self, " invariant" );
719
719
assert (_Responsible != Self, " invariant" );
720
720
return ;
721
721
}
722
722
723
723
// The Spin failed -- Enqueue and park the thread ...
724
724
assert (_succ != Self, " invariant" );
725
- assert (_owner != Self, " invariant" );
725
+ assert (owner_raw () != Self, " invariant" );
726
726
assert (_Responsible != Self, " invariant" );
727
727
728
728
// Enqueue "Self" on ObjectMonitor's _cxq.
@@ -752,7 +752,7 @@ void ObjectMonitor::EnterI(TRAPS) {
752
752
// As an optional optimization we retry the lock.
753
753
if (TryLock (Self) > 0 ) {
754
754
assert (_succ != Self, " invariant" );
755
- assert (_owner == Self, " invariant" );
755
+ assert (owner_raw () == Self, " invariant" );
756
756
assert (_Responsible != Self, " invariant" );
757
757
return ;
758
758
}
@@ -804,7 +804,7 @@ void ObjectMonitor::EnterI(TRAPS) {
804
804
for (;;) {
805
805
806
806
if (TryLock (Self) > 0 ) break ;
807
- assert (_owner != Self, " invariant" );
807
+ assert (owner_raw () != Self, " invariant" );
808
808
809
809
// park self
810
810
if (_Responsible == Self) {
@@ -873,7 +873,7 @@ void ObjectMonitor::EnterI(TRAPS) {
873
873
// The head of cxq is volatile but the interior is stable.
874
874
// In addition, Self.TState is stable.
875
875
876
- assert (_owner == Self, " invariant" );
876
+ assert (owner_raw () == Self, " invariant" );
877
877
878
878
UnlinkAfterAcquire (Self, &node);
879
879
if (_succ == Self) _succ = NULL ;
@@ -949,7 +949,7 @@ void ObjectMonitor::ReenterI(Thread * Self, ObjectWaiter * SelfNode) {
949
949
for (;;) {
950
950
ObjectWaiter::TStates v = SelfNode->TState ;
951
951
guarantee (v == ObjectWaiter::TS_ENTER || v == ObjectWaiter::TS_CXQ, " invariant" );
952
- assert (_owner != Self, " invariant" );
952
+ assert (owner_raw () != Self, " invariant" );
953
953
954
954
if (TryLock (Self) > 0 ) break ;
955
955
if (TrySpin (Self) > 0 ) break ;
@@ -1008,7 +1008,7 @@ void ObjectMonitor::ReenterI(Thread * Self, ObjectWaiter * SelfNode) {
1008
1008
// The head of cxq is volatile but the interior is stable.
1009
1009
// In addition, Self.TState is stable.
1010
1010
1011
- assert (_owner == Self, " invariant" );
1011
+ assert (owner_raw () == Self, " invariant" );
1012
1012
assert (object ()->mark () == markWord::encode (this ), " invariant" );
1013
1013
UnlinkAfterAcquire (Self, SelfNode);
1014
1014
if (_succ == Self) _succ = NULL ;
@@ -1022,7 +1022,7 @@ void ObjectMonitor::ReenterI(Thread * Self, ObjectWaiter * SelfNode) {
1022
1022
// unlinking the thread until ::exit()-time.
1023
1023
1024
1024
void ObjectMonitor::UnlinkAfterAcquire (Thread *Self, ObjectWaiter *SelfNode) {
1025
- assert (_owner == Self, " invariant" );
1025
+ assert (owner_raw () == Self, " invariant" );
1026
1026
assert (SelfNode->_thread == Self, " invariant" );
1027
1027
1028
1028
if (SelfNode->TState == ObjectWaiter::TS_ENTER) {
@@ -1142,7 +1142,7 @@ void ObjectMonitor::UnlinkAfterAcquire(Thread *Self, ObjectWaiter *SelfNode) {
1142
1142
1143
1143
void ObjectMonitor::exit (bool not_suspended, TRAPS) {
1144
1144
Thread* const Self = THREAD;
1145
- void * cur = Atomic::load (&_owner );
1145
+ void * cur = owner_raw ( );
1146
1146
if (THREAD != cur) {
1147
1147
if (THREAD->is_lock_owned ((address)cur)) {
1148
1148
assert (_recursions == 0 , " invariant" );
@@ -1188,7 +1188,7 @@ void ObjectMonitor::exit(bool not_suspended, TRAPS) {
1188
1188
#endif
1189
1189
1190
1190
for (;;) {
1191
- assert (THREAD == _owner , " invariant" );
1191
+ assert (THREAD == owner_raw () , " invariant" );
1192
1192
1193
1193
// Drop the lock.
1194
1194
// release semantics: prior loads and stores from within the critical section
@@ -1244,7 +1244,7 @@ void ObjectMonitor::exit(bool not_suspended, TRAPS) {
1244
1244
return ;
1245
1245
}
1246
1246
1247
- guarantee (_owner == THREAD, " invariant" );
1247
+ guarantee (owner_raw () == THREAD, " invariant" );
1248
1248
1249
1249
ObjectWaiter * w = NULL ;
1250
1250
@@ -1356,7 +1356,7 @@ bool ObjectMonitor::ExitSuspendEquivalent(JavaThread * jSelf) {
1356
1356
1357
1357
1358
1358
void ObjectMonitor::ExitEpilog (Thread * Self, ObjectWaiter * Wakee) {
1359
- assert (_owner == Self, " invariant" );
1359
+ assert (owner_raw () == Self, " invariant" );
1360
1360
1361
1361
// Exit protocol:
1362
1362
// 1. ST _succ = wakee
@@ -1400,7 +1400,7 @@ intx ObjectMonitor::complete_exit(TRAPS) {
1400
1400
1401
1401
assert (InitDone, " Unexpectedly not initialized" );
1402
1402
1403
- void * cur = Atomic::load (&_owner );
1403
+ void * cur = owner_raw ( );
1404
1404
if (THREAD != cur) {
1405
1405
if (THREAD->is_lock_owned ((address)cur)) {
1406
1406
assert (_recursions == 0 , " internal state error" );
@@ -1409,11 +1409,11 @@ intx ObjectMonitor::complete_exit(TRAPS) {
1409
1409
}
1410
1410
}
1411
1411
1412
- guarantee (Self == _owner , " complete_exit not owner" );
1412
+ guarantee (Self == owner_raw () , " complete_exit not owner" );
1413
1413
intx save = _recursions; // record the old recursion count
1414
1414
_recursions = 0 ; // set the recursion level to be 0
1415
1415
exit (true , Self); // exit the monitor
1416
- guarantee (_owner != Self, " invariant" );
1416
+ guarantee (owner_raw () != Self, " invariant" );
1417
1417
return save;
1418
1418
}
1419
1419
@@ -1423,7 +1423,7 @@ bool ObjectMonitor::reenter(intx recursions, TRAPS) {
1423
1423
Thread * const Self = THREAD;
1424
1424
JavaThread * jt = Self->as_Java_thread ();
1425
1425
1426
- guarantee (_owner != Self, " reenter already owner" );
1426
+ guarantee (owner_raw () != Self, " reenter already owner" );
1427
1427
if (!enter (THREAD)) {
1428
1428
return false ;
1429
1429
}
@@ -1451,7 +1451,7 @@ bool ObjectMonitor::reenter(intx recursions, TRAPS) {
1451
1451
// (IMSE). If there is a pending exception and the specified thread
1452
1452
// is not the owner, that exception will be replaced by the IMSE.
1453
1453
bool ObjectMonitor::check_owner (Thread* THREAD) {
1454
- void * cur = Atomic::load (&_owner );
1454
+ void * cur = owner_raw ( );
1455
1455
if (cur == THREAD) {
1456
1456
return true ;
1457
1457
}
@@ -1549,7 +1549,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
1549
1549
_waiters++; // increment the number of waiters
1550
1550
_recursions = 0 ; // set the recursion level to be 1
1551
1551
exit (true , Self); // exit the monitor
1552
- guarantee (_owner != Self, " invariant" );
1552
+ guarantee (owner_raw () != Self, " invariant" );
1553
1553
1554
1554
// The thread is on the WaitSet list - now park() it.
1555
1555
// On MP systems it's conceivable that a brief spin before we park
@@ -1664,7 +1664,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
1664
1664
assert (Self->_Stalled != 0 , " invariant" );
1665
1665
Self->_Stalled = 0 ;
1666
1666
1667
- assert (_owner != Self, " invariant" );
1667
+ assert (owner_raw () != Self, " invariant" );
1668
1668
ObjectWaiter::TStates v = node.TState ;
1669
1669
if (v == ObjectWaiter::TS_RUN) {
1670
1670
enter (Self);
@@ -1679,7 +1679,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
1679
1679
// Node is about to go out-of-scope, but even if it were immortal we wouldn't
1680
1680
// want residual elements associated with this thread left on any lists.
1681
1681
guarantee (node.TState == ObjectWaiter::TS_RUN, " invariant" );
1682
- assert (_owner == Self, " invariant" );
1682
+ assert (owner_raw () == Self, " invariant" );
1683
1683
assert (_succ != Self, " invariant" );
1684
1684
} // OSThreadWaitState()
1685
1685
@@ -1691,7 +1691,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
1691
1691
_waiters--; // decrement the number of waiters
1692
1692
1693
1693
// Verify a few postconditions
1694
- assert (_owner == Self, " invariant" );
1694
+ assert (owner_raw () == Self, " invariant" );
1695
1695
assert (_succ != Self, " invariant" );
1696
1696
assert (object ()->mark () == markWord::encode (this ), " invariant" );
1697
1697
@@ -1920,7 +1920,7 @@ int ObjectMonitor::TrySpin(Thread * Self) {
1920
1920
ctr = _SpinDuration;
1921
1921
if (ctr <= 0 ) return 0 ;
1922
1922
1923
- if (NotRunnable (Self, (Thread *) _owner )) {
1923
+ if (NotRunnable (Self, (Thread *) owner_raw () )) {
1924
1924
return 0 ;
1925
1925
}
1926
1926
@@ -1966,7 +1966,7 @@ int ObjectMonitor::TrySpin(Thread * Self) {
1966
1966
// the spin without prejudice or apply a "penalty" to the
1967
1967
// spin count-down variable "ctr", reducing it by 100, say.
1968
1968
1969
- Thread * ox = (Thread *) _owner ;
1969
+ Thread * ox = (Thread *) owner_raw () ;
1970
1970
if (ox == NULL ) {
1971
1971
ox = (Thread*)try_set_owner_from (NULL , Self);
1972
1972
if (ox == NULL ) {
@@ -2092,7 +2092,7 @@ int ObjectMonitor::NotRunnable(Thread * Self, Thread * ox) {
2092
2092
2093
2093
if (BlockedOn == 1 ) return 1 ;
2094
2094
if (BlockedOn != 0 ) {
2095
- return BlockedOn != intptr_t (this ) && _owner == ox;
2095
+ return BlockedOn != intptr_t (this ) && owner_raw () == ox;
2096
2096
}
2097
2097
2098
2098
assert (sizeof (((JavaThread *)ox)->_thread_state == sizeof (int )), " invariant" );
@@ -2284,7 +2284,7 @@ void ObjectMonitor::print_debug_style_on(outputStream* st) const {
2284
2284
st->print_cr (" ..." );
2285
2285
st->print_cr (" [%d] = '\\ 0'" , (int )sizeof (_pad_buf0) - 1 );
2286
2286
st->print_cr (" }" );
2287
- st->print_cr (" _owner = " INTPTR_FORMAT, p2i (_owner ));
2287
+ st->print_cr (" _owner = " INTPTR_FORMAT, p2i (owner_raw () ));
2288
2288
st->print_cr (" _previous_owner_tid = " JLONG_FORMAT, _previous_owner_tid);
2289
2289
st->print_cr (" _pad_buf1 = {" );
2290
2290
st->print_cr (" [0] = '\\ 0'" );
0 commit comments