Lines Matching refs:self

93 Monitor::Monitor(Thread* self, Thread* owner, ObjPtr<mirror::Object> obj, int32_t hash_code)  in Monitor()  argument
107 monitor_id_(MonitorPool::ComputeMonitorId(this, self)) { in Monitor()
114 CHECK(owner == nullptr || owner == self || owner->IsSuspended()); in Monitor()
118 Monitor::Monitor(Thread* self, in Monitor() argument
142 CHECK(owner == nullptr || owner == self || owner->IsSuspended()); in Monitor()
213 bool Monitor::Install(Thread* self) NO_THREAD_SAFETY_ANALYSIS { in Install() argument
218 CHECK(owner == nullptr || owner == self || (ART_USE_FUTEXES && owner->IsSuspended())); in Install()
225 DCHECK_EQ(monitor_lock_.GetExclusiveOwnerTid(), 0) << " my tid = " << SafeGetTid(self); in Install()
233 << " my tid = " << SafeGetTid(self); in Install()
255 DCHECK_EQ(monitor_lock_.GetExclusiveOwnerTid(), 0) << " my tid = " << SafeGetTid(self); in Install()
330 void Monitor::AtraceMonitorLock(Thread* self, ObjPtr<mirror::Object> obj, bool is_wait) { in AtraceMonitorLock() argument
332 AtraceMonitorLockImpl(self, obj, is_wait); in AtraceMonitorLock()
336 void Monitor::AtraceMonitorLockImpl(Thread* self, ObjPtr<mirror::Object> obj, bool is_wait) { in AtraceMonitorLockImpl() argument
366 self, in AtraceMonitorLockImpl()
419 bool Monitor::TryLock(Thread* self, bool spin) { in TryLock() argument
421 if (owner == self) { in TryLock()
425 bool success = spin ? monitor_lock_.ExclusiveTryLockWithSpinning(self) in TryLock()
426 : monitor_lock_.ExclusiveTryLock(self); in TryLock()
431 owner_.store(self, std::memory_order_relaxed); in TryLock()
434 SetLockingMethodNoProxy(self); in TryLock()
437 DCHECK(monitor_lock_.IsExclusiveHeld(self)); in TryLock()
438 AtraceMonitorLock(self, GetObject(), /* is_wait= */ false); in TryLock()
443 void Monitor::Lock(Thread* self) { in Lock() argument
445 if (TryLock(self, /*spin=*/ true)) { in Lock()
468 Locks::thread_list_lock_->ExclusiveLock(self); in Lock()
481 Locks::thread_list_lock_->ExclusiveUnlock(self); in Lock()
484 ArtMethod* m = self->GetCurrentMethod(&pc); in Lock()
494 Locks::thread_list_lock_->ExclusiveUnlock(self); in Lock()
512 self->SetMonitorEnterObject(GetObject().Ptr()); in Lock()
514 ScopedThreadSuspension tsc(self, kBlocked); // Change to blocked and give up mutator_lock_. in Lock()
519 monitor_lock_.ExclusiveLock(self); in Lock()
537 ScopedObjectAccess soa(self); in Lock()
544 Locks::thread_list_lock_->ExclusiveLock(self); in Lock()
570 Locks::thread_list_lock_->ExclusiveUnlock(self); in Lock()
581 self->DumpJavaStack(self_trace_oss); in Lock()
584 ArtMethod* m = self->GetCurrentMethod(&pc); in Lock()
598 ArtMethod* m = self->GetCurrentMethod(&pc); in Lock()
609 LogContentionEvent(self, in Lock()
615 Locks::thread_list_lock_->ExclusiveUnlock(self); in Lock()
623 owner_.store(self, std::memory_order_relaxed); in Lock()
627 SetLockingMethodNoProxy(self); in Lock()
632 self->SetMonitorEnterObject(nullptr); in Lock()
634 DCHECK(monitor_lock_.IsExclusiveHeld(self)); in Lock()
643 template void Monitor::Lock<LockReason::kForLock>(Thread* self);
644 template void Monitor::Lock<LockReason::kForWait>(Thread* self);
653 Thread* self = Thread::Current(); in ThrowIllegalMonitorStateExceptionF() local
654 self->ThrowNewExceptionV("Ljava/lang/IllegalMonitorStateException;", fmt, args); in ThrowIllegalMonitorStateExceptionF()
657 self->Dump(ss); in ThrowIllegalMonitorStateExceptionF()
659 << self->GetException()->Dump() << "\n" << ss.str(); in ThrowIllegalMonitorStateExceptionF()
741 bool Monitor::Unlock(Thread* self) { in Unlock() argument
742 DCHECK(self != nullptr); in Unlock()
744 if (owner == self) { in Unlock()
746 CheckLockOwnerRequest(self); in Unlock()
750 SignalWaiterAndReleaseMonitorLock(self); in Unlock()
753 DCHECK(monitor_lock_.IsExclusiveHeld(self)); in Unlock()
754 DCHECK_EQ(owner_.load(std::memory_order_relaxed), self); in Unlock()
764 MutexLock mu(self, *Locks::thread_list_lock_); in Unlock()
770 FailedUnlock(GetObject(), self->GetThreadId(), owner_thread_id, this); in Unlock()
776 void Monitor::SignalWaiterAndReleaseMonitorLock(Thread* self) { in SignalWaiterAndReleaseMonitorLock() argument
780 DCHECK(monitor_lock_.IsExclusiveHeld(self)); in SignalWaiterAndReleaseMonitorLock()
808 MutexLock wait_mu(self, *thread->GetWaitMutex()); in SignalWaiterAndReleaseMonitorLock()
813 monitor_lock_.Unlock(self); // Releases contenders. in SignalWaiterAndReleaseMonitorLock()
814 thread->GetWaitConditionVariable()->Signal(self); in SignalWaiterAndReleaseMonitorLock()
819 monitor_lock_.Unlock(self); in SignalWaiterAndReleaseMonitorLock()
820 DCHECK(!monitor_lock_.IsExclusiveHeld(self)); in SignalWaiterAndReleaseMonitorLock()
823 void Monitor::Wait(Thread* self, int64_t ms, int32_t ns, in Wait() argument
825 DCHECK(self != nullptr); in Wait()
829 if (owner_.load(std::memory_order_relaxed) != self) { in Wait()
842 self->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;", in Wait()
847 CheckLockOwnerRequest(self); in Wait()
859 AtraceMonitorLock(self, GetObject(), /* is_wait= */ true); in Wait()
870 ScopedThreadSuspension sts(self, why); in Wait()
873 MutexLock mu(self, *self->GetWaitMutex()); in Wait()
882 AppendToWaitSet(self); in Wait()
887 DCHECK(self->GetWaitMonitor() == nullptr); in Wait()
888 self->SetWaitMonitor(this); in Wait()
891 DCHECK(monitor_lock_.IsExclusiveHeld(self)); in Wait()
892 SignalWaiterAndReleaseMonitorLock(self); in Wait()
895 if (self->IsInterrupted()) { in Wait()
900 self->GetWaitConditionVariable()->Wait(self); in Wait()
903 timed_out = self->GetWaitConditionVariable()->TimedWait(self, ms, ns); in Wait()
905 was_interrupted = self->IsInterrupted(); in Wait()
914 MutexLock mu(self, *self->GetWaitMutex()); in Wait()
915 DCHECK(self->GetWaitMonitor() != nullptr); in Wait()
916 self->SetWaitMonitor(nullptr); in Wait()
930 self->SetInterrupted(false); in Wait()
931 self->ThrowNewException("Ljava/lang/InterruptedException;", nullptr); in Wait()
940 Lock<LockReason::kForWait>(self); in Wait()
942 DCHECK(monitor_lock_.IsExclusiveHeld(self)); in Wait()
943 self->GetWaitMutex()->AssertNotHeld(self); in Wait()
946 RemoveFromWaitSet(self); in Wait()
949 void Monitor::Notify(Thread* self) { in Notify() argument
950 DCHECK(self != nullptr); in Notify()
952 if (owner_.load(std::memory_order_relaxed) != self) { in Notify()
965 void Monitor::NotifyAll(Thread* self) { in NotifyAll() argument
966 DCHECK(self != nullptr); in NotifyAll()
968 if (owner_.load(std::memory_order_relaxed) != self) { in NotifyAll()
989 bool Monitor::Deflate(Thread* self, ObjPtr<mirror::Object> obj) { in Deflate() argument
1001 if (!monitor->monitor_lock_.ExclusiveTryLock(self)) { in Deflate()
1020 monitor->monitor_lock_.ExclusiveUnlock(self); in Deflate()
1021 DCHECK(!(monitor->monitor_lock_.IsExclusiveHeld(self))); in Deflate()
1029 void Monitor::Inflate(Thread* self, Thread* owner, ObjPtr<mirror::Object> obj, int32_t hash_code) { in Inflate() argument
1030 DCHECK(self != nullptr); in Inflate()
1033 Monitor* m = MonitorPool::CreateMonitor(self, owner, obj, hash_code); in Inflate()
1035 if (m->Install(self)) { in Inflate()
1046 MonitorPool::ReleaseMonitor(self, m); in Inflate()
1050 void Monitor::InflateThinLocked(Thread* self, Handle<mirror::Object> obj, LockWord lock_word, in InflateThinLocked() argument
1054 if (owner_thread_id == self->GetThreadId()) { in InflateThinLocked()
1056 Inflate(self, self, obj.Get(), hash_code); in InflateThinLocked()
1060 self->SetMonitorEnterObject(obj.Get()); in InflateThinLocked()
1064 ScopedThreadSuspension sts(self, kWaitingForLockInflation); in InflateThinLocked()
1075 Inflate(self, owner, obj.Get(), hash_code); in InflateThinLocked()
1080 self->SetMonitorEnterObject(nullptr); in InflateThinLocked()
1096 ObjPtr<mirror::Object> Monitor::MonitorEnter(Thread* self, in MonitorEnter() argument
1099 DCHECK(self != nullptr); in MonitorEnter()
1101 self->AssertThreadSuspensionIsAllowable(); in MonitorEnter()
1103 uint32_t thread_id = self->GetThreadId(); in MonitorEnter()
1106 StackHandleScope<1> hs(self); in MonitorEnter()
1124 InflateThinLocked(self, h_obj, lock_word, 0); in MonitorEnter()
1127 AtraceMonitorLock(self, h_obj.Get(), /* is_wait= */ false); in MonitorEnter()
1146 AtraceMonitorLock(self, h_obj.Get(), /* is_wait= */ false); in MonitorEnter()
1154 AtraceMonitorLock(self, h_obj.Get(), /* is_wait= */ false); in MonitorEnter()
1161 InflateThinLocked(self, h_obj, lock_word, 0); in MonitorEnter()
1183 InflateThinLocked(self, h_obj, lock_word, 0); in MonitorEnter()
1200 return mon->TryLock(self) ? h_obj.Get() : nullptr; in MonitorEnter()
1202 mon->Lock(self); in MonitorEnter()
1203 DCHECK(mon->monitor_lock_.IsExclusiveHeld(self)); in MonitorEnter()
1211 Inflate(self, nullptr, h_obj.Get(), lock_word.GetHashCode()); in MonitorEnter()
1221 bool Monitor::MonitorExit(Thread* self, ObjPtr<mirror::Object> obj) { in MonitorExit() argument
1222 DCHECK(self != nullptr); in MonitorExit()
1224 self->AssertThreadSuspensionIsAllowable(); in MonitorExit()
1226 StackHandleScope<1> hs(self); in MonitorExit()
1234 FailedUnlock(h_obj.Get(), self->GetThreadId(), 0u, nullptr); in MonitorExit()
1237 uint32_t thread_id = self->GetThreadId(); in MonitorExit()
1273 return mon->Unlock(self); in MonitorExit()
1283 void Monitor::Wait(Thread* self, in Wait() argument
1289 DCHECK(self != nullptr); in Wait()
1291 StackHandleScope<1> hs(self); in Wait()
1295 if (UNLIKELY(self->ObserveAsyncException() || self->IsExceptionPending())) { in Wait()
1309 uint32_t thread_id = self->GetThreadId(); in Wait()
1317 Inflate(self, self, h_obj.Get(), 0); in Wait()
1330 mon->Wait(self, ms, ns, interruptShouldThrow, why); in Wait()
1333 void Monitor::DoNotify(Thread* self, ObjPtr<mirror::Object> obj, bool notify_all) { in DoNotify() argument
1334 DCHECK(self != nullptr); in DoNotify()
1344 uint32_t thread_id = self->GetThreadId(); in DoNotify()
1357 mon->NotifyAll(self); in DoNotify()
1359 mon->Notify(self); in DoNotify()
1407 Thread* self = Thread::Current(); in FetchState() local
1408 MutexLock mu(self, *thread->GetWaitMutex()); in FetchState()
1604 Thread* self = Thread::Current(); in ~MonitorList() local
1605 MutexLock mu(self, monitor_list_lock_); in ~MonitorList()
1609 MonitorPool::ReleaseMonitors(self, &list_); in ~MonitorList()
1620 Thread* self = Thread::Current(); in AllowNewMonitors() local
1621 MutexLock mu(self, monitor_list_lock_); in AllowNewMonitors()
1623 monitor_add_condition_.Broadcast(self); in AllowNewMonitors()
1627 Thread* self = Thread::Current(); in BroadcastForNewMonitors() local
1628 MutexLock mu(self, monitor_list_lock_); in BroadcastForNewMonitors()
1629 monitor_add_condition_.Broadcast(self); in BroadcastForNewMonitors()
1633 Thread* self = Thread::Current(); in Add() local
1634 MutexLock mu(self, monitor_list_lock_); in Add()
1641 self->CheckEmptyCheckpointFromWeakRefAccess(&monitor_list_lock_); in Add()
1642 monitor_add_condition_.WaitHoldingLocks(self); in Add()
1648 Thread* self = Thread::Current(); in SweepMonitorList() local
1649 MutexLock mu(self, monitor_list_lock_); in SweepMonitorList()
1659 MonitorPool::ReleaseMonitor(self, m); in SweepMonitorList()
1669 Thread* self = Thread::Current(); in Size() local
1670 MutexLock mu(self, monitor_list_lock_); in Size()