Lines Matching refs:art
67 art::ArtField* ThreadUtil::context_class_loader_ = nullptr;
69 ScopedNoUserCodeSuspension::ScopedNoUserCodeSuspension(art::Thread* self) : self_(self) { in ScopedNoUserCodeSuspension()
70 DCHECK_EQ(self, art::Thread::Current()); in ScopedNoUserCodeSuspension()
74 art::Locks::user_code_suspension_lock_->AssertNotHeld(self_); in ScopedNoUserCodeSuspension()
77 art::Locks::user_code_suspension_lock_->ExclusiveLock(self_); in ScopedNoUserCodeSuspension()
79 art::Locks::user_code_suspension_lock_->ExclusiveUnlock(self_); in ScopedNoUserCodeSuspension()
83 art::Locks::user_code_suspension_lock_->AssertHeld(self_); in ScopedNoUserCodeSuspension()
90 art::Locks::user_code_suspension_lock_->ExclusiveUnlock(self_); in ~ScopedNoUserCodeSuspension()
93 struct ThreadCallback : public art::ThreadLifecycleCallback {
94 jthread GetThreadObject(art::Thread* self) REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetThreadObject()
102 void Post(art::Thread* self) REQUIRES_SHARED(art::Locks::mutator_lock_) { in Post()
103 DCHECK_EQ(self, art::Thread::Current()); in Post()
105 art::ScopedThreadSuspension sts(self, art::ThreadState::kNative); in Post()
111 void ThreadStart(art::Thread* self) override REQUIRES_SHARED(art::Locks::mutator_lock_) { in ThreadStart()
127 if (art::kIsDebugBuild) { in ThreadStart()
144 void ThreadDeath(art::Thread* self) override REQUIRES_SHARED(art::Locks::mutator_lock_) { in ThreadDeath()
155 art::Runtime* runtime = art::Runtime::Current(); in Register()
160 art::ScopedThreadStateChange stsc(art::Thread::Current(), in Register()
161 art::ThreadState::kWaitingForDebuggerToAttach); in Register()
162 art::ScopedSuspendAll ssa("Add thread callback"); in Register()
171 gThreadCallback.Post<ArtJvmtiEvent::kThreadStart>(art::Thread::Current()); in VMInitEventSent()
175 static void WaitForSystemDaemonStart(art::Thread* self) REQUIRES_SHARED(art::Locks::mutator_lock_) { in WaitForSystemDaemonStart()
177 art::ScopedThreadStateChange strc(self, art::kNative); in WaitForSystemDaemonStart()
179 jni->CallStaticVoidMethod(art::WellKnownClasses::java_lang_Daemons, in WaitForSystemDaemonStart()
180 art::WellKnownClasses::java_lang_Daemons_waitForDaemonStart); in WaitForSystemDaemonStart()
192 art::Thread* self = art::Thread::Current(); in CacheData()
193 art::ScopedObjectAccess soa(self); in CacheData()
194 art::ObjPtr<art::mirror::Class> thread_class = in CacheData()
195 soa.Decode<art::mirror::Class>(art::WellKnownClasses::java_lang_Thread); in CacheData()
206 art::ScopedThreadStateChange stsc(art::Thread::Current(), in Unregister()
207 art::ThreadState::kWaitingForDebuggerToAttach); in Unregister()
208 art::ScopedSuspendAll ssa("Remove thread callback"); in Unregister()
209 art::Runtime* runtime = art::Runtime::Current(); in Unregister()
214 art::Thread* self = art::Thread::Current(); in GetCurrentThread()
216 art::ScopedObjectAccess soa(self); in GetCurrentThread()
231 const art::ScopedObjectAccessAlreadyRunnable& soa, in GetNativeThread()
232 /*out*/ art::Thread** thr, in GetNativeThread()
234 art::ScopedExceptionStorage sse(soa.Self()); in GetNativeThread()
236 *thr = art::Thread::Current(); in GetNativeThread()
238 } else if (!soa.Env()->IsInstanceOf(thread, art::WellKnownClasses::java_lang_Thread)) { in GetNativeThread()
242 *thr = art::Thread::FromManagedThread(soa, thread); in GetNativeThread()
248 const art::ScopedObjectAccessAlreadyRunnable& soa, in GetAliveNativeThread()
249 /*out*/ art::Thread** thr, in GetAliveNativeThread()
253 } else if (*thr == nullptr || (*thr)->GetState() == art::ThreadState::kTerminated) { in GetAliveNativeThread()
269 art::Thread* self = art::Thread::Current(); in GetThreadInfo()
270 art::ScopedObjectAccess soa(self); in GetThreadInfo()
271 art::MutexLock mu(self, *art::Locks::thread_list_lock_); in GetThreadInfo()
273 art::Thread* target; in GetThreadInfo()
295 art::ObjPtr<art::mirror::Object> peer = target->GetPeerFromOtherThread(); in GetThreadInfo()
299 art::ArtField* f = art::jni::DecodeArtField(art::WellKnownClasses::java_lang_Thread_group); in GetThreadInfo()
301 art::ObjPtr<art::mirror::Object> group = f->GetObject(peer); in GetThreadInfo()
311 art::ObjPtr<art::mirror::Object> ccl = peer != nullptr in GetThreadInfo()
320 art::ObjPtr<art::mirror::Object> peer = soa.Decode<art::mirror::Object>(thread); in GetThreadInfo()
324 art::ArtField* f = art::jni::DecodeArtField(art::WellKnownClasses::java_lang_Thread_name); in GetThreadInfo()
326 art::ObjPtr<art::mirror::Object> name = f->GetObject(peer); in GetThreadInfo()
345 art::ArtField* f = art::jni::DecodeArtField(art::WellKnownClasses::java_lang_Thread_priority); in GetThreadInfo()
352 art::ArtField* f = art::jni::DecodeArtField(art::WellKnownClasses::java_lang_Thread_daemon); in GetThreadInfo()
359 art::ArtField* f = art::jni::DecodeArtField(art::WellKnownClasses::java_lang_Thread_group); in GetThreadInfo()
361 art::ObjPtr<art::mirror::Object> group = f->GetObject(peer); in GetThreadInfo()
369 art::ObjPtr<art::mirror::Object> ccl = peer != nullptr in GetThreadInfo()
383 art::Thread* native_thread;
384 art::ThreadState art_state;
389 static InternalThreadState GetNativeThreadState(art::Thread* target) in GetNativeThreadState()
390 REQUIRES_SHARED(art::Locks::mutator_lock_) in GetNativeThreadState()
391 REQUIRES(art::Locks::thread_list_lock_, art::Locks::user_code_suspension_lock_) { in GetNativeThreadState()
393 art::MutexLock tscl_mu(art::Thread::Current(), *art::Locks::thread_suspend_count_lock_); in GetNativeThreadState()
396 thread_state.art_state = art::ThreadState::kStarting; in GetNativeThreadState()
406 art::ThreadState internal_thread_state = state.art_state; in GetJvmtiThreadStateFromInternal()
425 case art::ThreadState::kRunnable: in GetJvmtiThreadStateFromInternal()
426 case art::ThreadState::kWaitingWeakGcRootRead: in GetJvmtiThreadStateFromInternal()
427 case art::ThreadState::kSuspended: in GetJvmtiThreadStateFromInternal()
436 case art::ThreadState::kNative: in GetJvmtiThreadStateFromInternal()
443 case art::ThreadState::kBlocked: in GetJvmtiThreadStateFromInternal()
447 case art::ThreadState::kWaiting: in GetJvmtiThreadStateFromInternal()
453 case art::ThreadState::kTimedWaiting: in GetJvmtiThreadStateFromInternal()
459 case art::ThreadState::kSleeping: in GetJvmtiThreadStateFromInternal()
467 case art::ThreadState::kWaitingForDebuggerSend: in GetJvmtiThreadStateFromInternal()
468 case art::ThreadState::kWaitingForDebuggerToAttach: in GetJvmtiThreadStateFromInternal()
469 case art::ThreadState::kWaitingInMainDebuggerLoop: in GetJvmtiThreadStateFromInternal()
470 case art::ThreadState::kWaitingForDebuggerSuspension: in GetJvmtiThreadStateFromInternal()
471 case art::ThreadState::kWaitingForLockInflation: in GetJvmtiThreadStateFromInternal()
472 case art::ThreadState::kWaitingForTaskProcessor: in GetJvmtiThreadStateFromInternal()
473 case art::ThreadState::kWaitingForGcToComplete: in GetJvmtiThreadStateFromInternal()
474 case art::ThreadState::kWaitingForCheckPointsToRun: in GetJvmtiThreadStateFromInternal()
475 case art::ThreadState::kWaitingPerformingGc: in GetJvmtiThreadStateFromInternal()
476 case art::ThreadState::kWaitingForJniOnLoad: in GetJvmtiThreadStateFromInternal()
477 case art::ThreadState::kWaitingInMainSignalCatcherLoop: in GetJvmtiThreadStateFromInternal()
478 case art::ThreadState::kWaitingForSignalCatcherOutput: in GetJvmtiThreadStateFromInternal()
479 case art::ThreadState::kWaitingForDeoptimization: in GetJvmtiThreadStateFromInternal()
480 case art::ThreadState::kWaitingForMethodTracingStart: in GetJvmtiThreadStateFromInternal()
481 case art::ThreadState::kWaitingForVisitObjects: in GetJvmtiThreadStateFromInternal()
482 case art::ThreadState::kWaitingForGetObjectsAllocated: in GetJvmtiThreadStateFromInternal()
483 case art::ThreadState::kWaitingForGcThreadFlip: in GetJvmtiThreadStateFromInternal()
484 case art::ThreadState::kNativeForAbort: in GetJvmtiThreadStateFromInternal()
490 case art::ThreadState::kStarting: in GetJvmtiThreadStateFromInternal()
491 case art::ThreadState::kTerminated: in GetJvmtiThreadStateFromInternal()
503 case art::ThreadState::kTerminated: in GetJavaStateFromInternal()
506 case art::ThreadState::kRunnable: in GetJavaStateFromInternal()
507 case art::ThreadState::kNative: in GetJavaStateFromInternal()
508 case art::ThreadState::kWaitingWeakGcRootRead: in GetJavaStateFromInternal()
509 case art::ThreadState::kSuspended: in GetJavaStateFromInternal()
512 case art::ThreadState::kTimedWaiting: in GetJavaStateFromInternal()
513 case art::ThreadState::kSleeping: in GetJavaStateFromInternal()
516 case art::ThreadState::kBlocked: in GetJavaStateFromInternal()
519 case art::ThreadState::kStarting: in GetJavaStateFromInternal()
522 case art::ThreadState::kWaiting: in GetJavaStateFromInternal()
523 case art::ThreadState::kWaitingForTaskProcessor: in GetJavaStateFromInternal()
524 case art::ThreadState::kWaitingForLockInflation: in GetJavaStateFromInternal()
525 case art::ThreadState::kWaitingForGcToComplete: in GetJavaStateFromInternal()
526 case art::ThreadState::kWaitingPerformingGc: in GetJavaStateFromInternal()
527 case art::ThreadState::kWaitingForCheckPointsToRun: in GetJavaStateFromInternal()
528 case art::ThreadState::kWaitingForDebuggerSend: in GetJavaStateFromInternal()
529 case art::ThreadState::kWaitingForDebuggerToAttach: in GetJavaStateFromInternal()
530 case art::ThreadState::kWaitingInMainDebuggerLoop: in GetJavaStateFromInternal()
531 case art::ThreadState::kWaitingForDebuggerSuspension: in GetJavaStateFromInternal()
532 case art::ThreadState::kWaitingForDeoptimization: in GetJavaStateFromInternal()
533 case art::ThreadState::kWaitingForGetObjectsAllocated: in GetJavaStateFromInternal()
534 case art::ThreadState::kWaitingForJniOnLoad: in GetJavaStateFromInternal()
535 case art::ThreadState::kWaitingForSignalCatcherOutput: in GetJavaStateFromInternal()
536 case art::ThreadState::kWaitingInMainSignalCatcherLoop: in GetJavaStateFromInternal()
537 case art::ThreadState::kWaitingForMethodTracingStart: in GetJavaStateFromInternal()
538 case art::ThreadState::kWaitingForVisitObjects: in GetJavaStateFromInternal()
539 case art::ThreadState::kWaitingForGcThreadFlip: in GetJavaStateFromInternal()
540 case art::ThreadState::kNativeForAbort: in GetJavaStateFromInternal()
548 void ThreadUtil::SuspendCheck(art::Thread* self) { in SuspendCheck()
549 art::ScopedObjectAccess soa(self); in SuspendCheck()
554 bool ThreadUtil::WouldSuspendForUserCodeLocked(art::Thread* self) { in WouldSuspendForUserCodeLocked()
555 DCHECK(self == art::Thread::Current()); in WouldSuspendForUserCodeLocked()
556 art::MutexLock tscl_mu(self, *art::Locks::thread_suspend_count_lock_); in WouldSuspendForUserCodeLocked()
560 bool ThreadUtil::WouldSuspendForUserCode(art::Thread* self) { in WouldSuspendForUserCode()
561 DCHECK(self == art::Thread::Current()); in WouldSuspendForUserCode()
562 art::MutexLock ucsl_mu(self, *art::Locks::user_code_suspension_lock_); in WouldSuspendForUserCode()
573 art::Thread* self = art::Thread::Current(); in GetThreadState()
577 art::ScopedObjectAccess soa(self); in GetThreadState()
578 art::MutexLock tll_mu(self, *art::Locks::thread_list_lock_); in GetThreadState()
580 art::Thread* target = nullptr; in GetThreadState()
585 if (state.art_state != art::ThreadState::kStarting) { in GetThreadState()
603 DCHECK_EQ(state.art_state, art::ThreadState::kStarting); in GetThreadState()
610 art::ScopedObjectAccess soa(self); in GetThreadState()
611 art::StackHandleScope<1> hs(self); in GetThreadState()
614 art::Handle<art::mirror::Object> peer(hs.NewHandle(soa.Decode<art::mirror::Object>(thread))); in GetThreadState()
615 art::ObjPtr<art::mirror::Class> thread_klass = in GetThreadState()
616 soa.Decode<art::mirror::Class>(art::WellKnownClasses::java_lang_Thread); in GetThreadState()
620 art::ArtField* started_field = thread_klass->FindDeclaredInstanceField("started", "Z"); in GetThreadState()
637 art::Thread* current = art::Thread::Current(); in GetAllThreads()
639 art::ScopedObjectAccess soa(current); in GetAllThreads()
641 art::MutexLock mu(current, *art::Locks::thread_list_lock_); in GetAllThreads()
642 std::list<art::Thread*> thread_list = art::Runtime::Current()->GetThreadList()->GetList(); in GetAllThreads()
644 std::vector<art::ObjPtr<art::mirror::Object>> peers; in GetAllThreads()
646 for (art::Thread* thread : thread_list) { in GetAllThreads()
652 art::ObjPtr<art::mirror::Object> peer = thread->GetPeerFromOtherThread(); in GetAllThreads()
678 static void RemoveTLSData(art::Thread* target, void* ctx) REQUIRES(art::Locks::thread_list_lock_) { in RemoveTLSData()
680 art::Locks::thread_list_lock_->AssertHeld(art::Thread::Current()); in RemoveTLSData()
688 art::Thread* self = art::Thread::Current(); in RemoveEnvironment()
689 art::MutexLock mu(self, *art::Locks::thread_list_lock_); in RemoveEnvironment()
690 art::ThreadList* list = art::Runtime::Current()->GetThreadList(); in RemoveEnvironment()
695 art::Thread* self = art::Thread::Current(); in SetThreadLocalStorage()
696 art::ScopedObjectAccess soa(self); in SetThreadLocalStorage()
697 art::MutexLock mu(self, *art::Locks::thread_list_lock_); in SetThreadLocalStorage()
698 art::Thread* target = nullptr; in SetThreadLocalStorage()
711 JvmtiGlobalTLSData* ThreadUtil::GetOrCreateGlobalTLSData(art::Thread* thread) { in GetOrCreateGlobalTLSData()
721 JvmtiGlobalTLSData* ThreadUtil::GetGlobalTLSData(art::Thread* thread) { in GetGlobalTLSData()
732 art::Thread* self = art::Thread::Current(); in GetThreadLocalStorage()
733 art::ScopedObjectAccess soa(self); in GetThreadLocalStorage()
734 art::MutexLock mu(self, *art::Locks::thread_list_lock_); in GetThreadLocalStorage()
735 art::Thread* target = nullptr; in GetThreadLocalStorage()
771 art::Thread* self = art::Thread::Attach(data->name.c_str(), true, data->thread); in AgentCallback()
776 art::ScopedObjectAccess soa(self); in AgentCallback()
788 art::MutexLock mu(art::Thread::Current(), *art::Locks::runtime_shutdown_lock_); in AgentCallback()
789 art::Runtime::Current()->EndThreadBirth(); in AgentCallback()
813 JNIEnv* env = art::Thread::Current()->GetJniEnv(); in RunAgentThread()
814 if (thread == nullptr || !env->IsInstanceOf(thread, art::WellKnownClasses::java_lang_Thread)) { in RunAgentThread()
822 art::Runtime* runtime = art::Runtime::Current(); in RunAgentThread()
823 art::MutexLock mu(art::Thread::Current(), *art::Locks::runtime_shutdown_lock_); in RunAgentThread()
841 data->java_vm = art::Runtime::Current()->GetJavaVM(); in RunAgentThread()
847 env->GetObjectField(thread, art::WellKnownClasses::java_lang_Thread_name))); in RunAgentThread()
862 art::Runtime* runtime = art::Runtime::Current(); in RunAgentThread()
863 art::MutexLock mu(art::Thread::Current(), *art::Locks::runtime_shutdown_lock_); in RunAgentThread()
872 jvmtiError ThreadUtil::SuspendOther(art::Thread* self, in SuspendOther()
881 art::ScopedObjectAccess soa(self); in SuspendOther()
882 art::MutexLock thread_list_mu(self, *art::Locks::thread_list_lock_); in SuspendOther()
883 art::Thread* target = nullptr; in SuspendOther()
888 art::ThreadState state = target->GetState(); in SuspendOther()
889 if (state == art::ThreadState::kStarting || target->IsStillStarting()) { in SuspendOther()
892 art::MutexLock thread_suspend_count_mu(self, *art::Locks::thread_suspend_count_lock_); in SuspendOther()
899 art::Thread* ret_target = art::Runtime::Current()->GetThreadList()->SuspendThreadByPeer( in SuspendOther()
902 art::SuspendReason::kForUserCode, in SuspendOther()
917 jvmtiError ThreadUtil::SuspendSelf(art::Thread* self) { in SuspendSelf()
918 CHECK(self == art::Thread::Current()); in SuspendSelf()
920 art::MutexLock mu(self, *art::Locks::user_code_suspension_lock_); in SuspendSelf()
921 art::MutexLock thread_list_mu(self, *art::Locks::thread_suspend_count_lock_); in SuspendSelf()
927 if (!self->ModifySuspendCount(self, +1, nullptr, art::SuspendReason::kForUserCode)) { in SuspendSelf()
940 art::Thread* self = art::Thread::Current(); in SuspendThread()
943 art::ScopedObjectAccess soa(self); in SuspendThread()
944 art::MutexLock mu(self, *art::Locks::thread_list_lock_); in SuspendThread()
945 art::Thread* target = nullptr; in SuspendThread()
965 art::Thread* self = art::Thread::Current(); in ResumeThread()
966 art::Thread* target; in ResumeThread()
974 art::ScopedObjectAccess soa(self); in ResumeThread()
975 art::MutexLock tll_mu(self, *art::Locks::thread_list_lock_); in ResumeThread()
988 art::MutexLock thread_suspend_count_mu(self, *art::Locks::thread_suspend_count_lock_); in ResumeThread()
997 if (!art::Runtime::Current()->GetThreadList()->Resume(target, in ResumeThread()
998 art::SuspendReason::kForUserCode)) { in ResumeThread()
1011 art::Thread* self = art::Thread::Current(); in IsCurrentThread()
1012 art::ScopedObjectAccess soa(self); in IsCurrentThread()
1013 art::MutexLock mu(self, *art::Locks::thread_list_lock_); in IsCurrentThread()
1014 art::Thread* target = nullptr; in IsCurrentThread()
1081 art::Thread* self = art::Thread::Current(); in StopThread()
1082 art::ScopedObjectAccess soa(self); in StopThread()
1083 art::StackHandleScope<1> hs(self); in StopThread()
1087 art::ObjPtr<art::mirror::Object> obj(soa.Decode<art::mirror::Object>(exception)); in StopThread()
1091 art::Handle<art::mirror::Throwable> exc(hs.NewHandle(obj->AsThrowable())); in StopThread()
1092 art::Locks::thread_list_lock_->ExclusiveLock(self); in StopThread()
1093 art::Thread* target = nullptr; in StopThread()
1096 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in StopThread()
1098 } else if (target->GetState() == art::ThreadState::kStarting || target->IsStillStarting()) { in StopThread()
1099 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in StopThread()
1102 struct StopThreadClosure : public art::Closure { in StopThread()
1104 explicit StopThreadClosure(art::Handle<art::mirror::Throwable> except) : exception_(except) { } in StopThread()
1106 void Run(art::Thread* me) override REQUIRES_SHARED(art::Locks::mutator_lock_) { in StopThread()
1115 art::Handle<art::mirror::Throwable> exception_; in StopThread()
1128 art::Thread* self = art::Thread::Current(); in InterruptThread()
1129 art::ScopedObjectAccess soa(self); in InterruptThread()
1130 art::MutexLock tll_mu(self, *art::Locks::thread_list_lock_); in InterruptThread()
1131 art::Thread* target = nullptr; in InterruptThread()
1135 } else if (target->GetState() == art::ThreadState::kStarting || target->IsStillStarting()) { in InterruptThread()