equal
deleted
inserted
replaced
119 // |
119 // |
120 // ------------------------------------------------------------------------- |
120 // ------------------------------------------------------------------------- |
121 |
121 |
122 void JvmtiRawMonitor::simple_enter(Thread* self) { |
122 void JvmtiRawMonitor::simple_enter(Thread* self) { |
123 for (;;) { |
123 for (;;) { |
124 if (Atomic::replace_if_null(self, &_owner)) { |
124 if (Atomic::replace_if_null(&_owner, self)) { |
125 return; |
125 return; |
126 } |
126 } |
127 |
127 |
128 QNode node(self); |
128 QNode node(self); |
129 self->_ParkEvent->reset(); // strictly optional |
129 self->_ParkEvent->reset(); // strictly optional |
131 |
131 |
132 RawMonitor_lock->lock_without_safepoint_check(); |
132 RawMonitor_lock->lock_without_safepoint_check(); |
133 node._next = _entry_list; |
133 node._next = _entry_list; |
134 _entry_list = &node; |
134 _entry_list = &node; |
135 OrderAccess::fence(); |
135 OrderAccess::fence(); |
136 if (_owner == NULL && Atomic::replace_if_null(self, &_owner)) { |
136 if (_owner == NULL && Atomic::replace_if_null(&_owner, self)) { |
137 _entry_list = node._next; |
137 _entry_list = node._next; |
138 RawMonitor_lock->unlock(); |
138 RawMonitor_lock->unlock(); |
139 return; |
139 return; |
140 } |
140 } |
141 RawMonitor_lock->unlock(); |
141 RawMonitor_lock->unlock(); |
320 jt->SR_lock()->unlock(); |
320 jt->SR_lock()->unlock(); |
321 jt->java_suspend_self(); |
321 jt->java_suspend_self(); |
322 jt->SR_lock()->lock_without_safepoint_check(); |
322 jt->SR_lock()->lock_without_safepoint_check(); |
323 } |
323 } |
324 // guarded by SR_lock to avoid racing with new external suspend requests. |
324 // guarded by SR_lock to avoid racing with new external suspend requests. |
325 contended = Atomic::cmpxchg(jt, &_owner, (Thread*)NULL); |
325 contended = Atomic::cmpxchg(&_owner, (Thread*)NULL, jt); |
326 jt->SR_lock()->unlock(); |
326 jt->SR_lock()->unlock(); |
327 } else { |
327 } else { |
328 contended = Atomic::cmpxchg(self, &_owner, (Thread*)NULL); |
328 contended = Atomic::cmpxchg(&_owner, (Thread*)NULL, self); |
329 } |
329 } |
330 |
330 |
331 if (contended == self) { |
331 if (contended == self) { |
332 _recursions++; |
332 _recursions++; |
333 return; |
333 return; |