Lines Matching refs:self

165   Thread* self = Thread::Current();  in ThrowNoClassDefFoundError()  local
166 self->ThrowNewExceptionV("Ljava/lang/NoClassDefFoundError;", fmt, args); in ThrowNoClassDefFoundError()
170 static bool HasInitWithString(Thread* self, ClassLinker* class_linker, const char* descriptor) in HasInitWithString() argument
172 ArtMethod* method = self->GetCurrentMethod(nullptr); in HasInitWithString()
173 StackHandleScope<1> hs(self); in HasInitWithString()
176 ObjPtr<mirror::Class> exception_class = class_linker->FindClass(self, descriptor, class_loader); in HasInitWithString()
180 CHECK(self->IsExceptionPending()); in HasInitWithString()
181 self->ClearException(); in HasInitWithString()
201 static void HandleEarlierVerifyError(Thread* self, in HandleEarlierVerifyError() argument
207 self->AssertNoPendingException(); in HandleEarlierVerifyError()
215 if (HasInitWithString(self, class_linker, descriptor)) { in HandleEarlierVerifyError()
216 self->ThrowNewException(descriptor, c->PrettyDescriptor().c_str()); in HandleEarlierVerifyError()
218 self->ThrowNewException(descriptor, nullptr); in HandleEarlierVerifyError()
225 self->SetException(obj->AsThrowable()); in HandleEarlierVerifyError()
227 self->AssertPendingException(); in HandleEarlierVerifyError()
289 void AddClass(Thread* self, ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_) { in AddClass() argument
292 classes_[num_classes_] = self->GetJniEnv()->GetVm()->AddWeakGlobalRef(self, klass); in AddClass()
307 void MakeVisible(Thread* self) { in MakeVisible() argument
310 AdjustThreadVisibilityCounter(self, count); in MakeVisible()
313 void Run(Thread* self) override { in Run() argument
314 self->ClearMakeVisiblyInitializedCounter(); in Run()
315 AdjustThreadVisibilityCounter(self, -1); in Run()
319 void AdjustThreadVisibilityCounter(Thread* self, ssize_t adjustment) { in AdjustThreadVisibilityCounter() argument
324 ScopedObjectAccess soa(self); in AdjustThreadVisibilityCounter()
325 StackHandleScope<1u> hs(self); in AdjustThreadVisibilityCounter()
327 JavaVMExt* vm = self->GetJniEnv()->GetVm(); in AdjustThreadVisibilityCounter()
329 klass.Assign(ObjPtr<mirror::Class>::DownCast(self->DecodeJObject(classes_[i]))); in AdjustThreadVisibilityCounter()
330 vm->DeleteWeakGlobalRef(self, classes_[i]); in AdjustThreadVisibilityCounter()
332 mirror::Class::SetStatus(klass, ClassStatus::kVisiblyInitialized, self); in AdjustThreadVisibilityCounter()
333 class_linker_->FixupStaticTrampolines(self, klass.Get()); in AdjustThreadVisibilityCounter()
338 class_linker_->VisiblyInitializedCallbackDone(self, this); in AdjustThreadVisibilityCounter()
359 void ClassLinker::MakeInitializedClassesVisiblyInitialized(Thread* self, bool wait) { in MakeInitializedClassesVisiblyInitialized() argument
370 MutexLock lock(self, visibly_initialized_callback_lock_); in MakeInitializedClassesVisiblyInitialized()
385 callback->MakeVisible(self); in MakeInitializedClassesVisiblyInitialized()
389 maybe_barrier->Increment(self, wait_count); in MakeInitializedClassesVisiblyInitialized()
393 void ClassLinker::VisiblyInitializedCallbackDone(Thread* self, in VisiblyInitializedCallbackDone() argument
395 MutexLock lock(self, visibly_initialized_callback_lock_); in VisiblyInitializedCallbackDone()
398 barrier->Pass(self); in VisiblyInitializedCallbackDone()
418 void ClassLinker::ForceClassInitialized(Thread* self, Handle<mirror::Class> klass) { in ForceClassInitialized() argument
419 ClassLinker::VisiblyInitializedCallback* cb = MarkClassInitialized(self, klass); in ForceClassInitialized()
421 cb->MakeVisible(self); in ForceClassInitialized()
423 ScopedThreadSuspension sts(self, ThreadState::kSuspended); in ForceClassInitialized()
424 MakeInitializedClassesVisiblyInitialized(self, /*wait=*/true); in ForceClassInitialized()
428 Thread* self, Handle<mirror::Class> klass) { in MarkClassInitialized() argument
432 mirror::Class::SetStatus(klass, ClassStatus::kVisiblyInitialized, self); in MarkClassInitialized()
433 FixupStaticTrampolines(self, klass.Get()); in MarkClassInitialized()
439 mirror::Class::SetStatus(klass, ClassStatus::kVisiblyInitialized, self); in MarkClassInitialized()
440 FixupStaticTrampolines(self, klass.Get()); in MarkClassInitialized()
443 mirror::Class::SetStatus(klass, ClassStatus::kInitialized, self); in MarkClassInitialized()
444 MutexLock lock(self, visibly_initialized_callback_lock_); in MarkClassInitialized()
449 visibly_initialized_callback_->AddClass(self, klass.Get()); in MarkClassInitialized()
461 Thread* self, ArtMethod* method, const void* native_method) { in RegisterNative() argument
470 MutexLock lock(self, critical_native_code_with_clinit_check_lock_); in RegisterNative()
489 void ClassLinker::UnregisterNative(Thread* self, ArtMethod* method) { in UnregisterNative() argument
493 MutexLock lock(self, critical_native_code_with_clinit_check_lock_); in UnregisterNative()
504 const void* ClassLinker::GetRegisteredNative(Thread* self, ArtMethod* method) { in GetRegisteredNative() argument
506 MutexLock lock(self, critical_native_code_with_clinit_check_lock_); in GetRegisteredNative()
544 Thread* self = Thread::Current(); in ThrowEarlierClassFailure() local
548 self->SetException(pre_allocated); in ThrowEarlierClassFailure()
553 HandleEarlierVerifyError(self, this, c); in ThrowEarlierClassFailure()
562 self->ThrowNewWrappedException("Ljava/lang/NoClassDefFoundError;", in ThrowEarlierClassFailure()
579 Thread* self = Thread::Current(); in WrapExceptionInInitializer() local
580 JNIEnv* env = self->GetJniEnv(); in WrapExceptionInInitializer()
595 << self->GetException()->Dump(); in WrapExceptionInInitializer()
604 self->ThrowNewWrappedException("Ljava/lang/ExceptionInInitializerError;", nullptr); in WrapExceptionInInitializer()
719 void ClassLinker::CheckSystemClass(Thread* self, Handle<mirror::Class> c1, const char* descriptor) { in CheckSystemClass() argument
720 ObjPtr<mirror::Class> c2 = FindSystemClass(self, descriptor); in CheckSystemClass()
741 Thread* const self = Thread::Current(); in InitWithoutImage() local
753 heap->IncrementDisableMovingGC(self); in InitWithoutImage()
754 StackHandleScope<64> hs(self); // 64 is picked arbitrarily. in InitWithoutImage()
759 heap->AllocNonMovableObject(self, nullptr, class_class_size, VoidFunctor())))); in InitWithoutImage()
768 heap->DecrementDisableMovingGC(self); in InitWithoutImage()
774 AllocClass(self, java_lang_Class.Get(), class_array_class_size))); in InitWithoutImage()
779 AllocClass(self, java_lang_Class.Get(), mirror::Object::ClassSize(image_pointer_size_)))); in InitWithoutImage()
783 mirror::Class::SetStatus(java_lang_Object, ClassStatus::kLoaded, self); in InitWithoutImage()
788 runtime->SetSentinel(heap->AllocNonMovableObject(self, in InitWithoutImage()
806 AllocClass(self, java_lang_Class.Get(), in InitWithoutImage()
820 self, java_lang_Class.Get(), mirror::String::ClassSize(image_pointer_size_)))); in InitWithoutImage()
822 mirror::Class::SetStatus(java_lang_String, ClassStatus::kResolved, self); in InitWithoutImage()
826 AllocClass(self, java_lang_Class.Get(), mirror::Reference::ClassSize(image_pointer_size_)))); in InitWithoutImage()
828 mirror::Class::SetStatus(java_lang_ref_Reference, ClassStatus::kResolved, self); in InitWithoutImage()
832 mirror::ObjectArray<mirror::Class>::Alloc(self, in InitWithoutImage()
844 java_lang_Object->SetIfTable(AllocIfTable(self, 0)); in InitWithoutImage()
847 object_array_class->SetIfTable(AllocIfTable(self, 2)); in InitWithoutImage()
851 CreatePrimitiveClass(self, Primitive::kPrimBoolean, ClassRoot::kPrimitiveBoolean); in InitWithoutImage()
852 CreatePrimitiveClass(self, Primitive::kPrimByte, ClassRoot::kPrimitiveByte); in InitWithoutImage()
853 CreatePrimitiveClass(self, Primitive::kPrimChar, ClassRoot::kPrimitiveChar); in InitWithoutImage()
854 CreatePrimitiveClass(self, Primitive::kPrimShort, ClassRoot::kPrimitiveShort); in InitWithoutImage()
855 CreatePrimitiveClass(self, Primitive::kPrimInt, ClassRoot::kPrimitiveInt); in InitWithoutImage()
856 CreatePrimitiveClass(self, Primitive::kPrimLong, ClassRoot::kPrimitiveLong); in InitWithoutImage()
857 CreatePrimitiveClass(self, Primitive::kPrimFloat, ClassRoot::kPrimitiveFloat); in InitWithoutImage()
858 CreatePrimitiveClass(self, Primitive::kPrimDouble, ClassRoot::kPrimitiveDouble); in InitWithoutImage()
859 CreatePrimitiveClass(self, Primitive::kPrimVoid, ClassRoot::kPrimitiveVoid); in InitWithoutImage()
864 AllocPrimitiveArrayClass(self, ClassRoot::kPrimitiveBoolean, ClassRoot::kBooleanArrayClass); in InitWithoutImage()
865 AllocPrimitiveArrayClass(self, ClassRoot::kPrimitiveByte, ClassRoot::kByteArrayClass); in InitWithoutImage()
866 AllocPrimitiveArrayClass(self, ClassRoot::kPrimitiveChar, ClassRoot::kCharArrayClass); in InitWithoutImage()
867 AllocPrimitiveArrayClass(self, ClassRoot::kPrimitiveShort, ClassRoot::kShortArrayClass); in InitWithoutImage()
868 AllocPrimitiveArrayClass(self, ClassRoot::kPrimitiveInt, ClassRoot::kIntArrayClass); in InitWithoutImage()
869 AllocPrimitiveArrayClass(self, ClassRoot::kPrimitiveLong, ClassRoot::kLongArrayClass); in InitWithoutImage()
870 AllocPrimitiveArrayClass(self, ClassRoot::kPrimitiveFloat, ClassRoot::kFloatArrayClass); in InitWithoutImage()
871 AllocPrimitiveArrayClass(self, ClassRoot::kPrimitiveDouble, ClassRoot::kDoubleArrayClass); in InitWithoutImage()
877 AllocClass(self, java_lang_Class.Get(), mirror::DexCache::ClassSize(image_pointer_size_)))); in InitWithoutImage()
881 mirror::Class::SetStatus(java_lang_DexCache, ClassStatus::kResolved, self); in InitWithoutImage()
886 AllocClass(self, java_lang_Class.Get(), mirror::ClassExt::ClassSize(image_pointer_size_)))); in InitWithoutImage()
888 mirror::Class::SetStatus(dalvik_system_ClassExt, ClassStatus::kResolved, self); in InitWithoutImage()
892 AllocClass(self, java_lang_Class.Get(), in InitWithoutImage()
915 AppendToBootClassPath(self, dex_file.get()); in InitWithoutImage()
935 mirror::Class::SetStatus(java_lang_Object, ClassStatus::kNotReady, self); in InitWithoutImage()
936 CheckSystemClass(self, java_lang_Object, "Ljava/lang/Object;"); in InitWithoutImage()
938 mirror::Class::SetStatus(java_lang_String, ClassStatus::kNotReady, self); in InitWithoutImage()
939 CheckSystemClass(self, java_lang_String, "Ljava/lang/String;"); in InitWithoutImage()
940 mirror::Class::SetStatus(java_lang_DexCache, ClassStatus::kNotReady, self); in InitWithoutImage()
941 CheckSystemClass(self, java_lang_DexCache, "Ljava/lang/DexCache;"); in InitWithoutImage()
943 mirror::Class::SetStatus(dalvik_system_ClassExt, ClassStatus::kNotReady, self); in InitWithoutImage()
944 CheckSystemClass(self, dalvik_system_ClassExt, "Ldalvik/system/ClassExt;"); in InitWithoutImage()
949 CheckSystemClass(self, java_lang_Class, "Ljava/lang/Class;"); in InitWithoutImage()
966 auto java_lang_Cloneable = hs.NewHandle(FindSystemClass(self, "Ljava/lang/Cloneable;")); in InitWithoutImage()
968 auto java_io_Serializable = hs.NewHandle(FindSystemClass(self, "Ljava/io/Serializable;")); in InitWithoutImage()
977 mirror::Class::GetDirectInterface(self, class_array_class.Get(), 0)); in InitWithoutImage()
979 mirror::Class::GetDirectInterface(self, class_array_class.Get(), 1)); in InitWithoutImage()
981 mirror::Class::GetDirectInterface(self, object_array_class.Get(), 0)); in InitWithoutImage()
983 mirror::Class::GetDirectInterface(self, object_array_class.Get(), 1)); in InitWithoutImage()
986 FindSystemClass(self, GetClassRootDescriptor(ClassRoot::kJavaLangStringArrayClass))); in InitWithoutImage()
992 FindSystemClass(self, "Ljava/lang/reflect/Proxy;")); in InitWithoutImage()
995 ObjPtr<mirror::Class> class_root = FindSystemClass(self, "Ljava/lang/reflect/Field;"); in InitWithoutImage()
1000 class_root = FindSystemClass(self, "[Ljava/lang/reflect/Field;"); in InitWithoutImage()
1005 class_root = FindSystemClass(self, "Ljava/lang/reflect/Constructor;"); in InitWithoutImage()
1008 class_root = FindSystemClass(self, "[Ljava/lang/reflect/Constructor;"); in InitWithoutImage()
1013 class_root = FindSystemClass(self, "Ljava/lang/reflect/Method;"); in InitWithoutImage()
1016 class_root = FindSystemClass(self, "[Ljava/lang/reflect/Method;"); in InitWithoutImage()
1021 class_root = FindSystemClass(self, "Ljava/lang/invoke/CallSite;"); in InitWithoutImage()
1026 class_root = FindSystemClass(self, "Ljava/lang/invoke/MethodType;"); in InitWithoutImage()
1031 class_root = FindSystemClass(self, "Ljava/lang/invoke/MethodHandleImpl;"); in InitWithoutImage()
1037 class_root = FindSystemClass(self, "Ljava/lang/invoke/MethodHandles$Lookup;"); in InitWithoutImage()
1042 class_root = FindSystemClass(self, "Ljava/lang/invoke/VarHandle;"); in InitWithoutImage()
1047 class_root = FindSystemClass(self, "Ljava/lang/invoke/FieldVarHandle;"); in InitWithoutImage()
1052 class_root = FindSystemClass(self, "Ljava/lang/invoke/ArrayElementVarHandle;"); in InitWithoutImage()
1057 class_root = FindSystemClass(self, "Ljava/lang/invoke/ByteArrayViewVarHandle;"); in InitWithoutImage()
1062 class_root = FindSystemClass(self, "Ljava/lang/invoke/ByteBufferViewVarHandle;"); in InitWithoutImage()
1066 class_root = FindSystemClass(self, "Ldalvik/system/EmulatedStackFrame;"); in InitWithoutImage()
1072 mirror::Class::SetStatus(java_lang_ref_Reference, ClassStatus::kNotReady, self); in InitWithoutImage()
1073 CheckSystemClass(self, java_lang_ref_Reference, "Ljava/lang/ref/Reference;"); in InitWithoutImage()
1077 class_root = FindSystemClass(self, "Ljava/lang/ref/FinalizerReference;"); in InitWithoutImage()
1080 class_root = FindSystemClass(self, "Ljava/lang/ref/PhantomReference;"); in InitWithoutImage()
1083 class_root = FindSystemClass(self, "Ljava/lang/ref/SoftReference;"); in InitWithoutImage()
1086 class_root = FindSystemClass(self, "Ljava/lang/ref/WeakReference;"); in InitWithoutImage()
1091 class_root = FindSystemClass(self, "Ljava/lang/ClassLoader;"); in InitWithoutImage()
1098 SetClassRoot(ClassRoot::kJavaLangThrowable, FindSystemClass(self, "Ljava/lang/Throwable;")); in InitWithoutImage()
1100 FindSystemClass(self, "Ljava/lang/ClassNotFoundException;")); in InitWithoutImage()
1102 FindSystemClass(self, "Ljava/lang/StackTraceElement;")); in InitWithoutImage()
1104 FindSystemClass(self, "[Ljava/lang/StackTraceElement;")); in InitWithoutImage()
1106 FindSystemClass(self, "[Ljava/lang/ClassLoader;")); in InitWithoutImage()
1111 FinishInit(self); in InitWithoutImage()
1118 static void CreateStringInitBindings(Thread* self, ClassLinker* class_linker) in CreateStringInitBindings() argument
1122 class_linker->FindSystemClass(self, "Ljava/lang/StringFactory;"); in CreateStringInitBindings()
1127 self->InitStringEntryPoints(); in CreateStringInitBindings()
1130 void ClassLinker::FinishInit(Thread* self) { in FinishInit() argument
1133 CreateStringInitBindings(self, this); in FinishInit()
1139 StackHandleScope<3> hs(self); in FinishInit()
1143 hs.NewHandle(FindSystemClass(self, "Ljava/lang/ref/FinalizerReference;")); in FinishInit()
1187 ObjPtr<mirror::Class> soe_klass = FindSystemClass(self, "Ljava/lang/StackOverflowError;"); in FinishInit()
1188 if (soe_klass == nullptr || !EnsureInitialized(self, hs.NewHandle(soe_klass), true, true)) { in FinishInit()
1191 self->ClearException(); in FinishInit()
1198 void ClassLinker::RunRootClinits(Thread* self) { in RunRootClinits() argument
1202 StackHandleScope<1> hs(self); in RunRootClinits()
1204 if (!EnsureInitialized(self, h_class, true, true)) { in RunRootClinits()
1206 << ": " << self->GetException()->Dump(); in RunRootClinits()
1229 Thread* const self = Thread::Current(); in InitFromBootImage() local
1316 ReaderMutexLock mu(self, *Locks::heap_bitmap_lock_); in InitFromBootImage()
1374 FinishInit(self); in InitFromBootImage()
1381 Thread* self, in AddExtraBootDexFiles() argument
1384 AppendToBootClassPath(self, dex_file.get()); in AddExtraBootDexFiles()
1671 Thread* const self = Thread::Current(); in Update() local
1678 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in Update()
1682 WriterMutexLock mu2(self, *Locks::dex_lock_); in Update()
1745 ReaderMutexLock rmu(self, *Locks::heap_bitmap_lock_); in Update()
2051 Thread* self = Thread::Current(); in VerifyAppImage() local
2054 CHECK(klass->GetDirectInterface(self, klass, i) != nullptr) in VerifyAppImage()
2086 Thread* const self = Thread::Current(); in AddImageSpace() local
2101 StackHandleScope<3> hs(self); in AddImageSpace()
2219 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in AddImageSpace()
2281 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in AddImageSpace()
2305 Thread* const self = Thread::Current(); in VisitClassRoots() local
2306 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in VisitClassRoots()
2339 GcRoot<mirror::Object> root(GcRoot<mirror::Object>(self->DecodeJObject(data.weak_root))); in VisitClassRoots()
2440 Thread* const self = Thread::Current(); in VisitClasses() local
2441 ReaderMutexLock mu(self, *Locks::classlinker_classes_lock_); in VisitClasses()
2443 if (self != nullptr) { in VisitClasses()
2496 Thread* const self = Thread::Current(); in VisitClassesWithoutClassesLock() local
2497 StackHandleScope<1> hs(self); in VisitClassesWithoutClassesLock()
2504 ReaderMutexLock mu(self, *Locks::classlinker_classes_lock_); in VisitClassesWithoutClassesLock()
2510 mirror::ObjectArray<mirror::Class>::Alloc(self, array_of_class, class_table_size)); in VisitClassesWithoutClassesLock()
2531 Thread* const self = Thread::Current(); in ~ClassLinker() local
2535 DeleteClassLoader(self, data, /*cleanup_cha=*/ false); in ~ClassLinker()
2545 void ClassLinker::DeleteClassLoader(Thread* self, const ClassLoaderData& data, bool cleanup_cha) { in DeleteClassLoader() argument
2548 vm->DeleteWeakGlobalRef(self, data.weak_root); in DeleteClassLoader()
2554 code_cache->RemoveMethodsIn(self, *data.allocator); in DeleteClassLoader()
2566 MutexLock lock(self, critical_native_code_with_clinit_check_lock_); in DeleteClassLoader()
2581 ObjPtr<mirror::PointerArray> ClassLinker::AllocPointerArray(Thread* self, size_t length) { in AllocPointerArray() argument
2584 ? ObjPtr<mirror::Array>(mirror::LongArray::Alloc(self, length)) in AllocPointerArray()
2585 : ObjPtr<mirror::Array>(mirror::IntArray::Alloc(self, length))); in AllocPointerArray()
2589 Thread* self, in AllocDexCache() argument
2591 StackHandleScope<1> hs(self); in AllocDexCache()
2594 GetClassRoot<mirror::DexCache>(this)->AllocObject(self)))); in AllocDexCache()
2596 self->AssertPendingOOMException(); in AllocDexCache()
2603 self->AssertPendingOOMException(); in AllocDexCache()
2610 ObjPtr<mirror::DexCache> ClassLinker::AllocAndInitializeDexCache(Thread* self, in AllocAndInitializeDexCache() argument
2614 ObjPtr<mirror::DexCache> dex_cache = AllocDexCache(&location, self, dex_file); in AllocAndInitializeDexCache()
2616 WriterMutexLock mu(self, *Locks::dex_lock_); in AllocAndInitializeDexCache()
2618 mirror::DexCache::InitializeDexCache(self, in AllocAndInitializeDexCache()
2629 ObjPtr<mirror::Class> ClassLinker::AllocClass(Thread* self, in AllocClass() argument
2636 heap->AllocObject(self, java_lang_Class, class_size, pre_fence_visitor) : in AllocClass()
2637 heap->AllocNonMovableObject(self, java_lang_Class, class_size, pre_fence_visitor); in AllocClass()
2639 self->AssertPendingOOMException(); in AllocClass()
2646 ObjPtr<mirror::Class> ClassLinker::AllocClass(Thread* self, in AllocClass() argument
2650 return AllocClass<kMovable>(self, java_lang_Class, class_size, visitor); in AllocClass()
2653 ObjPtr<mirror::Class> ClassLinker::AllocClass(Thread* self, uint32_t class_size) { in AllocClass() argument
2654 return AllocClass(self, GetClassRoot<mirror::Class>(this), class_size); in AllocClass()
2657 void ClassLinker::AllocPrimitiveArrayClass(Thread* self, in AllocPrimitiveArrayClass() argument
2667 self, GetClassRoot<mirror::Class>(this), mirror::Array::ClassSize(image_pointer_size_)); in AllocPrimitiveArrayClass()
2740 Thread* self, in AllocStackTraceElementArray() argument
2743 self, GetClassRoot<mirror::ObjectArray<mirror::StackTraceElement>>(this), length); in AllocStackTraceElementArray()
2746 ObjPtr<mirror::Class> ClassLinker::EnsureResolved(Thread* self, in EnsureResolved() argument
2751 StackHandleScope<1> hs(self); in EnsureResolved()
2763 StackHandleScope<1> hs(self); in EnsureResolved()
2765 ObjectLock<mirror::Class> lock(self, h_class); in EnsureResolved()
2776 klass = LookupClass(self, descriptor, h_class.Get()->GetClassLoader()); in EnsureResolved()
2786 StackHandleScope<1> hs(self); in EnsureResolved()
2789 ObjectTryLock<mirror::Class> lock(self, h_class); in EnsureResolved()
2794 if (!h_class->IsResolved() && h_class->GetClinitThreadId() == self->GetTid()) { in EnsureResolved()
2796 mirror::Class::SetStatus(h_class, ClassStatus::kErrorUnresolved, self); in EnsureResolved()
2803 ScopedThreadSuspension sts(self, kSuspended); in EnsureResolved()
2819 self->AssertNoPendingException(); in EnsureResolved()
2839 Thread* self, in FindClassInSharedLibraries() argument
2851 StackHandleScope<2> hs(self); in FindClassInSharedLibraries()
2857 if (!FindClassInBaseDexClassLoader(soa, self, descriptor, hash, temp_loader, result)) { in FindClassInSharedLibraries()
2868 Thread* self, in FindClassInBaseDexClassLoader() argument
2875 *result = FindClassInBootClassLoaderClassPath(self, descriptor, hash); in FindClassInBaseDexClassLoader()
2886 StackHandleScope<1> hs(self); in FindClassInBaseDexClassLoader()
2888 if (!FindClassInBaseDexClassLoader(soa, self, descriptor, hash, h_parent, result)) { in FindClassInBaseDexClassLoader()
2895 if (!FindClassInSharedLibraries(soa, self, descriptor, hash, class_loader, result)) { in FindClassInBaseDexClassLoader()
2913 *result = FindClassInBootClassLoaderClassPath(self, descriptor, hash); in FindClassInBaseDexClassLoader()
2917 if (self->IsExceptionPending()) { in FindClassInBaseDexClassLoader()
2923 if (!FindClassInSharedLibraries(soa, self, descriptor, hash, class_loader, result)) { in FindClassInBaseDexClassLoader()
2934 if (self->IsExceptionPending()) { in FindClassInBaseDexClassLoader()
2941 StackHandleScope<1> hs(self); in FindClassInBaseDexClassLoader()
2943 return FindClassInBaseDexClassLoader(soa, self, descriptor, hash, h_parent, result); in FindClassInBaseDexClassLoader()
2967 ALWAYS_INLINE void FilterDexFileCaughtExceptions(Thread* self, ClassLinker* class_linker) in FilterDexFileCaughtExceptions() argument
2969 if (MatchesDexFileCaughtExceptions(self->GetException(), class_linker)) { in FilterDexFileCaughtExceptions()
2970 self->ClearException(); in FilterDexFileCaughtExceptions()
2978 ObjPtr<mirror::Class> ClassLinker::FindClassInBootClassLoaderClassPath(Thread* self, in FindClassInBootClassLoaderClassPath() argument
2984 ObjPtr<mirror::Class> klass = LookupClass(self, descriptor, hash, nullptr); in FindClassInBootClassLoaderClassPath()
2986 result = EnsureResolved(self, descriptor, klass); in FindClassInBootClassLoaderClassPath()
2988 result = DefineClass(self, in FindClassInBootClassLoaderClassPath()
2996 CHECK(self->IsExceptionPending()) << descriptor; in FindClassInBootClassLoaderClassPath()
2997 FilterDexFileCaughtExceptions(self, this); in FindClassInBootClassLoaderClassPath()
3040 ObjPtr<mirror::Class> ClassLinker::FindClass(Thread* self, in FindClass() argument
3044 DCHECK(self != nullptr); in FindClass()
3045 self->AssertNoPendingException(); in FindClass()
3046 self->PoisonObjectPointers(); // For DefineClass, CreateArrayClass, etc... in FindClass()
3054 ObjPtr<mirror::Class> klass = LookupClass(self, descriptor, hash, class_loader.Get()); in FindClass()
3056 return EnsureResolved(self, descriptor, klass); in FindClass()
3063 return DefineClass(self, in FindClass()
3075 self->SetException(pre_allocated); in FindClass()
3082 result_ptr = CreateArrayClass(self, descriptor, hash, class_loader); in FindClass()
3083 DCHECK_EQ(result_ptr == nullptr, self->IsExceptionPending()); in FindClass()
3087 ScopedObjectAccessUnchecked soa(self); in FindClass()
3089 FindClassInBaseDexClassLoader(soa, self, descriptor, hash, class_loader, &result_ptr); in FindClass()
3097 } else if (!self->IsExceptionPending()) { in FindClass()
3108 if (self->IsRuntimeThread()) { in FindClass()
3113 self->SetException(pre_allocated); in FindClass()
3140 self->ThrowNewExceptionF("Ljava/lang/ClassNotFoundException;", in FindClass()
3148 ScopedThreadStateChange tsc(self, kNative); in FindClass()
3152 DCHECK(self->IsExceptionPending()); // OOME. in FindClass()
3160 if (result.get() == nullptr && !self->IsExceptionPending()) { in FindClass()
3171 DCHECK(!MatchesDexFileCaughtExceptions(self->GetException(), this)); in FindClass()
3175 if (self->IsExceptionPending()) { in FindClass()
3178 result_ptr = LookupClass(self, descriptor, hash, class_loader.Get()); in FindClass()
3180 self->ClearException(); in FindClass()
3181 return EnsureResolved(self, descriptor, result_ptr); in FindClass()
3189 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in FindClass()
3209 return EnsureResolved(self, descriptor, old); in FindClass()
3232 explicit ScopedDefiningClass(Thread* self) REQUIRES_SHARED(Locks::mutator_lock_) in REQUIRES_SHARED()
3233 : self_(self), returned_(false) { in REQUIRES_SHARED()
3271 ObjPtr<mirror::Class> ClassLinker::DefineClass(Thread* self, in DefineClass() argument
3277 ScopedDefiningClass sdc(self); in DefineClass()
3278 StackHandleScope<3> hs(self); in DefineClass()
3307 self->SetException(pre_allocated); in DefineClass()
3314 if (!self->CanLoadClasses()) { in DefineClass()
3318 self->SetException(pre_allocated); in DefineClass()
3328 klass.Assign(AllocClass(self, SizeOfClassWithoutEmbeddedTables(dex_file, dex_class_def))); in DefineClass()
3334 self->AssertPendingOOMException(); in DefineClass()
3351 if (self->IsExceptionPending()) { in DefineClass()
3356 self->AssertPendingException(); in DefineClass()
3369 ObjectLock<mirror::Class> lock(self, klass); in DefineClass()
3370 klass->SetClinitThreadId(self->GetTid()); in DefineClass()
3379 return sdc.Finish(EnsureResolved(self, descriptor, existing)); in DefineClass()
3386 LoadClass(self, *new_dex_file, *new_class_def, klass); in DefineClass()
3387 if (self->IsExceptionPending()) { in DefineClass()
3388 VLOG(class_linker) << self->GetException()->Dump(); in DefineClass()
3392 mirror::Class::SetStatus(klass, ClassStatus::kErrorUnresolved, self); in DefineClass()
3402 mirror::Class::SetStatus(klass, ClassStatus::kErrorUnresolved, self); in DefineClass()
3418 if (!LinkClass(self, descriptor, klass, interfaces, &h_new_class)) { in DefineClass()
3421 mirror::Class::SetStatus(klass, ClassStatus::kErrorUnresolved, self); in DefineClass()
3425 self->AssertNoPendingException(); in DefineClass()
3437 DCHECK_EQ(self->GetState(), kRunnable); in DefineClass()
3609 void ClassLinker::FixupStaticTrampolines(Thread* self, ObjPtr<mirror::Class> klass) { in FixupStaticTrampolines() argument
3627 MutexLock lock(self, critical_native_code_with_clinit_check_lock_); in FixupStaticTrampolines()
3789 LengthPrefixedArray<ArtField>* ClassLinker::AllocArtFieldArray(Thread* self, in AllocArtFieldArray() argument
3798 void* array_storage = allocator->Alloc(self, storage_size); in AllocArtFieldArray()
3805 LengthPrefixedArray<ArtMethod>* ClassLinker::AllocArtMethodArray(Thread* self, in AllocArtMethodArray() argument
3815 void* array_storage = allocator->Alloc(self, storage_size); in AllocArtMethodArray()
3847 void ClassLinker::LoadClass(Thread* self, in LoadClass() argument
3866 LengthPrefixedArray<ArtField>* sfields = AllocArtFieldArray(self, in LoadClass()
3869 LengthPrefixedArray<ArtField>* ifields = AllocArtFieldArray(self, in LoadClass()
3884 AllocArtMethodArray(self, allocator, accessor.NumMethods()), in LoadClass()
3955 self->AllowThreadSuspension(); in LoadClass()
4031 void ClassLinker::AppendToBootClassPath(Thread* self, const DexFile* dex_file) { in AppendToBootClassPath() argument
4033 self, in AppendToBootClassPath()
4052 Thread* const self = Thread::Current(); in RegisterDexFileLocked() local
4053 Locks::dex_lock_->AssertExclusiveHeld(self); in RegisterDexFileLocked()
4079 JavaVMExt* const vm = self->GetJniEnv()->GetVm(); in RegisterDexFileLocked()
4082 if (self->IsJWeakCleared(data.weak_root)) { in RegisterDexFileLocked()
4083 vm->DeleteWeakGlobalRef(self, data.weak_root); in RegisterDexFileLocked()
4100 jweak dex_cache_jweak = vm->AddWeakGlobalRef(self, dex_cache); in RegisterDexFileLocked()
4106 AddNativeDebugInfoForDex(self, data.dex_file); in RegisterDexFileLocked()
4121 ObjPtr<mirror::DexCache> ClassLinker::DecodeDexCacheLocked(Thread* self, const DexCacheData* data) { in DecodeDexCacheLocked() argument
4123 ? ObjPtr<mirror::DexCache>::DownCast(self->DecodeJObject(data->weak_root)) in DecodeDexCacheLocked()
4139 Thread* self = Thread::Current(); in RegisterExistingDexCache() local
4140 StackHandleScope<2> hs(self); in RegisterExistingDexCache()
4146 ReaderMutexLock mu(self, *Locks::dex_lock_); in RegisterExistingDexCache()
4148 ObjPtr<mirror::DexCache> old_dex_cache = DecodeDexCacheLocked(self, old_data); in RegisterExistingDexCache()
4154 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in RegisterExistingDexCache()
4160 gc::ScopedGCCriticalSection gcs(self, gc::kGcCauseClassLinker, gc::kCollectorTypeClassLinker); in RegisterExistingDexCache()
4161 WriterMutexLock mu(self, *Locks::dex_lock_); in RegisterExistingDexCache()
4171 static void ThrowDexFileAlreadyRegisteredError(Thread* self, const DexFile& dex_file) in ThrowDexFileAlreadyRegisteredError() argument
4173 self->ThrowNewExceptionF("Ljava/lang/InternalError;", in ThrowDexFileAlreadyRegisteredError()
4180 Thread* self = Thread::Current(); in RegisterDexFile() local
4184 ReaderMutexLock mu(self, *Locks::dex_lock_); in RegisterDexFile()
4186 old_dex_cache = DecodeDexCacheLocked(self, old_data); in RegisterDexFile()
4199 ThrowDexFileAlreadyRegisteredError(self, dex_file); in RegisterDexFile()
4207 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in RegisterDexFile()
4213 StackHandleScope<3> hs(self); in RegisterDexFile()
4217 self, in RegisterDexFile()
4224 gc::ScopedGCCriticalSection gcs(self, gc::kGcCauseClassLinker, gc::kCollectorTypeClassLinker); in RegisterDexFile()
4225 WriterMutexLock mu(self, *Locks::dex_lock_); in RegisterDexFile()
4227 old_dex_cache = DecodeDexCacheLocked(self, old_data); in RegisterDexFile()
4232 mirror::DexCache::InitializeDexCache(self, in RegisterDexFile()
4243 DCHECK_EQ(h_dex_cache == nullptr, self->IsExceptionPending()); in RegisterDexFile()
4244 self->ClearException(); in RegisterDexFile()
4255 ThrowDexFileAlreadyRegisteredError(self, dex_file); in RegisterDexFile()
4259 self->AssertPendingOOMException(); in RegisterDexFile()
4271 bool ClassLinker::IsDexFileRegistered(Thread* self, const DexFile& dex_file) { in IsDexFileRegistered() argument
4272 ReaderMutexLock mu(self, *Locks::dex_lock_); in IsDexFileRegistered()
4273 return DecodeDexCacheLocked(self, FindDexCacheDataLocked(dex_file)) != nullptr; in IsDexFileRegistered()
4276 ObjPtr<mirror::DexCache> ClassLinker::FindDexCache(Thread* self, const DexFile& dex_file) { in FindDexCache() argument
4277 ReaderMutexLock mu(self, *Locks::dex_lock_); in FindDexCache()
4279 ObjPtr<mirror::DexCache> dex_cache = DecodeDexCacheLocked(self, dex_cache_data); in FindDexCache()
4285 if (DecodeDexCacheLocked(self, &data) != nullptr) { in FindDexCache()
4294 ClassTable* ClassLinker::FindClassTable(Thread* self, ObjPtr<mirror::DexCache> dex_cache) { in FindClassTable() argument
4297 ReaderMutexLock mu(self, *Locks::dex_lock_); in FindClassTable()
4302 ObjPtr<mirror::DexCache> registered_dex_cache = DecodeDexCacheLocked(self, &data); in FindClassTable()
4323 void ClassLinker::CreatePrimitiveClass(Thread* self, in CreatePrimitiveClass() argument
4327 AllocClass(self, mirror::Class::PrimitiveClassSize(image_pointer_size_)); in CreatePrimitiveClass()
4366 ObjPtr<mirror::Class> ClassLinker::CreateArrayClass(Thread* self, in CreateArrayClass() argument
4372 StackHandleScope<2> hs(self); in CreateArrayClass()
4377 if (!self->CanLoadClasses()) { in CreateArrayClass()
4381 self->SetException(pre_allocated); in CreateArrayClass()
4385 MutableHandle<mirror::Class> component_type(hs.NewHandle(FindClass(self, descriptor + 1, in CreateArrayClass()
4388 DCHECK(self->IsExceptionPending()); in CreateArrayClass()
4391 component_type.Assign(LookupClass(self, descriptor + 1, component_hash, class_loader.Get())); in CreateArrayClass()
4393 DCHECK(self->IsExceptionPending()); in CreateArrayClass()
4396 self->ClearException(); in CreateArrayClass()
4422 LookupClass(self, descriptor, hash, component_type->GetClassLoader()); in CreateArrayClass()
4460 AllocClass(self, GetClassRoot<mirror::Class>(this), array_class_size, visitor)); in CreateArrayClass()
4462 self->AssertPendingOOMException(); in CreateArrayClass()
4571 ObjPtr<mirror::Class> ClassLinker::LookupClass(Thread* self, in LookupClass() argument
4574 return LookupClass(self, descriptor, ComputeModifiedUtf8Hash(descriptor), class_loader); in LookupClass()
4577 ObjPtr<mirror::Class> ClassLinker::LookupClass(Thread* self, in LookupClass() argument
4581 ReaderMutexLock mu(self, *Locks::classlinker_classes_lock_); in LookupClass()
4642 Thread* const self = Thread::Current(); in LookupClasses() local
4643 ReaderMutexLock mu(self, *Locks::classlinker_classes_lock_); in LookupClasses()
4654 bool ClassLinker::AttemptSupertypeVerification(Thread* self, in AttemptSupertypeVerification() argument
4657 DCHECK(self != nullptr); in AttemptSupertypeVerification()
4662 VerifyClass(self, supertype); in AttemptSupertypeVerification()
4678 StackHandleScope<1> hs(self); in AttemptSupertypeVerification()
4679 Handle<mirror::Throwable> cause(hs.NewHandle(self->GetException())); in AttemptSupertypeVerification()
4682 self->ClearException(); in AttemptSupertypeVerification()
4687 self->GetException()->SetCause(cause.Get()); in AttemptSupertypeVerification()
4694 ObjectLock<mirror::Class> super_lock(self, klass); in AttemptSupertypeVerification()
4695 mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self); in AttemptSupertypeVerification()
4700 Thread* self, Handle<mirror::Class> klass, verifier::HardFailLogMode log_level) { in VerifyClass() argument
4703 ObjectLock<mirror::Class> lock(self, klass); in VerifyClass()
4737 mirror::Class::SetStatus(klass, ClassStatus::kVerified, self); in VerifyClass()
4750 mirror::Class::SetStatus(klass, ClassStatus::kVerifying, self); in VerifyClass()
4754 mirror::Class::SetStatus(klass, ClassStatus::kVerified, self); in VerifyClass()
4765 StackHandleScope<2> hs(self); in VerifyClass()
4768 if (supertype != nullptr && !AttemptSupertypeVerification(self, klass, supertype)) { in VerifyClass()
4769 CHECK(self->IsExceptionPending()) << "Verification error should be pending."; in VerifyClass()
4794 } else if (UNLIKELY(!AttemptSupertypeVerification(self, klass, iface))) { in VerifyClass()
4796 CHECK(self->IsExceptionPending()) << "Verification error should be pending."; in VerifyClass()
4834 verifier_failure = PerformClassVerification(self, klass, log_level, &error_msg); in VerifyClass()
4838 ObjectLock<mirror::Class> lock(self, klass); in VerifyClass()
4847 self->AssertNoPendingException(); in VerifyClass()
4856 mirror::Class::SetStatus(klass, ClassStatus::kVerified, self); in VerifyClass()
4860 mirror::Class::SetStatus(klass, ClassStatus::kRetryVerificationAtRuntime, self); in VerifyClass()
4872 mirror::Class::SetStatus(klass, ClassStatus::kRetryVerificationAtRuntime, self); in VerifyClass()
4874 mirror::Class::SetStatus(klass, ClassStatus::kVerifiedNeedsAccessChecks, self); in VerifyClass()
4877 mirror::Class::SetStatus(klass, ClassStatus::kVerified, self); in VerifyClass()
4887 self->AssertNoPendingException(); in VerifyClass()
4889 mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self); in VerifyClass()
4916 verifier::FailureKind ClassLinker::PerformClassVerification(Thread* self, in PerformClassVerification() argument
4921 return verifier::ClassVerifier::VerifyClass(self, in PerformClassVerification()
5029 Thread* self = soa.Self(); in CreateProxyClass() local
5034 if (!self->CanLoadClasses()) { in CreateProxyClass()
5038 self->SetException(pre_allocated); in CreateProxyClass()
5042 StackHandleScope<12> hs(self); in CreateProxyClass()
5044 AllocClass(self, GetClassRoot<mirror::Class>(this), sizeof(mirror::Class)))); in CreateProxyClass()
5046 CHECK(self->IsExceptionPending()); // OOME. in CreateProxyClass()
5061 mirror::Class::SetStatus(temp_klass, ClassStatus::kIdx, self); in CreateProxyClass()
5078 LengthPrefixedArray<ArtField>* sfields = AllocArtFieldArray(self, allocator, num_fields); in CreateProxyClass()
5132 self, original_proxied_throws->GetClass(), num_virtual_methods) in CreateProxyClass()
5135 self->AssertPendingOOMException(); in CreateProxyClass()
5147 self, allocator, num_direct_methods + num_virtual_methods); in CreateProxyClass()
5151 self->AssertPendingOOMException(); in CreateProxyClass()
5172 mirror::Class::SetStatus(temp_klass, ClassStatus::kLoaded, self); in CreateProxyClass()
5173 self->AssertNoPendingException(); in CreateProxyClass()
5182 ObjectLock<mirror::Class> resolution_lock(self, temp_klass); in CreateProxyClass()
5187 if (!LinkClass(self, descriptor, temp_klass, h_interfaces, &klass)) { in CreateProxyClass()
5188 mirror::Class::SetStatus(temp_klass, ClassStatus::kErrorUnresolved, self); in CreateProxyClass()
5217 ObjectLock<mirror::Class> initialization_lock(self, klass); in CreateProxyClass()
5220 callback = MarkClassInitialized(self, klass); in CreateProxyClass()
5223 callback->MakeVisible(self); in CreateProxyClass()
5236 StackHandleScope<1> hs2(self); in CreateProxyClass()
5374 bool ClassLinker::InitializeClass(Thread* self, in InitializeClass() argument
5392 self->AllowThreadSuspension(); in InitializeClass()
5397 ObjectLock<mirror::Class> lock(self, klass); in InitializeClass()
5415 VerifyClass(self, klass); in InitializeClass()
5423 if (self->IsExceptionPending()) { in InitializeClass()
5426 mirror::Class::PrettyClass(self->GetException()->GetClass())); in InitializeClass()
5430 DCHECK_NE(self->GetTid(), klass->GetClinitThreadId()); in InitializeClass()
5438 self->AssertNoPendingException(); in InitializeClass()
5439 self->SetException(Runtime::Current()->GetPreAllocatedNoClassDefFoundError()); in InitializeClass()
5441 self->AssertPendingException(); in InitializeClass()
5444 self->AssertNoPendingException(); in InitializeClass()
5463 if (self->IsExceptionPending()) { in InitializeClass()
5468 if (klass->GetClinitThreadId() == self->GetTid()) { in InitializeClass()
5473 return WaitForInitializeClass(klass, self, lock); in InitializeClass()
5487 mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self); in InitializeClass()
5490 self->AllowThreadSuspension(); in InitializeClass()
5493 << " self.tid=" << self->GetTid() << " clinit.tid=" << klass->GetClinitThreadId(); in InitializeClass()
5497 klass->SetClinitThreadId(self->GetTid()); in InitializeClass()
5498 mirror::Class::SetStatus(klass, ClassStatus::kInitializing, self); in InitializeClass()
5511 StackHandleScope<1> hs(self); in InitializeClass()
5514 bool super_initialized = InitializeClass(self, handle_scope_super, can_init_statics, true); in InitializeClass()
5521 CHECK(self->IsExceptionPending()) in InitializeClass()
5526 << (self->GetException() != nullptr ? self->GetException()->Dump() : ""); in InitializeClass()
5527 ObjectLock<mirror::Class> lock(self, klass); in InitializeClass()
5529 mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self); in InitializeClass()
5541 StackHandleScope<1> hs_iface(self); in InitializeClass()
5544 handle_scope_iface.Assign(mirror::Class::GetDirectInterface(self, klass.Get(), i)); in InitializeClass()
5556 bool iface_initialized = InitializeDefaultInterfaceRecursive(self, in InitializeClass()
5562 ObjectLock<mirror::Class> lock(self, klass); in InitializeClass()
5564 mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self); in InitializeClass()
5576 StackHandleScope<3> hs(self); in InitializeClass()
5620 if (self->IsExceptionPending()) { in InitializeClass()
5625 DCHECK(self->IsExceptionPending() || !value_it.HasNext()); in InitializeClass()
5630 if (!self->IsExceptionPending()) { in InitializeClass()
5635 clinit->Invoke(self, nullptr, 0, &result, "V"); in InitializeClass()
5638 self->AllowThreadSuspension(); in InitializeClass()
5644 ObjectLock<mirror::Class> lock(self, klass); in InitializeClass()
5646 if (self->IsExceptionPending()) { in InitializeClass()
5648 mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self); in InitializeClass()
5656 runtime->ThrowTransactionAbortError(self); in InitializeClass()
5657 mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self); in InitializeClass()
5662 RuntimeStats* thread_stats = self->GetStats(); in InitializeClass()
5669 callback = MarkClassInitialized(self, klass); in InitializeClass()
5678 callback->MakeVisible(self); in InitializeClass()
5685 bool ClassLinker::InitializeDefaultInterfaceRecursive(Thread* self, in InitializeDefaultInterfaceRecursive() argument
5693 StackHandleScope<1> hs(self); in InitializeDefaultInterfaceRecursive()
5697 ObjPtr<mirror::Class> super_iface = mirror::Class::GetDirectInterface(self, iface.Get(), i); in InitializeDefaultInterfaceRecursive()
5702 if (!InitializeDefaultInterfaceRecursive(self, in InitializeDefaultInterfaceRecursive()
5716 result = EnsureInitialized(self, iface, can_init_statics, can_init_parents); in InitializeDefaultInterfaceRecursive()
5728 ObjectTryLock<mirror::Class> lock(self, iface); in InitializeDefaultInterfaceRecursive()
5737 Thread* self, in WaitForInitializeClass() argument
5741 self->AssertNoPendingException(); in WaitForInitializeClass()
5748 if (self->IsExceptionPending()) { in WaitForInitializeClass()
5750 mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self); in WaitForInitializeClass()
5838 static bool HasSameSignatureWithDifferentClassLoaders(Thread* self, in HasSameSignatureWithDifferentClassLoaders() argument
5845 StackHandleScope<1> hs(self); in HasSameSignatureWithDifferentClassLoaders()
5893 StackHandleScope<1> hs(self); in HasSameSignatureWithDifferentClassLoaders()
5930 Thread* self = Thread::Current(); in ValidateSuperClassDescriptors() local
5931 StackHandleScope<1> hs(self); in ValidateSuperClassDescriptors()
5940 if (UNLIKELY(!HasSameSignatureWithDifferentClassLoaders(self, in ValidateSuperClassDescriptors()
5945 self->AssertPendingException(); in ValidateSuperClassDescriptors()
5960 if (UNLIKELY(!HasSameSignatureWithDifferentClassLoaders(self, in ValidateSuperClassDescriptors()
5965 self->AssertPendingException(); in ValidateSuperClassDescriptors()
5975 bool ClassLinker::EnsureInitialized(Thread* self, in EnsureInitialized() argument
5988 if (self->IncrementMakeVisiblyInitializedCounter()) { in EnsureInitialized()
5989 MakeInitializedClassesVisiblyInitialized(self, /*wait=*/ false); in EnsureInitialized()
6010 const bool success = InitializeClass(self, c, can_init_fields, can_init_parents); in EnsureInitialized()
6013 CHECK(self->IsExceptionPending()) << c->PrettyClass(); in EnsureInitialized()
6016 self->AssertNoPendingException(); in EnsureInitialized()
6053 Thread* const self = Thread::Current(); in RegisterClassLoader() local
6055 data.weak_root = self->GetJniEnv()->GetVm()->AddWeakGlobalRef(self, class_loader); in RegisterClassLoader()
6094 bool ClassLinker::LinkClass(Thread* self, in LinkClass() argument
6108 if (!LinkMethods(self, klass, interfaces, &new_conflict, imt_data)) { in LinkClass()
6111 if (!LinkInstanceFields(self, klass)) { in LinkClass()
6115 if (!LinkStaticFields(self, klass, &class_size)) { in LinkClass()
6143 allocator->Alloc(self, ImTable::SizeInBytes(image_pointer_size_))); in LinkClass()
6172 mirror::Class::SetStatus(klass, ClassStatus::kResolved, self); in LinkClass()
6177 StackHandleScope<1> hs(self); in LinkClass()
6179 hs.NewHandle(mirror::Class::CopyOf(klass, self, class_size, imt, image_pointer_size_)); in LinkClass()
6188 self->AssertPendingOOMException(); in LinkClass()
6189 mirror::Class::SetStatus(klass, ClassStatus::kErrorUnresolved, self); in LinkClass()
6194 ObjectLock<mirror::Class> lock(self, h_new_class); in LinkClass()
6198 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in LinkClass()
6223 mirror::Class::SetStatus(klass, ClassStatus::kRetired, self); in LinkClass()
6228 mirror::Class::SetStatus(h_new_class, ClassStatus::kResolved, self); in LinkClass()
6371 bool ClassLinker::LinkMethods(Thread* self, in LinkMethods() argument
6376 self->AllowThreadSuspension(); in LinkMethods()
6384 return SetupInterfaceLookupTable(self, klass, interfaces) in LinkMethods()
6385 && LinkVirtualMethods(self, klass, /*out*/ &default_translations) in LinkMethods()
6386 && LinkInterfaceMethods(self, klass, default_translations, out_new_conflict, out_imt); in LinkMethods()
6511 Thread* self, in LinkVirtualMethods() argument
6554 StackHandleScope<3> hs(self); in LinkVirtualMethods()
6558 vtable = hs.NewHandle(AllocPointerArray(self, max_count)); in LinkVirtualMethods()
6560 self->AssertPendingOOMException(); in LinkVirtualMethods()
6587 mirror::Array::CopyOf(super_vtable, self, max_count))); in LinkVirtualMethods()
6589 self->AssertPendingOOMException(); in LinkVirtualMethods()
6654 switch (FindDefaultMethodImplementation(self, in LinkVirtualMethods()
6724 mirror::Array::CopyOf(vtable, self, actual_count))); in LinkVirtualMethods()
6726 self->AssertPendingOOMException(); in LinkVirtualMethods()
6738 ObjPtr<mirror::PointerArray> vtable = AllocPointerArray(self, num_virtual_methods); in LinkVirtualMethods()
6740 self->AssertPendingOOMException(); in LinkVirtualMethods()
6770 static bool ContainsOverridingMethodOf(Thread* self, in ContainsOverridingMethodOf() argument
6777 DCHECK(self != nullptr); in ContainsOverridingMethodOf()
6786 StackHandleScope<1> hs(self); in ContainsOverridingMethodOf()
6811 Thread* self, in FindDefaultMethodImplementation() argument
6815 DCHECK(self != nullptr); in FindDefaultMethodImplementation()
6834 StackHandleScope<3> hs(self); in FindDefaultMethodImplementation()
6870 !ContainsOverridingMethodOf(self, in FindDefaultMethodImplementation()
6887 if (!ContainsOverridingMethodOf(self, in FindDefaultMethodImplementation()
6961 bool ClassLinker::AllocateIfTableMethodArrays(Thread* self, in AllocateIfTableMethodArrays() argument
6982 StackHandleScope<1u> hs(self); in AllocateIfTableMethodArrays()
6985 ObjPtr<mirror::PointerArray>::DownCast(mirror::Object::Clone(old_array, self)); in AllocateIfTableMethodArrays()
6987 method_array = AllocPointerArray(self, num_methods); in AllocateIfTableMethodArrays()
6990 self->AssertPendingOOMException(); in AllocateIfTableMethodArrays()
7317 bool ClassLinker::SetupInterfaceLookupTable(Thread* self, Handle<mirror::Class> klass, in SetupInterfaceLookupTable() argument
7319 StackHandleScope<1> hs(self); in SetupInterfaceLookupTable()
7354 : mirror::Class::GetDirectInterface(self, klass.Get(), i); in SetupInterfaceLookupTable()
7367 MutableHandle<mirror::IfTable> iftable(hs.NewHandle(AllocIfTable(self, ifcount))); in SetupInterfaceLookupTable()
7369 self->AssertPendingOOMException(); in SetupInterfaceLookupTable()
7384 self->AllowThreadSuspension(); in SetupInterfaceLookupTable()
7392 mirror::Class::GetDirectInterface(self, klass.Get(), i); in SetupInterfaceLookupTable()
7399 self->AllowThreadSuspension(); in SetupInterfaceLookupTable()
7405 mirror::IfTable::CopyOf(iftable, self, new_ifcount * mirror::IfTable::kMax))); in SetupInterfaceLookupTable()
7407 self->AssertPendingOOMException(); in SetupInterfaceLookupTable()
7441 void CheckClassOwnsVTableEntries(Thread* self, in CheckClassOwnsVTableEntries() argument
7445 StackHandleScope<2> hs(self); in CheckClassOwnsVTableEntries()
7474 void CheckVTableHasNoDuplicates(Thread* self, Handle<mirror::Class> klass) in CheckVTableHasNoDuplicates() argument
7476 StackHandleScope<1> hs(self); in CheckVTableHasNoDuplicates()
7630 void CheckVTableHasNoDuplicates(Thread* self, in CheckVTableHasNoDuplicates() argument
7636 CheckVTableHasNoDuplicates<PointerSize::k64>(self, klass); in CheckVTableHasNoDuplicates()
7639 CheckVTableHasNoDuplicates<PointerSize::k32>(self, klass); in CheckVTableHasNoDuplicates()
7644 static void CheckVTable(Thread* self, Handle<mirror::Class> klass, PointerSize pointer_size) in CheckVTable() argument
7646 CheckClassOwnsVTableEntries(self, klass, pointer_size); in CheckVTable()
7647 CheckVTableHasNoDuplicates(self, klass, pointer_size); in CheckVTable()
7685 Thread* self, in LinkInterfaceMethodsHelper() argument
7691 self_(self), in LinkInterfaceMethodsHelper()
8173 Thread* self, in LinkInterfaceMethods() argument
8178 StackHandleScope<3> hs(self); in LinkInterfaceMethods()
8204 if (!AllocateIfTableMethodArrays(self, klass, iftable)) { in LinkInterfaceMethods()
8209 LinkInterfaceMethodsHelper helper(this, klass, self, runtime); in LinkInterfaceMethods()
8211 auto* old_cause = self->StartAssertNoThreadSuspension( in LinkInterfaceMethods()
8223 StackHandleScope<2> hs2(self); in LinkInterfaceMethods()
8289 self->EndAssertNoThreadSuspension(old_cause); in LinkInterfaceMethods()
8393 self->EndAssertNoThreadSuspension(old_cause); in LinkInterfaceMethods()
8408 self->EndAssertNoThreadSuspension(old_cause); in LinkInterfaceMethods()
8411 CheckVTable(self, klass, image_pointer_size_); in LinkInterfaceMethods()
8416 bool ClassLinker::LinkInstanceFields(Thread* self, Handle<mirror::Class> klass) { in LinkInstanceFields() argument
8418 return LinkFields(self, klass, false, nullptr); in LinkInstanceFields()
8421 bool ClassLinker::LinkStaticFields(Thread* self, Handle<mirror::Class> klass, size_t* class_size) { in LinkStaticFields() argument
8423 return LinkFields(self, klass, true, class_size); in LinkStaticFields()
8460 bool ClassLinker::LinkFields(Thread* self, in LinkFields() argument
8464 self->AllowThreadSuspension(); in LinkFields()
8501 const char* old_no_suspend_cause = self->StartAssertNoThreadSuspension( in LinkFields()
8542 self->EndAssertNoThreadSuspension(old_no_suspend_cause); in LinkFields()
8725 Thread* const self = Thread::Current(); in DoLookupResolvedType() local
8726 DCHECK(self != nullptr); in DoLookupResolvedType()
8729 type = LookupClass(self, descriptor, hash, class_loader); in DoLookupResolvedType()
8760 Thread* self = Thread::Current(); in DoResolveType() local
8762 ObjPtr<mirror::Class> resolved = FindClass(self, descriptor, class_loader); in DoResolveType()
8769 CHECK(self->IsExceptionPending()) in DoResolveType()
8772 StackHandleScope<1> hs(self); in DoResolveType()
8773 Handle<mirror::Throwable> cause(hs.NewHandle(self->GetException())); in DoResolveType()
8776 self->ClearException(); in DoResolveType()
8778 self->GetException()->SetCause(cause.Get()); in DoResolveType()
9067 Thread* self = is_static ? Thread::Current() : nullptr; in FindResolvedField() local
9070 resolved = is_static ? mirror::Class::FindStaticField(self, klass, dex_cache, field_idx) in FindResolvedField()
9077 resolved = is_static ? mirror::Class::FindStaticField(self, klass, name, type) in FindResolvedField()
9100 Thread* self = Thread::Current(); in FindResolvedFieldJLS() local
9106 resolved = mirror::Class::FindField(self, klass, name, type); in FindResolvedFieldJLS()
9123 Thread* self, in ResolveMethodType() argument
9135 StackHandleScope<4> hs(self); in ResolveMethodType()
9143 DCHECK(self->IsExceptionPending()); in ResolveMethodType()
9155 mirror::ObjectArray<mirror::Class>::Alloc(self, array_of_class, num_method_args))); in ResolveMethodType()
9157 DCHECK(self->IsExceptionPending()); in ResolveMethodType()
9168 DCHECK(self->IsExceptionPending()); in ResolveMethodType()
9178 mirror::MethodType::Create(self, return_type, method_params)); in ResolveMethodType()
9184 ObjPtr<mirror::MethodType> ClassLinker::ResolveMethodType(Thread* self, in ResolveMethodType() argument
9187 StackHandleScope<2> hs(self); in ResolveMethodType()
9190 return ResolveMethodType(self, proto_idx, dex_cache, class_loader); in ResolveMethodType()
9194 Thread* self, in ResolveMethodHandleForField() argument
9258 StackHandleScope<4> hs(self); in ResolveMethodHandleForField()
9261 mirror::ObjectArray<mirror::Class>::Alloc(self, array_of_class, num_params))); in ResolveMethodHandleForField()
9263 DCHECK(self->IsExceptionPending()); in ResolveMethodHandleForField()
9300 DCHECK(self->IsExceptionPending()); in ResolveMethodHandleForField()
9306 DCHECK(self->IsExceptionPending()); in ResolveMethodHandleForField()
9311 method_type(hs.NewHandle(mirror::MethodType::Create(self, return_type, method_params))); in ResolveMethodHandleForField()
9313 DCHECK(self->IsExceptionPending()); in ResolveMethodHandleForField()
9318 return mirror::MethodHandleImpl::Create(self, target, kind, method_type); in ResolveMethodHandleForField()
9322 Thread* self, in ResolveMethodHandleForMethod() argument
9339 target_method = ResolveMethod<ResolveMode::kNoChecks>(self, in ResolveMethodHandleForMethod()
9348 target_method = ResolveMethod<ResolveMode::kNoChecks>(self, in ResolveMethodHandleForMethod()
9359 target_method = ResolveMethod<ResolveMode::kNoChecks>(self, in ResolveMethodHandleForMethod()
9368 StackHandleScope<2> hs(self); in ResolveMethodHandleForMethod()
9384 target_method = ResolveMethod<ResolveMode::kNoChecks>(self, in ResolveMethodHandleForMethod()
9390 target_method = ResolveMethod<ResolveMode::kNoChecks>(self, in ResolveMethodHandleForMethod()
9409 target_method = ResolveMethod<ResolveMode::kNoChecks>(self, in ResolveMethodHandleForMethod()
9436 StackHandleScope<5> hs(self); in ResolveMethodHandleForMethod()
9439 mirror::ObjectArray<mirror::Class>::Alloc(self, array_of_class, num_params))); in ResolveMethodHandleForMethod()
9441 DCHECK(self->IsExceptionPending()); in ResolveMethodHandleForMethod()
9465 DCHECK(self->IsExceptionPending()); in ResolveMethodHandleForMethod()
9475 DCHECK(self->IsExceptionPending()); in ResolveMethodHandleForMethod()
9480 method_type(hs.NewHandle(mirror::MethodType::Create(self, return_type, method_params))); in ResolveMethodHandleForMethod()
9482 DCHECK(self->IsExceptionPending()); in ResolveMethodHandleForMethod()
9489 hs.NewHandle(mirror::MethodHandlesLookup::GetDefault(self)); in ResolveMethodHandleForMethod()
9490 return lookup->FindConstructor(self, constructor_class, method_type); in ResolveMethodHandleForMethod()
9494 return mirror::MethodHandleImpl::Create(self, target, kind, method_type); in ResolveMethodHandleForMethod()
9497 ObjPtr<mirror::MethodHandle> ClassLinker::ResolveMethodHandle(Thread* self, in ResolveMethodHandle() argument
9508 return ResolveMethodHandleForField(self, method_handle, referrer); in ResolveMethodHandle()
9514 return ResolveMethodHandleForMethod(self, method_handle, referrer); in ResolveMethodHandle()
9675 Thread* self, in CreateWellKnownClassLoader() argument
9681 StackHandleScope<5> hs(self); in CreateWellKnownClassLoader()
9690 mirror::ObjectArray<mirror::Object>::Alloc(self, in CreateWellKnownClassLoader()
9709 StackHandleScope<4> hs2(self); in CreateWellKnownClassLoader()
9714 self, in CreateWellKnownClassLoader()
9722 cookie_field->GetDeclaringClass()->AllocObject(self)); in CreateWellKnownClassLoader()
9727 mirror::String::AllocFromModifiedUtf8(self, dex_file->GetLocation().c_str())); in CreateWellKnownClassLoader()
9731 Handle<mirror::Object> h_element = hs2.NewHandle(h_dex_element_class->AllocObject(self)); in CreateWellKnownClassLoader()
9742 dex_elements_field->GetDeclaringClass()->AllocObject(self)); in CreateWellKnownClassLoader()
9753 ObjPtr<mirror::Class> list_class = FindSystemClass(self, "Ljava/util/ArrayList;"); in CreateWellKnownClassLoader()
9756 StackHandleScope<1> h_list_scope(self); in CreateWellKnownClassLoader()
9758 bool list_init = EnsureInitialized(self, h_list_class, true, true); in CreateWellKnownClassLoader()
9762 ObjPtr<mirror::Object> list_object = list_class->AllocObject(self); in CreateWellKnownClassLoader()
9772 ObjPtr<mirror::ClassLoader>::DownCast(loader_class->AllocObject(self))); in CreateWellKnownClassLoader()
9783 mirror::Class::FindField(self, in CreateWellKnownClassLoader()
9789 ScopedObjectAccessUnchecked soa(self); in CreateWellKnownClassLoader()
9791 WellKnownClasses::java_lang_BootClassLoader)->AllocObject(self)); in CreateWellKnownClassLoader()
9805 jobject ClassLinker::CreateWellKnownClassLoader(Thread* self, in CreateWellKnownClassLoader() argument
9810 CHECK(self->GetJniEnv()->IsSameObject(loader_class, in CreateWellKnownClassLoader()
9812 self->GetJniEnv()->IsSameObject(loader_class, in CreateWellKnownClassLoader()
9814 self->GetJniEnv()->IsSameObject(loader_class, in CreateWellKnownClassLoader()
9819 ScopedObjectAccessUnchecked soa(self); in CreateWellKnownClassLoader()
9822 StackHandleScope<4> hs(self); in CreateWellKnownClassLoader()
9832 self, in CreateWellKnownClassLoader()
9844 jobject ClassLinker::CreatePathClassLoader(Thread* self, in CreatePathClassLoader() argument
9846 return CreateWellKnownClassLoader(self, in CreatePathClassLoader()
9858 Thread* const self = Thread::Current(); in VisitClassLoaders() local
9862 self->DecodeJObject(data.weak_root)); in VisitClassLoaders()
9881 Thread* const self = Thread::Current(); in InsertDexFileInToClassLoader() local
9882 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in InsertDexFileInToClassLoader()
9893 Thread* const self = Thread::Current(); in CleanupClassLoaders() local
9897 WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); in CleanupClassLoaders()
9902 ObjPtr<mirror::ClassLoader>::DownCast(self->DecodeJObject(data.weak_root)); in CleanupClassLoaders()
9914 DeleteClassLoader(self, data, /*cleanup_cha=*/ true); in CleanupClassLoaders()
9945 ObjPtr<mirror::IfTable> ClassLinker::AllocIfTable(Thread* self, size_t ifcount) { in AllocIfTable() argument
9947 mirror::IfTable::Alloc(self, in AllocIfTable()
9974 Thread* self,
9978 Thread* self,