Lines Matching refs:self
95 Thread* self = Thread::Current(); in ShutDown() local
97 MutexLock mu(self, *Locks::thread_list_lock_); in ShutDown()
98 contains = Contains(self); in ShutDown()
176 Thread* self = Thread::Current(); in DumpUnattachedThreads() local
184 MutexLock mu(self, *Locks::thread_list_lock_); in DumpUnattachedThreads()
217 Thread* self = Thread::Current(); in Run() local
218 CHECK(self != nullptr); in Run()
221 ScopedObjectAccess soa(self); in Run()
226 MutexLock mu(self, *Locks::logging_lock_); in Run()
229 barrier_.Pass(self); in Run()
233 Thread* self = Thread::Current(); in WaitForThreadsToRunThroughCheckpoint() local
234 ScopedThreadStateChange tsc(self, kWaitingForCheckPointsToRun); in WaitForThreadsToRunThroughCheckpoint()
235 bool timed_out = barrier_.Increment(self, threads_running_checkpoint, kDumpWaitTimeout); in WaitForThreadsToRunThroughCheckpoint()
255 Thread* self = Thread::Current(); in Dump() local
257 MutexLock mu(self, *Locks::thread_list_lock_); in Dump()
260 if (self != nullptr) { in Dump()
265 ScopedObjectAccess soa(self); in Dump()
276 void ThreadList::AssertThreadsAreSuspended(Thread* self, Thread* ignore1, Thread* ignore2) { in AssertThreadsAreSuspended() argument
277 MutexLock mu(self, *Locks::thread_list_lock_); in AssertThreadsAreSuspended()
278 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in AssertThreadsAreSuspended()
321 Thread* self = Thread::Current(); in RunCheckpoint() local
322 Locks::mutator_lock_->AssertNotExclusiveHeld(self); in RunCheckpoint()
323 Locks::thread_list_lock_->AssertNotHeld(self); in RunCheckpoint()
324 Locks::thread_suspend_count_lock_->AssertNotHeld(self); in RunCheckpoint()
331 MutexLock mu(self, *Locks::thread_list_lock_); in RunCheckpoint()
332 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in RunCheckpoint()
335 if (thread != self) { in RunCheckpoint()
343 thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in RunCheckpoint()
356 thread->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in RunCheckpoint()
378 callback->Run(self); in RunCheckpoint()
383 checkpoint_function->Run(self); in RunCheckpoint()
391 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in RunCheckpoint()
392 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in RunCheckpoint()
400 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in RunCheckpoint()
401 Thread::resume_cond_->Broadcast(self); in RunCheckpoint()
408 Thread* self = Thread::Current(); in RunEmptyCheckpoint() local
409 Locks::mutator_lock_->AssertNotExclusiveHeld(self); in RunEmptyCheckpoint()
410 Locks::thread_list_lock_->AssertNotHeld(self); in RunEmptyCheckpoint()
411 Locks::thread_suspend_count_lock_->AssertNotHeld(self); in RunEmptyCheckpoint()
415 barrier->Init(self, 0); in RunEmptyCheckpoint()
417 MutexLock mu(self, *Locks::thread_list_lock_); in RunEmptyCheckpoint()
418 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in RunEmptyCheckpoint()
420 if (thread != self) { in RunEmptyCheckpoint()
443 Runtime::Current()->GetHeap()->GetReferenceProcessor()->BroadcastForSlowPath(self); in RunEmptyCheckpoint()
446 ScopedThreadStateChange tsc(self, kWaitingForCheckPointsToRun); in RunEmptyCheckpoint()
464 bool timed_out = barrier->Increment(self, barrier_count, kEmptyCheckpointPeriodicTimeoutMs); in RunEmptyCheckpoint()
473 ss << "Barrier count " << barrier->GetCount(self) << "\n"; in RunEmptyCheckpoint()
485 ScopedObjectAccess soa(self); in RunEmptyCheckpoint()
486 MutexLock mu1(self, *Locks::thread_list_lock_); in RunEmptyCheckpoint()
522 Thread* self = Thread::Current(); in FlipThreadRoots() local
523 Locks::mutator_lock_->AssertNotHeld(self); in FlipThreadRoots()
524 Locks::thread_list_lock_->AssertNotHeld(self); in FlipThreadRoots()
525 Locks::thread_suspend_count_lock_->AssertNotHeld(self); in FlipThreadRoots()
526 CHECK_NE(self->GetState(), kRunnable); in FlipThreadRoots()
528 collector->GetHeap()->ThreadFlipBegin(self); // Sync with JNI critical calls. in FlipThreadRoots()
533 SuspendAllInternal(self, self, nullptr); in FlipThreadRoots()
539 Locks::mutator_lock_->ExclusiveLock(self); in FlipThreadRoots()
541 flip_callback->Run(self); in FlipThreadRoots()
542 Locks::mutator_lock_->ExclusiveUnlock(self); in FlipThreadRoots()
553 MutexLock mu(self, *Locks::thread_list_lock_); in FlipThreadRoots()
554 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in FlipThreadRoots()
561 if (thread == self) { in FlipThreadRoots()
572 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in FlipThreadRoots()
579 Thread::resume_cond_->Broadcast(self); in FlipThreadRoots()
582 collector->GetHeap()->ThreadFlipEnd(self); in FlipThreadRoots()
587 ReaderMutexLock mu(self, *Locks::mutator_lock_); in FlipThreadRoots()
595 Closure* flip_func = self->GetFlipFunction(); in FlipThreadRoots()
597 flip_func->Run(self); in FlipThreadRoots()
604 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in FlipThreadRoots()
606 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in FlipThreadRoots()
609 Thread::resume_cond_->Broadcast(self); in FlipThreadRoots()
616 Thread* self = Thread::Current(); in SuspendAll() local
618 if (self != nullptr) { in SuspendAll()
619 VLOG(threads) << *self << " SuspendAll for " << cause << " starting..."; in SuspendAll()
627 SuspendAllInternal(self, self); in SuspendAll()
632 if (Locks::mutator_lock_->ExclusiveLockWithTimeout(self, in SuspendAll()
644 Locks::mutator_lock_->ExclusiveLock(self); in SuspendAll()
658 AssertThreadsAreSuspended(self, self); in SuspendAll()
663 if (self != nullptr) { in SuspendAll()
664 VLOG(threads) << *self << " SuspendAll complete"; in SuspendAll()
671 void ThreadList::SuspendAllInternal(Thread* self, in SuspendAllInternal() argument
675 Locks::mutator_lock_->AssertNotExclusiveHeld(self); in SuspendAllInternal()
676 Locks::thread_list_lock_->AssertNotHeld(self); in SuspendAllInternal()
677 Locks::thread_suspend_count_lock_->AssertNotHeld(self); in SuspendAllInternal()
678 if (kDebugLocking && self != nullptr) { in SuspendAllInternal()
679 CHECK_NE(self->GetState(), kRunnable); in SuspendAllInternal()
700 MutexLock mu(self, *Locks::thread_list_lock_); in SuspendAllInternal()
701 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in SuspendAllInternal()
711 bool updated = thread->ModifySuspendCount(self, +1, &pending_threads, reason); in SuspendAllInternal()
744 MutexLock mu(self, *Locks::thread_list_lock_); in SuspendAllInternal()
745 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in SuspendAllInternal()
775 Thread* self = Thread::Current(); in ResumeAll() local
777 if (self != nullptr) { in ResumeAll()
778 VLOG(threads) << *self << " ResumeAll starting"; in ResumeAll()
789 AssertThreadsAreSuspended(self, self); in ResumeAll()
794 Locks::mutator_lock_->ExclusiveUnlock(self); in ResumeAll()
796 MutexLock mu(self, *Locks::thread_list_lock_); in ResumeAll()
797 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in ResumeAll()
802 if (thread == self) { in ResumeAll()
805 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in ResumeAll()
811 if (self != nullptr) { in ResumeAll()
812 VLOG(threads) << *self << " ResumeAll waking others"; in ResumeAll()
816 Thread::resume_cond_->Broadcast(self); in ResumeAll()
819 if (self != nullptr) { in ResumeAll()
820 VLOG(threads) << *self << " ResumeAll complete"; in ResumeAll()
830 Thread* self = Thread::Current(); in Resume() local
831 DCHECK_NE(thread, self); in Resume()
836 MutexLock mu(self, *Locks::thread_list_lock_); in Resume()
838 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in Resume()
851 if (UNLIKELY(!thread->ModifySuspendCount(self, -1, nullptr, reason))) { in Resume()
860 MutexLock mu(self, *Locks::thread_suspend_count_lock_); in Resume()
861 Thread::resume_cond_->Broadcast(self); in Resume()
868 static void ThreadSuspendByPeerWarning(Thread* self, in ThreadSuspendByPeerWarning() argument
872 JNIEnvExt* env = self->GetJniEnv(); in ThreadSuspendByPeerWarning()
892 Thread* const self = Thread::Current(); in SuspendThreadByPeer() local
903 ScopedObjectAccess soa(self); in SuspendThreadByPeer()
904 MutexLock thread_list_mu(self, *Locks::thread_list_lock_); in SuspendThreadByPeer()
908 MutexLock suspend_count_mu(self, *Locks::thread_suspend_count_lock_); in SuspendThreadByPeer()
918 ThreadSuspendByPeerWarning(self, in SuspendThreadByPeer()
932 MutexLock suspend_count_mu(self, *Locks::thread_suspend_count_lock_); in SuspendThreadByPeer()
934 if (self->GetSuspendCount() > 0) { in SuspendThreadByPeer()
942 bool updated = suspended_thread->ModifySuspendCount(self, +1, nullptr, reason); in SuspendThreadByPeer()
953 CHECK_NE(thread, self) << "Attempt to suspend the current thread for the debugger"; in SuspendThreadByPeer()
969 ThreadSuspendByPeerWarning(self, in SuspendThreadByPeer()
1013 Thread* const self = Thread::Current(); in SuspendThreadByThreadId() local
1023 ScopedObjectAccess soa(self); in SuspendThreadByThreadId()
1024 MutexLock thread_list_mu(self, *Locks::thread_list_lock_); in SuspendThreadByThreadId()
1044 MutexLock suspend_count_mu(self, *Locks::thread_suspend_count_lock_); in SuspendThreadByThreadId()
1046 if (self->GetSuspendCount() > 0) { in SuspendThreadByThreadId()
1052 bool updated = thread->ModifySuspendCount(self, +1, nullptr, reason); in SuspendThreadByThreadId()
1064 CHECK_NE(thread, self) << "Attempt to suspend the current thread for the debugger"; in SuspendThreadByThreadId()
1115 Thread* self = Thread::Current(); in WaitForOtherNonDaemonThreadsToExit() local
1116 Locks::mutator_lock_->AssertNotHeld(self); in WaitForOtherNonDaemonThreadsToExit()
1118 Locks::runtime_shutdown_lock_->Lock(self); in WaitForOtherNonDaemonThreadsToExit()
1127 Locks::runtime_shutdown_lock_->Unlock(self); in WaitForOtherNonDaemonThreadsToExit()
1132 MutexLock mu(self, *Locks::thread_list_lock_); in WaitForOtherNonDaemonThreadsToExit()
1133 Locks::runtime_shutdown_lock_->Unlock(self); in WaitForOtherNonDaemonThreadsToExit()
1140 if (thread != self && !thread->IsDaemon()) { in WaitForOtherNonDaemonThreadsToExit()
1150 Locks::thread_exit_cond_->Wait(self); in WaitForOtherNonDaemonThreadsToExit()
1156 Thread* self = Thread::Current(); in SuspendAllDaemonThreadsForShutdown() local
1160 MutexLock mu(self, *Locks::thread_list_lock_); in SuspendAllDaemonThreadsForShutdown()
1161 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in SuspendAllDaemonThreadsForShutdown()
1166 if (thread != self) { in SuspendAllDaemonThreadsForShutdown()
1167 bool updated = thread->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in SuspendAllDaemonThreadsForShutdown()
1198 MutexLock mu(self, *Locks::thread_list_lock_); in SuspendAllDaemonThreadsForShutdown()
1200 if (thread != self && thread->GetState() == kRunnable) { in SuspendAllDaemonThreadsForShutdown()
1229 MutexLock mu(self, *Locks::thread_list_lock_); in SuspendAllDaemonThreadsForShutdown()
1235 DCHECK(thread == self || !all_suspended || thread->GetState() != kRunnable); in SuspendAllDaemonThreadsForShutdown()
1254 void ThreadList::Register(Thread* self) { in Register() argument
1255 DCHECK_EQ(self, Thread::Current()); in Register()
1260 self->ShortDump(oss); // We don't hold the mutator_lock_ yet and so cannot call Dump. in Register()
1261 LOG(INFO) << "ThreadList::Register() " << *self << "\n" << oss.str(); in Register()
1266 MutexLock mu(self, *Locks::thread_list_lock_); in Register()
1267 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in Register()
1271 bool updated = self->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in Register()
1274 CHECK(!Contains(self)); in Register()
1275 list_.push_back(self); in Register()
1280 self->SetIsGcMarkingAndUpdateEntrypoints(cc->IsMarking()); in Register()
1282 self->SetReadBarrierEntrypoints(); in Register()
1284 self->SetWeakRefAccessEnabled(cc->IsWeakRefAccessEnabled()); in Register()
1286 self->NotifyInTheadList(); in Register()
1289 void ThreadList::Unregister(Thread* self) { in Unregister() argument
1290 DCHECK_EQ(self, Thread::Current()); in Unregister()
1291 CHECK_NE(self->GetState(), kRunnable); in Unregister()
1292 Locks::mutator_lock_->AssertNotHeld(self); in Unregister()
1294 VLOG(threads) << "ThreadList::Unregister() " << *self; in Unregister()
1297 MutexLock mu(self, *Locks::thread_list_lock_); in Unregister()
1306 self->Destroy(); in Unregister()
1309 Trace::StoreExitingThreadInfo(self); in Unregister()
1311 uint32_t thin_lock_id = self->GetThreadId(); in Unregister()
1317 MutexLock mu(self, *Locks::thread_list_lock_); in Unregister()
1318 if (!Contains(self)) { in Unregister()
1320 self->GetThreadName(thread_name); in Unregister()
1326 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in Unregister()
1327 if (!self->IsSuspended()) { in Unregister()
1328 list_.remove(self); in Unregister()
1338 delete self; in Unregister()
1367 Thread* const self = Thread::Current(); in VisitRootsForSuspendedThreads() local
1372 MutexLock mu(self, *Locks::thread_list_lock_); in VisitRootsForSuspendedThreads()
1373 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in VisitRootsForSuspendedThreads()
1375 bool suspended = thread->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in VisitRootsForSuspendedThreads()
1377 if (thread == self || thread->IsSuspended()) { in VisitRootsForSuspendedThreads()
1380 bool resumed = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in VisitRootsForSuspendedThreads()
1394 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in VisitRootsForSuspendedThreads()
1396 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in VisitRootsForSuspendedThreads()
1423 uint32_t ThreadList::AllocThreadId(Thread* self) { in AllocThreadId() argument
1424 MutexLock mu(self, *Locks::allocated_thread_ids_lock_); in AllocThreadId()
1435 void ThreadList::ReleaseThreadId(Thread* self, uint32_t id) { in ReleaseThreadId() argument
1436 MutexLock mu(self, *Locks::allocated_thread_ids_lock_); in ReleaseThreadId()