Lines Matching refs:art

90 struct GetStackTraceVisitor : public art::StackVisitor {
91 GetStackTraceVisitor(art::Thread* thread_in, in GetStackTraceVisitor()
102 bool VisitFrame() override REQUIRES_SHARED(art::Locks::mutator_lock_) { in VisitFrame()
103 art::ArtMethod* m = GetMethod(); in VisitFrame()
109 m = m->GetInterfaceMethodIfProxy(art::kRuntimePointerSize); in VisitFrame()
110 jmethodID id = art::jni::EncodeArtMethod(m); in VisitFrame()
113 jlong dex_location = (dex_pc == art::dex::kDexNoIndex) ? -1 : static_cast<jlong>(dex_pc); in VisitFrame()
135 art::ShadowFrame* FindFrameAtDepthVisitor::GetOrCreateShadowFrame(bool* created_frame) { in GetOrCreateShadowFrame()
136 art::ShadowFrame* cur = GetCurrentShadowFrame(); in GetOrCreateShadowFrame()
139 art::ArtMethod* method = GetMethod(); in GetOrCreateShadowFrame()
153 GetStackTraceVisitor<FrameFn> MakeStackTraceVisitor(art::Thread* thread_in, in MakeStackTraceVisitor()
160 struct GetStackTraceVectorClosure : public art::Closure {
168 void Run(art::Thread* self) override REQUIRES_SHARED(art::Locks::mutator_lock_) { in Run()
225 struct GetStackTraceDirectClosure : public art::Closure {
235 void Run(art::Thread* self) override REQUIRES_SHARED(art::Locks::mutator_lock_) { in Run()
260 art::ScopedObjectAccess soa(art::Thread::Current()); in GetStackTrace()
261 art::Locks::thread_list_lock_->ExclusiveLock(soa.Self()); in GetStackTrace()
263 art::Thread* thread; in GetStackTrace()
266 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetStackTrace()
271 art::ThreadState state = thread->GetState(); in GetStackTrace()
272 if (state == art::ThreadState::kStarting || thread->IsStillStarting()) { in GetStackTrace()
273 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetStackTrace()
278 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetStackTrace()
282 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetStackTrace()
287 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetStackTrace()
325 struct GetAllStackTracesVectorClosure : public art::Closure {
329 void Run(art::Thread* thread) override in Run()
330 REQUIRES_SHARED(art::Locks::mutator_lock_) in Run()
332 art::Thread* self = art::Thread::Current(); in Run()
337 void Work(art::Thread* thread, art::Thread* self) in Work()
338 REQUIRES_SHARED(art::Locks::mutator_lock_) in Work()
358 art::Barrier barrier;
365 REQUIRES_SHARED(art::Locks::mutator_lock_) { in RunCheckpointAndWait()
368 size_t barrier_count = art::Runtime::Current()->GetThreadList()->RunCheckpoint(&closure, nullptr); in RunCheckpointAndWait()
372 art::Thread* self = art::Thread::Current(); in RunCheckpointAndWait()
373 art::ScopedThreadStateChange tsc(self, art::ThreadState::kWaitingForCheckPointsToRun); in RunCheckpointAndWait()
389 AllStackTracesData() : mutex("GetAllStackTraces", art::LockLevel::kAbortLock) {} in GetAllStackTraces()
391 JNIEnv* jni_env = art::Thread::Current()->GetJniEnv(); in GetAllStackTraces()
397 std::vector<jvmtiFrameInfo>* GetFrameStorageFor(art::Thread* self, art::Thread* thread) in GetAllStackTraces()
398 REQUIRES_SHARED(art::Locks::mutator_lock_) in GetAllStackTraces()
400 art::MutexLock mu(self, mutex); in GetAllStackTraces()
404 jthread peer = art::Runtime::Current()->GetJavaVM()->AddGlobalRef( in GetAllStackTraces()
412 art::Mutex mutex; in GetAllStackTraces()
416 std::vector<art::Thread*> threads; in GetAllStackTraces()
424 art::Thread* current = art::Thread::Current(); in GetAllStackTraces()
426 art::ScopedObjectAccess soa(current); in GetAllStackTraces()
476 size_t rounded_stack_info_size = art::RoundUp(sizeof(jvmtiStackInfo) * data.frames.size(), in GetAllStackTraces()
534 art::Thread* current = art::Thread::Current(); in GetThreadListStackTraces()
535 art::ScopedObjectAccess soa(current); // Now we know we have the shared lock. in GetThreadListStackTraces()
538 SelectStackTracesData() : mutex("GetSelectStackTraces", art::LockLevel::kAbortLock) {} in GetThreadListStackTraces()
540 std::vector<jvmtiFrameInfo>* GetFrameStorageFor(art::Thread* self, art::Thread* thread) in GetThreadListStackTraces()
541 REQUIRES_SHARED(art::Locks::mutator_lock_) in GetThreadListStackTraces()
543 art::ObjPtr<art::mirror::Object> peer = thread->GetPeerFromOtherThread(); in GetThreadListStackTraces()
547 art::MutexLock mu(self, mutex); in GetThreadListStackTraces()
559 art::Mutex mutex; in GetThreadListStackTraces()
563 std::vector<art::Handle<art::mirror::Object>> handles; in GetThreadListStackTraces()
567 std::vector<art::Thread*> threads; in GetThreadListStackTraces()
576 art::VariableSizedHandleScope hs(current); in GetThreadListStackTraces()
581 if (!soa.Env()->IsInstanceOf(thread_list[i], art::WellKnownClasses::java_lang_Thread)) { in GetThreadListStackTraces()
584 data.handles.push_back(hs.NewHandle(soa.Decode<art::mirror::Object>(thread_list[i]))); in GetThreadListStackTraces()
604 art::Thread* self = data.threads[index]; in GetThreadListStackTraces()
639 size_t rounded_stack_info_size = art::RoundUp(sizeof(jvmtiStackInfo) * thread_count, in GetThreadListStackTraces()
660 art::ObjPtr<art::mirror::Object> peer = soa.Decode<art::mirror::Object>(thread_list[i]); in GetThreadListStackTraces()
661 art::ObjPtr<art::mirror::Class> klass = peer->GetClass(); in GetThreadListStackTraces()
662 art::ArtField* started_field = klass->FindDeclaredInstanceField("started", "Z"); in GetThreadListStackTraces()
697 struct GetFrameCountClosure : public art::Closure {
701 void Run(art::Thread* self) override REQUIRES_SHARED(art::Locks::mutator_lock_) { in Run()
704 art::StackVisitor::WalkStack( in Run()
705 [&](const art::StackVisitor* stack_visitor) REQUIRES_SHARED(art::Locks::mutator_lock_) { in Run()
706 art::ArtMethod* m = stack_visitor->GetMethod(); in Run()
714 art::StackVisitor::StackWalkKind::kIncludeInlinedFrames); in Run()
725 art::ScopedObjectAccess soa(art::Thread::Current()); in GetFrameCount()
726 art::Locks::thread_list_lock_->ExclusiveLock(soa.Self()); in GetFrameCount()
728 art::Thread* thread; in GetFrameCount()
731 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetFrameCount()
736 art::ThreadState state = thread->GetState(); in GetFrameCount()
737 if (state == art::ThreadState::kStarting || thread->IsStillStarting()) { in GetFrameCount()
738 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetFrameCount()
743 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetFrameCount()
757 struct GetLocationClosure : public art::Closure {
761 void Run(art::Thread* self) override REQUIRES_SHARED(art::Locks::mutator_lock_) { in Run()
764 art::StackVisitor::WalkStack( in Run()
765 [&](const art::StackVisitor* stack_visitor) REQUIRES_SHARED(art::Locks::mutator_lock_) { in Run()
766 art::ArtMethod* m = stack_visitor->GetMethod(); in Run()
780 art::StackVisitor::StackWalkKind::kIncludeInlinedFrames); in Run()
784 art::ArtMethod* method;
795 art::ScopedObjectAccess soa(art::Thread::Current()); in GetFrameLocation()
796 art::Locks::thread_list_lock_->ExclusiveLock(soa.Self()); in GetFrameLocation()
798 art::Thread* thread; in GetFrameLocation()
801 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetFrameLocation()
806 art::ThreadState state = thread->GetState(); in GetFrameLocation()
807 if (state == art::ThreadState::kStarting || thread->IsStillStarting()) { in GetFrameLocation()
808 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetFrameLocation()
813 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetFrameLocation()
817 art::Locks::thread_list_lock_->ExclusiveUnlock(soa.Self()); in GetFrameLocation()
831 *method_ptr = art::jni::EncodeArtMethod(closure.method); in GetFrameLocation()
835 if (closure.dex_pc == art::dex::kDexNoIndex) { in GetFrameLocation()
844 struct MonitorVisitor : public art::StackVisitor, public art::SingleRootVisitor {
846 explicit MonitorVisitor(art::Thread* thread)
847 REQUIRES_SHARED(art::Locks::mutator_lock_) in REQUIRES_SHARED()
848 : art::StackVisitor(thread, in REQUIRES_SHARED()
849 art::Context::Create(), in REQUIRES_SHARED()
850 art::StackVisitor::StackWalkKind::kIncludeInlinedFrames), in REQUIRES_SHARED()
851 hs(art::Thread::Current()), in REQUIRES_SHARED()
858 bool VisitFrame() override REQUIRES_SHARED(art::Locks::mutator_lock_) { in VisitFrame()
859 art::Locks::mutator_lock_->AssertSharedHeld(art::Thread::Current()); in VisitFrame()
861 art::Monitor::VisitLocks(this, AppendOwnedMonitors, this); in VisitFrame()
867 static void AppendOwnedMonitors(art::ObjPtr<art::mirror::Object> owned_monitor, void* arg) in AppendOwnedMonitors()
868 REQUIRES_SHARED(art::Locks::mutator_lock_) { in AppendOwnedMonitors()
869 art::Locks::mutator_lock_->AssertSharedHeld(art::Thread::Current()); in AppendOwnedMonitors()
872 for (const art::Handle<art::mirror::Object>& monitor : visitor->monitors) { in AppendOwnedMonitors()
881 void VisitRoot(art::mirror::Object* obj, const art::RootInfo& info ATTRIBUTE_UNUSED) in VisitRoot()
882 override REQUIRES_SHARED(art::Locks::mutator_lock_) { in VisitRoot()
883 for (const art::Handle<art::mirror::Object>& m : monitors) { in VisitRoot()
892 art::VariableSizedHandleScope hs;
894 std::vector<art::Handle<art::mirror::Object>> monitors;
899 struct MonitorInfoClosure : public art::Closure {
904 void Run(art::Thread* target) override REQUIRES_SHARED(art::Locks::mutator_lock_) { in Run()
905 art::Locks::mutator_lock_->AssertSharedHeld(art::Thread::Current()); in Run()
910 art::RootInfo root_info(art::kRootVMInternal); in Run()
926 static jvmtiError GetOwnedMonitorInfoCommon(const art::ScopedObjectAccessAlreadyRunnable& soa, in GetOwnedMonitorInfoCommon()
929 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOwnedMonitorInfoCommon()
930 art::Thread* self = art::Thread::Current(); in GetOwnedMonitorInfoCommon()
934 art::Locks::thread_list_lock_->ExclusiveLock(self); in GetOwnedMonitorInfoCommon()
935 art::Thread* target = nullptr; in GetOwnedMonitorInfoCommon()
938 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in GetOwnedMonitorInfoCommon()
945 art::ScopedAssertNoThreadSuspension sants("Getting owned monitor usage"); in GetOwnedMonitorInfoCommon()
946 if (!target->RequestSynchronousCheckpoint(&closure, art::ThreadState::kRunnable)) { in GetOwnedMonitorInfoCommon()
950 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in GetOwnedMonitorInfoCommon()
970 art::ScopedObjectAccess soa(art::Thread::Current()); in GetOwnedMonitorStackDepthInfo()
971 std::vector<art::GcRoot<art::mirror::Object>> mons; in GetOwnedMonitorStackDepthInfo()
973 auto handle_fun = [&] (MonitorVisitor& visitor) REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOwnedMonitorStackDepthInfo()
975 mons.push_back(art::GcRoot<art::mirror::Object>(visitor.monitors[i].Get())); in GetOwnedMonitorStackDepthInfo()
1006 art::ScopedObjectAccess soa(art::Thread::Current()); in GetOwnedMonitorInfo()
1007 std::vector<art::GcRoot<art::mirror::Object>> mons; in GetOwnedMonitorInfo()
1008 auto handle_fun = [&] (MonitorVisitor& visitor) REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOwnedMonitorInfo()
1010 mons.push_back(art::GcRoot<art::mirror::Object>(visitor.monitors[i].Get())); in GetOwnedMonitorInfo()
1035 art::Thread* self = art::Thread::Current(); in NotifyFramePop()
1036 art::Thread* target; in NotifyFramePop()
1042 art::ScopedObjectAccess soa(self); in NotifyFramePop()
1043 art::Locks::thread_list_lock_->ExclusiveLock(self); in NotifyFramePop()
1046 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in NotifyFramePop()
1052 art::Locks::thread_suspend_count_lock_->ExclusiveLock(self); in NotifyFramePop()
1054 art::Locks::thread_suspend_count_lock_->ExclusiveUnlock(self); in NotifyFramePop()
1055 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in NotifyFramePop()
1058 art::Locks::thread_suspend_count_lock_->ExclusiveUnlock(self); in NotifyFramePop()
1066 std::unique_ptr<art::Context> context(art::Context::Create()); in NotifyFramePop()
1070 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in NotifyFramePop()
1073 art::ArtMethod* method = visitor.GetMethod(); in NotifyFramePop()
1075 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in NotifyFramePop()
1081 art::ShadowFrame* shadow_frame = in NotifyFramePop()
1084 art::WriterMutexLock lk(self, tienv->event_info_mutex_); in NotifyFramePop()
1097 art::FunctionClosure fc([](art::Thread* self) REQUIRES_SHARED(art::Locks::mutator_lock_) { in NotifyFramePop()
1102 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in NotifyFramePop()
1117 NonStandardExitFrames(art::Thread* self, jvmtiEnv* env, jthread thread) in NonStandardExitFrames()
1118 REQUIRES(!art::Locks::thread_suspend_count_lock_) in NonStandardExitFrames()
1119 ACQUIRE_SHARED(art::Locks::mutator_lock_) in NonStandardExitFrames()
1120 ACQUIRE(art::Locks::thread_list_lock_, art::Locks::user_code_suspension_lock_) in NonStandardExitFrames()
1123 art::Locks::user_code_suspension_lock_->AssertExclusiveHeld(self); in NonStandardExitFrames()
1129 art::ScopedObjectAccessUnchecked soau(self); in NonStandardExitFrames()
1131 art::Locks::thread_list_lock_->ExclusiveLock(self); in NonStandardExitFrames()
1137 art::MutexLock tscl_mu(self, *art::Locks::thread_suspend_count_lock_); in NonStandardExitFrames()
1145 constexpr art::StackVisitor::StackWalkKind kWalkKind = in NonStandardExitFrames()
1146 art::StackVisitor::StackWalkKind::kIncludeInlinedFrames; in NonStandardExitFrames()
1150 art::StackVisitor::ComputeNumFrames(target_, kWalkKind)) { in NonStandardExitFrames()
1160 std::unique_ptr<art::Context> context(art::Context::Create()); in NonStandardExitFrames()
1173 art::ArtMethod* called_method = final_frame.GetMethod(); in NonStandardExitFrames()
1174 art::ArtMethod* calling_method = penultimate_frame.GetMethod(); in NonStandardExitFrames()
1196 bool CheckFunctions(jvmtiEnv* env, art::ArtMethod* calling, art::ArtMethod* called)
1197 REQUIRES(art::Locks::thread_list_lock_, art::Locks::user_code_suspension_lock_)
1198 REQUIRES_SHARED(art::Locks::mutator_lock_);
1200 ~NonStandardExitFrames() RELEASE_SHARED(art::Locks::mutator_lock_) in RELEASE_SHARED()
1201 REQUIRES(!art::Locks::thread_list_lock_) in RELEASE_SHARED()
1202 RELEASE(art::Locks::user_code_suspension_lock_) { in RELEASE_SHARED()
1203 art::Thread* self = art::Thread::Current(); in RELEASE_SHARED()
1204 DCHECK_EQ(old_state_, art::ThreadState::kNative) in RELEASE_SHARED()
1210 art::ShadowFrame* final_frame_ GUARDED_BY(art::Locks::user_code_suspension_lock_) = nullptr;
1211 art::ShadowFrame* penultimate_frame_ GUARDED_BY(art::Locks::user_code_suspension_lock_) = nullptr;
1212 bool created_final_frame_ GUARDED_BY(art::Locks::user_code_suspension_lock_) = false;
1213 bool created_penultimate_frame_ GUARDED_BY(art::Locks::user_code_suspension_lock_) = false;
1214 uint32_t final_frame_id_ GUARDED_BY(art::Locks::user_code_suspension_lock_) = -1;
1215 uint32_t penultimate_frame_id_ GUARDED_BY(art::Locks::user_code_suspension_lock_) = -1;
1216 art::Thread* target_ GUARDED_BY(art::Locks::thread_list_lock_) = nullptr;
1217 art::ThreadState old_state_ = art::ThreadState::kTerminated;
1223 jvmtiEnv* env, art::ArtMethod* calling ATTRIBUTE_UNUSED, art::ArtMethod* called) { in CheckFunctions()
1236 jvmtiEnv* env, art::ArtMethod* calling, art::ArtMethod* called) { in CheckFunctions()
1249 SetupMethodExitEvents(art::Thread* self, in SetupMethodExitEvents()
1251 jthread target) REQUIRES(!art::Locks::mutator_lock_, in SetupMethodExitEvents()
1252 !art::Locks::user_code_suspension_lock_, in SetupMethodExitEvents()
1253 !art::Locks::thread_list_lock_) in SetupMethodExitEvents()
1256 art::Locks::mutator_lock_->AssertNotHeld(self_); in SetupMethodExitEvents()
1257 art::Locks::user_code_suspension_lock_->AssertNotHeld(self_); in SetupMethodExitEvents()
1258 art::Locks::thread_list_lock_->AssertNotHeld(self_); in SetupMethodExitEvents()
1263 ~SetupMethodExitEvents() REQUIRES(!art::Locks::mutator_lock_,
1264 !art::Locks::user_code_suspension_lock_,
1265 !art::Locks::thread_list_lock_) {
1266 art::Locks::mutator_lock_->AssertNotHeld(self_);
1267 art::Locks::user_code_suspension_lock_->AssertNotHeld(self_);
1268 art::Locks::thread_list_lock_->AssertNotHeld(self_);
1280 art::Thread* self_;
1287 void AddDelayedMethodExitEvent(EventHandler* handler, art::ShadowFrame* frame, T value)
1288 REQUIRES_SHARED(art::Locks::mutator_lock_)
1289 REQUIRES(art::Locks::user_code_suspension_lock_, art::Locks::thread_list_lock_);
1292 void AddDelayedMethodExitEvent(EventHandler* handler, art::ShadowFrame* frame, T value) { in AddDelayedMethodExitEvent()
1293 art::JValue val = art::JValue::FromPrimitive(value); in AddDelayedMethodExitEvent()
1300 art::ShadowFrame* frame, in AddDelayedMethodExitEvent()
1309 art::ShadowFrame* frame, in AddDelayedMethodExitEvent()
1311 jvalue jval{ .l = art::Thread::Current()->GetJniEnv()->NewGlobalRef(obj) }; in AddDelayedMethodExitEvent()
1316 bool ValidReturnType(art::Thread* self, art::ObjPtr<art::mirror::Class> return_type, T value)
1317 REQUIRES_SHARED(art::Locks::mutator_lock_)
1318 REQUIRES(art::Locks::user_code_suspension_lock_, art::Locks::thread_list_lock_);
1322 bool ValidReturnType<type>(art::Thread * self ATTRIBUTE_UNUSED, \
1323 art::ObjPtr<art::mirror::Class> return_type, \
1325 static constexpr std::initializer_list<art::Primitive::Type> types{ __VA_ARGS__ }; \
1329 SIMPLE_VALID_RETURN_TYPE(jlong, art::Primitive::kPrimLong);
1330 SIMPLE_VALID_RETURN_TYPE(jfloat, art::Primitive::kPrimFloat);
1331 SIMPLE_VALID_RETURN_TYPE(jdouble, art::Primitive::kPrimDouble);
1332 SIMPLE_VALID_RETURN_TYPE(nullptr_t, art::Primitive::kPrimVoid);
1334 art::Primitive::kPrimInt,
1335 art::Primitive::kPrimChar,
1336 art::Primitive::kPrimBoolean,
1337 art::Primitive::kPrimShort,
1338 art::Primitive::kPrimByte);
1342 bool ValidReturnType<jobject>(art::Thread* self, in ValidReturnType()
1343 art::ObjPtr<art::mirror::Class> return_type, in ValidReturnType()
1358 art::Thread* self = art::Thread::Current(); in PopFrame()
1361 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in PopFrame()
1369 art::FunctionClosure fc([](art::Thread* self) REQUIRES_SHARED(art::Locks::mutator_lock_){ in PopFrame()
1374 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in PopFrame()
1382 art::Thread* self = art::Thread::Current(); in ForceEarlyReturn()
1388 art::ScopedObjectAccess soa(self); in ForceEarlyReturn()
1398 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in ForceEarlyReturn()
1403 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in ForceEarlyReturn()
1411 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in ForceEarlyReturn()
1418 art::FunctionClosure fc([](art::Thread* self) REQUIRES_SHARED(art::Locks::mutator_lock_){ in ForceEarlyReturn()
1423 art::Locks::thread_list_lock_->ExclusiveUnlock(self); in ForceEarlyReturn()