• Home
  • Raw
  • Download

Lines Matching refs:self

96   Thread* self = Thread::Current();  in ShutDown()  local
98 MutexLock mu(self, *Locks::thread_list_lock_); in ShutDown()
99 contains = Contains(self); in ShutDown()
178 Thread* self = Thread::Current(); in DumpUnattachedThreads() local
186 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()
347 bool updated = thread->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in RunCheckpoint()
357 callback->Run(self); in RunCheckpoint()
362 checkpoint_function->Run(self); in RunCheckpoint()
388 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in RunCheckpoint()
389 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in RunCheckpoint()
397 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in RunCheckpoint()
398 Thread::resume_cond_->Broadcast(self); in RunCheckpoint()
405 Thread* self = Thread::Current(); in RunEmptyCheckpoint() local
406 Locks::mutator_lock_->AssertNotExclusiveHeld(self); in RunEmptyCheckpoint()
407 Locks::thread_list_lock_->AssertNotHeld(self); in RunEmptyCheckpoint()
408 Locks::thread_suspend_count_lock_->AssertNotHeld(self); in RunEmptyCheckpoint()
412 barrier->Init(self, 0); in RunEmptyCheckpoint()
414 MutexLock mu(self, *Locks::thread_list_lock_); in RunEmptyCheckpoint()
415 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in RunEmptyCheckpoint()
417 if (thread != self) { in RunEmptyCheckpoint()
440 Runtime::Current()->GetHeap()->GetReferenceProcessor()->BroadcastForSlowPath(self); in RunEmptyCheckpoint()
443 ScopedThreadStateChange tsc(self, kWaitingForCheckPointsToRun); in RunEmptyCheckpoint()
461 bool timed_out = barrier->Increment(self, barrier_count, kEmptyCheckpointPeriodicTimeoutMs); in RunEmptyCheckpoint()
470 ss << "Barrier count " << barrier->GetCount(self) << "\n"; in RunEmptyCheckpoint()
482 ScopedObjectAccess soa(self); in RunEmptyCheckpoint()
483 MutexLock mu1(self, *Locks::thread_list_lock_); in RunEmptyCheckpoint()
513 Thread* self = Thread::Current(); in RunCheckpointOnRunnableThreads() local
514 Locks::mutator_lock_->AssertNotExclusiveHeld(self); in RunCheckpointOnRunnableThreads()
515 Locks::thread_list_lock_->AssertNotHeld(self); in RunCheckpointOnRunnableThreads()
516 Locks::thread_suspend_count_lock_->AssertNotHeld(self); in RunCheckpointOnRunnableThreads()
517 CHECK_NE(self->GetState(), kRunnable); in RunCheckpointOnRunnableThreads()
522 MutexLock mu(self, *Locks::thread_list_lock_); in RunCheckpointOnRunnableThreads()
523 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in RunCheckpointOnRunnableThreads()
525 if (thread != self) { in RunCheckpointOnRunnableThreads()
547 Thread* self = Thread::Current(); in FlipThreadRoots() local
548 Locks::mutator_lock_->AssertNotHeld(self); in FlipThreadRoots()
549 Locks::thread_list_lock_->AssertNotHeld(self); in FlipThreadRoots()
550 Locks::thread_suspend_count_lock_->AssertNotHeld(self); in FlipThreadRoots()
551 CHECK_NE(self->GetState(), kRunnable); in FlipThreadRoots()
553 collector->GetHeap()->ThreadFlipBegin(self); // Sync with JNI critical calls. in FlipThreadRoots()
558 SuspendAllInternal(self, self, nullptr); in FlipThreadRoots()
564 Locks::mutator_lock_->ExclusiveLock(self); in FlipThreadRoots()
566 flip_callback->Run(self); in FlipThreadRoots()
567 Locks::mutator_lock_->ExclusiveUnlock(self); in FlipThreadRoots()
578 MutexLock mu(self, *Locks::thread_list_lock_); in FlipThreadRoots()
579 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in FlipThreadRoots()
586 if (thread == self) { in FlipThreadRoots()
597 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in FlipThreadRoots()
604 Thread::resume_cond_->Broadcast(self); in FlipThreadRoots()
607 collector->GetHeap()->ThreadFlipEnd(self); in FlipThreadRoots()
612 ReaderMutexLock mu(self, *Locks::mutator_lock_); in FlipThreadRoots()
620 Closure* flip_func = self->GetFlipFunction(); in FlipThreadRoots()
622 flip_func->Run(self); in FlipThreadRoots()
629 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in FlipThreadRoots()
631 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in FlipThreadRoots()
634 Thread::resume_cond_->Broadcast(self); in FlipThreadRoots()
641 Thread* self = Thread::Current(); in SuspendAll() local
643 if (self != nullptr) { in SuspendAll()
644 VLOG(threads) << *self << " SuspendAll for " << cause << " starting..."; in SuspendAll()
652 SuspendAllInternal(self, self); in SuspendAll()
657 if (Locks::mutator_lock_->ExclusiveLockWithTimeout(self, in SuspendAll()
669 Locks::mutator_lock_->ExclusiveLock(self); in SuspendAll()
683 AssertThreadsAreSuspended(self, self); in SuspendAll()
688 if (self != nullptr) { in SuspendAll()
689 VLOG(threads) << *self << " SuspendAll complete"; in SuspendAll()
699 void ThreadList::SuspendAllInternal(Thread* self, in SuspendAllInternal() argument
703 Locks::mutator_lock_->AssertNotExclusiveHeld(self); in SuspendAllInternal()
704 Locks::thread_list_lock_->AssertNotHeld(self); in SuspendAllInternal()
705 Locks::thread_suspend_count_lock_->AssertNotHeld(self); in SuspendAllInternal()
706 if (kDebugLocking && self != nullptr) { in SuspendAllInternal()
707 CHECK_NE(self->GetState(), kRunnable); in SuspendAllInternal()
728 MutexLock mu(self, *Locks::thread_list_lock_); in SuspendAllInternal()
729 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in SuspendAllInternal()
742 bool updated = thread->ModifySuspendCount(self, +1, &pending_threads, reason); in SuspendAllInternal()
791 Thread* self = Thread::Current(); in ResumeAll() local
793 if (self != nullptr) { in ResumeAll()
794 VLOG(threads) << *self << " ResumeAll starting"; in ResumeAll()
805 AssertThreadsAreSuspended(self, self); in ResumeAll()
810 Locks::mutator_lock_->ExclusiveUnlock(self); in ResumeAll()
812 MutexLock mu(self, *Locks::thread_list_lock_); in ResumeAll()
813 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in ResumeAll()
818 if (thread == self) { in ResumeAll()
821 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in ResumeAll()
827 if (self != nullptr) { in ResumeAll()
828 VLOG(threads) << *self << " ResumeAll waking others"; in ResumeAll()
832 Thread::resume_cond_->Broadcast(self); in ResumeAll()
835 if (self != nullptr) { in ResumeAll()
836 VLOG(threads) << *self << " ResumeAll complete"; in ResumeAll()
846 Thread* self = Thread::Current(); in Resume() local
847 DCHECK_NE(thread, self); in Resume()
852 MutexLock mu(self, *Locks::thread_list_lock_); in Resume()
854 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in Resume()
867 if (UNLIKELY(!thread->ModifySuspendCount(self, -1, nullptr, reason))) { in Resume()
876 MutexLock mu(self, *Locks::thread_suspend_count_lock_); in Resume()
877 Thread::resume_cond_->Broadcast(self); in Resume()
884 static void ThreadSuspendByPeerWarning(Thread* self, in ThreadSuspendByPeerWarning() argument
888 JNIEnvExt* env = self->GetJniEnv(); in ThreadSuspendByPeerWarning()
908 Thread* const self = Thread::Current(); in SuspendThreadByPeer() local
919 ScopedObjectAccess soa(self); in SuspendThreadByPeer()
920 MutexLock thread_list_mu(self, *Locks::thread_list_lock_); in SuspendThreadByPeer()
924 MutexLock suspend_count_mu(self, *Locks::thread_suspend_count_lock_); in SuspendThreadByPeer()
934 ThreadSuspendByPeerWarning(self, in SuspendThreadByPeer()
948 MutexLock suspend_count_mu(self, *Locks::thread_suspend_count_lock_); in SuspendThreadByPeer()
950 if (self->GetSuspendCount() > 0) { in SuspendThreadByPeer()
958 bool updated = suspended_thread->ModifySuspendCount(self, +1, nullptr, reason); in SuspendThreadByPeer()
969 CHECK_NE(thread, self) << "Attempt to suspend the current thread for the debugger"; in SuspendThreadByPeer()
985 ThreadSuspendByPeerWarning(self, in SuspendThreadByPeer()
1029 Thread* const self = Thread::Current(); in SuspendThreadByThreadId() local
1039 ScopedObjectAccess soa(self); in SuspendThreadByThreadId()
1040 MutexLock thread_list_mu(self, *Locks::thread_list_lock_); in SuspendThreadByThreadId()
1060 MutexLock suspend_count_mu(self, *Locks::thread_suspend_count_lock_); in SuspendThreadByThreadId()
1062 if (self->GetSuspendCount() > 0) { in SuspendThreadByThreadId()
1068 bool updated = thread->ModifySuspendCount(self, +1, nullptr, reason); in SuspendThreadByThreadId()
1080 CHECK_NE(thread, self) << "Attempt to suspend the current thread for the debugger"; in SuspendThreadByThreadId()
1130 Thread* self = Thread::Current(); in SuspendAllForDebugger() local
1133 VLOG(threads) << *self << " SuspendAllForDebugger starting..."; in SuspendAllForDebugger()
1135 SuspendAllInternal(self, self, debug_thread, SuspendReason::kForDebugger); in SuspendAllForDebugger()
1140 if (!Locks::mutator_lock_->ExclusiveLockWithTimeout(self, 30 * 1000, 0)) { in SuspendAllForDebugger()
1143 Locks::mutator_lock_->ExclusiveUnlock(self); in SuspendAllForDebugger()
1146 Locks::mutator_lock_->ExclusiveLock(self); in SuspendAllForDebugger()
1147 Locks::mutator_lock_->ExclusiveUnlock(self); in SuspendAllForDebugger()
1156 VLOG(threads) << *self << " SuspendAllForDebugger complete"; in SuspendAllForDebugger()
1160 Thread* const self = Thread::Current(); in SuspendSelfForDebugger() local
1161 self->SetReadyForDebugInvoke(true); in SuspendSelfForDebugger()
1165 CHECK(self != debug_thread); in SuspendSelfForDebugger()
1166 CHECK_NE(self->GetState(), kRunnable); in SuspendSelfForDebugger()
1167 Locks::mutator_lock_->AssertNotHeld(self); in SuspendSelfForDebugger()
1171 DebugInvokeReq* pReq = self->GetInvokeReq(); in SuspendSelfForDebugger()
1177 MutexLock mu(self, *Locks::thread_suspend_count_lock_); in SuspendSelfForDebugger()
1178 bool updated = self->ModifySuspendCount(self, +1, nullptr, SuspendReason::kForDebugger); in SuspendSelfForDebugger()
1180 CHECK_GT(self->GetSuspendCount(), 0); in SuspendSelfForDebugger()
1182 VLOG(threads) << *self << " self-suspending (debugger)"; in SuspendSelfForDebugger()
1185 MutexLock mu(self, *Locks::thread_suspend_count_lock_); in SuspendSelfForDebugger()
1186 CHECK_EQ(self->GetDebugSuspendCount(), 0) << "Debugger detached without resuming us"; in SuspendSelfForDebugger()
1188 VLOG(threads) << *self << " not self-suspending because debugger detached during invoke"; in SuspendSelfForDebugger()
1194 self->ClearDebugInvokeReq(); in SuspendSelfForDebugger()
1204 MutexLock mu(self, *Locks::thread_suspend_count_lock_); in SuspendSelfForDebugger()
1205 while (self->GetSuspendCount() != 0) { in SuspendSelfForDebugger()
1206 Thread::resume_cond_->Wait(self); in SuspendSelfForDebugger()
1207 if (self->GetSuspendCount() != 0) { in SuspendSelfForDebugger()
1214 VLOG(jdwp) << *self << " still suspended after undo " in SuspendSelfForDebugger()
1215 << "(suspend count=" << self->GetSuspendCount() << ", " in SuspendSelfForDebugger()
1216 << "debug suspend count=" << self->GetDebugSuspendCount() << ")"; in SuspendSelfForDebugger()
1219 CHECK_EQ(self->GetSuspendCount(), 0); in SuspendSelfForDebugger()
1222 self->SetReadyForDebugInvoke(false); in SuspendSelfForDebugger()
1223 VLOG(threads) << *self << " self-reviving (debugger)"; in SuspendSelfForDebugger()
1227 Thread* self = Thread::Current(); in ResumeAllForDebugger() local
1230 VLOG(threads) << *self << " ResumeAllForDebugger starting..."; in ResumeAllForDebugger()
1233 Locks::mutator_lock_->AssertNotExclusiveHeld(self); in ResumeAllForDebugger()
1236 MutexLock thread_list_mu(self, *Locks::thread_list_lock_); in ResumeAllForDebugger()
1238 MutexLock suspend_count_mu(self, *Locks::thread_suspend_count_lock_); in ResumeAllForDebugger()
1255 if (thread == self || thread == debug_thread) { in ResumeAllForDebugger()
1263 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kForDebugger); in ResumeAllForDebugger()
1270 MutexLock mu(self, *Locks::thread_suspend_count_lock_); in ResumeAllForDebugger()
1271 Thread::resume_cond_->Broadcast(self); in ResumeAllForDebugger()
1274 VLOG(threads) << *self << " ResumeAllForDebugger complete"; in ResumeAllForDebugger()
1278 Thread* self = Thread::Current(); in UndoDebuggerSuspensions() local
1280 VLOG(threads) << *self << " UndoDebuggerSuspensions starting"; in UndoDebuggerSuspensions()
1283 MutexLock mu(self, *Locks::thread_list_lock_); in UndoDebuggerSuspensions()
1284 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in UndoDebuggerSuspensions()
1290 if (thread == self || thread->GetDebugSuspendCount() == 0) { in UndoDebuggerSuspensions()
1293 bool suspended = thread->ModifySuspendCount(self, in UndoDebuggerSuspensions()
1302 MutexLock mu(self, *Locks::thread_suspend_count_lock_); in UndoDebuggerSuspensions()
1303 Thread::resume_cond_->Broadcast(self); in UndoDebuggerSuspensions()
1306 VLOG(threads) << "UndoDebuggerSuspensions(" << *self << ") complete"; in UndoDebuggerSuspensions()
1311 Thread* self = Thread::Current(); in WaitForOtherNonDaemonThreadsToExit() local
1312 Locks::mutator_lock_->AssertNotHeld(self); in WaitForOtherNonDaemonThreadsToExit()
1316 MutexLock mu(self, *Locks::runtime_shutdown_lock_); in WaitForOtherNonDaemonThreadsToExit()
1320 MutexLock mu(self, *Locks::thread_list_lock_); in WaitForOtherNonDaemonThreadsToExit()
1327 if (thread != self && !thread->IsDaemon()) { in WaitForOtherNonDaemonThreadsToExit()
1337 Locks::thread_exit_cond_->Wait(self); in WaitForOtherNonDaemonThreadsToExit()
1343 Thread* self = Thread::Current(); in SuspendAllDaemonThreadsForShutdown() local
1347 MutexLock mu(self, *Locks::thread_list_lock_); in SuspendAllDaemonThreadsForShutdown()
1348 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in SuspendAllDaemonThreadsForShutdown()
1353 if (thread != self) { in SuspendAllDaemonThreadsForShutdown()
1354 bool updated = thread->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in SuspendAllDaemonThreadsForShutdown()
1378 MutexLock mu(self, *Locks::thread_list_lock_); in SuspendAllDaemonThreadsForShutdown()
1380 if (thread != self && thread->GetState() == kRunnable) { in SuspendAllDaemonThreadsForShutdown()
1397 void ThreadList::Register(Thread* self) { in Register() argument
1398 DCHECK_EQ(self, Thread::Current()); in Register()
1403 self->ShortDump(oss); // We don't hold the mutator_lock_ yet and so cannot call Dump. in Register()
1404 LOG(INFO) << "ThreadList::Register() " << *self << "\n" << oss.str(); in Register()
1409 MutexLock mu(self, *Locks::thread_list_lock_); in Register()
1410 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in Register()
1415 bool updated = self->ModifySuspendCount(self, +1, nullptr, SuspendReason::kForDebugger); in Register()
1419 bool updated = self->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in Register()
1422 CHECK(!Contains(self)); in Register()
1423 list_.push_back(self); in Register()
1428 self->SetIsGcMarkingAndUpdateEntrypoints(cc->IsMarking()); in Register()
1430 self->SetReadBarrierEntrypoints(); in Register()
1432 self->SetWeakRefAccessEnabled(cc->IsWeakRefAccessEnabled()); in Register()
1436 void ThreadList::Unregister(Thread* self) { in Unregister() argument
1437 DCHECK_EQ(self, Thread::Current()); in Unregister()
1438 CHECK_NE(self->GetState(), kRunnable); in Unregister()
1439 Locks::mutator_lock_->AssertNotHeld(self); in Unregister()
1441 VLOG(threads) << "ThreadList::Unregister() " << *self; in Unregister()
1444 MutexLock mu(self, *Locks::thread_list_lock_); in Unregister()
1453 self->Destroy(); in Unregister()
1456 Trace::StoreExitingThreadInfo(self); in Unregister()
1458 uint32_t thin_lock_id = self->GetThreadId(); in Unregister()
1463 MutexLock mu(self, *Locks::thread_list_lock_); in Unregister()
1464 if (!Contains(self)) { in Unregister()
1466 self->GetThreadName(thread_name); in Unregister()
1472 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in Unregister()
1473 if (!self->IsSuspended()) { in Unregister()
1474 list_.remove(self); in Unregister()
1480 delete self; in Unregister()
1508 Thread* const self = Thread::Current(); in VisitRootsForSuspendedThreads() local
1513 MutexLock mu(self, *Locks::thread_list_lock_); in VisitRootsForSuspendedThreads()
1514 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in VisitRootsForSuspendedThreads()
1516 bool suspended = thread->ModifySuspendCount(self, +1, nullptr, SuspendReason::kInternal); in VisitRootsForSuspendedThreads()
1518 if (thread == self || thread->IsSuspended()) { in VisitRootsForSuspendedThreads()
1521 bool resumed = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in VisitRootsForSuspendedThreads()
1535 MutexLock mu2(self, *Locks::thread_suspend_count_lock_); in VisitRootsForSuspendedThreads()
1537 bool updated = thread->ModifySuspendCount(self, -1, nullptr, SuspendReason::kInternal); in VisitRootsForSuspendedThreads()
1550 uint32_t ThreadList::AllocThreadId(Thread* self) { in AllocThreadId() argument
1551 MutexLock mu(self, *Locks::allocated_thread_ids_lock_); in AllocThreadId()
1562 void ThreadList::ReleaseThreadId(Thread* self, uint32_t id) { in ReleaseThreadId() argument
1563 MutexLock mu(self, *Locks::allocated_thread_ids_lock_); in ReleaseThreadId()