Lines Matching refs:art
140 constexpr bool kCheckAllMethodsSeenOnce = art::kIsDebugBuild;
149 art::ArtMethod* FindObsoleteVersion(art::ArtMethod* original) const in FindObsoleteVersion()
150 REQUIRES(art::Locks::mutator_lock_, art::Roles::uninterruptible_) { in FindObsoleteVersion()
153 art::ArtMethod* res = obsolete_methods_->GetElementPtrSize<art::ArtMethod*>( in FindObsoleteVersion()
154 method_pair->second, art::kRuntimePointerSize); in FindObsoleteVersion()
162 void RecordObsolete(art::ArtMethod* original, art::ArtMethod* obsolete) in RecordObsolete()
163 REQUIRES(art::Locks::mutator_lock_, art::Roles::uninterruptible_) { in RecordObsolete()
169 obsolete_methods_->GetElementPtrSize<art::ArtMethod*>(slot, art::kRuntimePointerSize)); in RecordObsolete()
171 obsolete_methods_->SetElementPtrSize(slot, obsolete, art::kRuntimePointerSize); in RecordObsolete()
176 ObsoleteMap(art::ObjPtr<art::mirror::PointerArray> obsolete_methods, in ObsoleteMap()
177 art::ObjPtr<art::mirror::ObjectArray<art::mirror::DexCache>> obsolete_dex_caches, in ObsoleteMap()
178 art::ObjPtr<art::mirror::DexCache> original_dex_cache) in ObsoleteMap()
184 while (obsolete_methods_->GetElementPtrSize<art::ArtMethod*>( in ObsoleteMap()
185 next_free_slot_, art::kRuntimePointerSize) != nullptr) { in ObsoleteMap()
194 art::ArtMethod* old_method;
195 art::ArtMethod* obsolete_method;
207 REQUIRES(art::Locks::mutator_lock_, art::Roles::uninterruptible_) { in operator *()
208 art::ArtMethod* obsolete = map_->obsolete_methods_->GetElementPtrSize<art::ArtMethod*>( in operator *()
209 iter_->second, art::kRuntimePointerSize); in operator *()
235 std::unordered_map<art::ArtMethod*, int32_t>::const_iterator iter) in ObsoleteMapIter()
239 std::unordered_map<art::ArtMethod*, int32_t>::const_iterator iter_;
254 std::unordered_map<art::ArtMethod*, int32_t> id_map_;
257 art::ObjPtr<art::mirror::PointerArray> obsolete_methods_;
258 art::ObjPtr<art::mirror::ObjectArray<art::mirror::DexCache>> obsolete_dex_caches_;
259 art::ObjPtr<art::mirror::DexCache> original_dex_cache_;
264 class ObsoleteMethodStackVisitor : public art::StackVisitor {
267 art::Thread* thread, in ObsoleteMethodStackVisitor()
268 art::LinearAlloc* allocator, in ObsoleteMethodStackVisitor()
269 const std::unordered_set<art::ArtMethod*>& obsoleted_methods, in ObsoleteMethodStackVisitor()
285 art::Thread* thread, in UpdateObsoleteFrames()
286 art::LinearAlloc* allocator, in UpdateObsoleteFrames()
287 const std::unordered_set<art::ArtMethod*>& obsoleted_methods, in UpdateObsoleteFrames()
289 REQUIRES(art::Locks::mutator_lock_) { in UpdateObsoleteFrames()
297 bool VisitFrame() override REQUIRES(art::Locks::mutator_lock_) { in VisitFrame()
298 art::ScopedAssertNoThreadSuspension snts("Fixing up the stack for obsolete methods."); in VisitFrame()
299 art::ArtMethod* old_method = GetMethod(); in VisitFrame()
306 art::ArtMethod* new_obsolete_method = obsolete_maps_->FindObsoleteVersion(old_method); in VisitFrame()
309 art::Runtime* runtime = art::Runtime::Current(); in VisitFrame()
310 art::ClassLinker* cl = runtime->GetClassLinker(); in VisitFrame()
312 const size_t method_size = art::ArtMethod::Size(ptr_size); in VisitFrame()
313 auto* method_storage = allocator_->Alloc(art::Thread::Current(), method_size); in VisitFrame()
316 new_obsolete_method = new (method_storage) art::ArtMethod(); in VisitFrame()
332 art::LinearAlloc* allocator_;
334 const std::unordered_set<art::ArtMethod*>& obsoleted_methods_;
347 art::Thread* self = art::Thread::Current(); in IsModifiableClassGeneric()
348 art::ScopedObjectAccess soa(self); in IsModifiableClassGeneric()
349 art::StackHandleScope<1> hs(self); in IsModifiableClassGeneric()
350 art::ObjPtr<art::mirror::Object> obj(self->DecodeJObject(klass)); in IsModifiableClassGeneric()
354 art::Handle<art::mirror::Class> h_klass(hs.NewHandle(obj->AsClass())); in IsModifiableClassGeneric()
375 art::Thread* self = art::Thread::Current(); in GetClassRedefinitionError()
376 art::ScopedObjectAccess soa(self); in GetClassRedefinitionError()
377 art::StackHandleScope<1> hs(self); in GetClassRedefinitionError()
378 art::ObjPtr<art::mirror::Object> obj(self->DecodeJObject(klass)); in GetClassRedefinitionError()
382 art::Handle<art::mirror::Class> h_klass(hs.NewHandle(obj->AsClass())); in GetClassRedefinitionError()
387 jvmtiError Redefiner::GetClassRedefinitionError(art::Handle<art::mirror::Class> klass, in GetClassRedefinitionError()
389 art::Thread* self = art::Thread::Current(); in GetClassRedefinitionError()
421 for (jclass c : art::NonDebuggableClasses::GetNonDebuggableClasses()) { in GetClassRedefinitionError()
440 if (!art::Runtime::Current()->GetClassLinker()->EnsureInitialized( in GetClassRedefinitionError()
458 self->DecodeJObject(art::WellKnownClasses::java_lang_Thread)->AsClass())) { in GetClassRedefinitionError()
465 [](art::ObjPtr<art::mirror::Class> k) REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetClassRedefinitionError()
469 art::ObjPtr<art::mirror::ClassExt> ext(k->GetExtData()); in GetClassRedefinitionError()
485 art::ClassFuncVisitor cfv( in GetClassRedefinitionError()
486 [&](art::ObjPtr<art::mirror::Class> k) REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetClassRedefinitionError()
500 art::Runtime::Current()->GetClassLinker()->VisitClasses(&cfv); in GetClassRedefinitionError()
507 art::Handle<art::mirror::Class> klass, /*out*/ std::string* error_msg);
509 art::Handle<art::mirror::Class> klass, /*out*/ std::string* error_msg);
512 art::MemMap Redefiner::MoveDataToMemMap(const std::string& original_location, in MoveDataToMemMap()
513 art::ArrayRef<const unsigned char> data, in MoveDataToMemMap()
515 art::MemMap map = art::MemMap::MapAnonymous( in MoveDataToMemMap()
533 const art::DexFile* redefined_dex_file, in ClassRedefinition()
535 art::ArrayRef<const unsigned char> orig_dex_file) : in ClassRedefinition()
554 art::Runtime* runtime = art::Runtime::Current(); in RedefineClassesGeneric()
555 art::Thread* self = art::Thread::Current(); in RedefineClassesGeneric()
631 art::Thread::Current(), in StructurallyRedefineClassDirect()
639 art::Runtime::Current(), in StructurallyRedefineClassDirect()
640 art::Thread::Current(), in StructurallyRedefineClassDirect()
651 art::Runtime* runtime, in RedefineClassesDirect()
652 art::Thread* self, in RedefineClassesDirect()
669 art::jit::ScopedJitSuspend suspend_jit; in RedefineClassesDirect()
671 art::ScopedObjectAccess soa(self); in RedefineClassesDirect()
700 art::MemMap map = MoveDataToMemMap(original_dex_location, def.GetDexData(), error_msg_); in AddRedefinition()
708 if (map.Size() < sizeof(art::DexFile::Header)) { in AddRedefinition()
713 uint32_t checksum = reinterpret_cast<const art::DexFile::Header*>(map.Begin())->checksum_; in AddRedefinition()
714 const art::ArtDexFileLoader dex_file_loader; in AddRedefinition()
715 std::unique_ptr<const art::DexFile> dex_file(dex_file_loader.Open(name, in AddRedefinition()
735 art::ObjPtr<art::mirror::Class> Redefiner::ClassRedefinition::GetMirrorClass() { in GetMirrorClass()
739 art::ObjPtr<art::mirror::ClassLoader> Redefiner::ClassRedefinition::GetClassLoader() { in GetClassLoader()
743 art::mirror::DexCache* Redefiner::ClassRedefinition::CreateNewDexCache( in CreateNewDexCache()
744 art::Handle<art::mirror::ClassLoader> loader) { in CreateNewDexCache()
745 art::StackHandleScope<2> hs(driver_->self_); in CreateNewDexCache()
746 art::ClassLinker* cl = driver_->runtime_->GetClassLinker(); in CreateNewDexCache()
747 art::Handle<art::mirror::DexCache> cache(hs.NewHandle( in CreateNewDexCache()
748 art::ObjPtr<art::mirror::DexCache>::DownCast( in CreateNewDexCache()
749 art::GetClassRoot<art::mirror::DexCache>(cl)->AllocObject(driver_->self_)))); in CreateNewDexCache()
754 art::Handle<art::mirror::String> location(hs.NewHandle( in CreateNewDexCache()
760 art::WriterMutexLock mu(driver_->self_, *art::Locks::dex_lock_); in CreateNewDexCache()
775 art::mirror::Object* Redefiner::ClassRedefinition::AllocateOrGetOriginalDexFile() { in AllocateOrGetOriginalDexFile()
778 return art::mirror::ByteArray::AllocateAndFill( in AllocateOrGetOriginalDexFile()
785 art::ObjPtr<art::mirror::ClassExt> ext(GetMirrorClass()->GetExtData()); in AllocateOrGetOriginalDexFile()
787 art::ObjPtr<art::mirror::Object> old_original_dex_file(ext->GetOriginalDexFile()); in AllocateOrGetOriginalDexFile()
795 art::ObjPtr<art::mirror::DexCache> current_dex_cache(GetMirrorClass()->GetDexCache()); in AllocateOrGetOriginalDexFile()
806 art::LinearAlloc* allocator;
807 std::unordered_set<art::ArtMethod*> obsolete_methods;
809 explicit CallbackCtx(ObsoleteMap* map, art::LinearAlloc* alloc) in CallbackCtx()
813 void DoAllocateObsoleteMethodsCallback(art::Thread* t, void* vdata) NO_THREAD_SAFETY_ANALYSIS { in DoAllocateObsoleteMethodsCallback()
825 art::ObjPtr<art::mirror::Class> art_klass) { in FindAndAllocateObsoleteMethods()
827 art::ScopedAssertNoThreadSuspension ns("No thread suspension during thread stack walking"); in FindAndAllocateObsoleteMethods()
828 art::ObjPtr<art::mirror::ClassExt> ext = art_klass->GetExtData(); in FindAndAllocateObsoleteMethods()
830 art::ClassLinker* linker = driver_->runtime_->GetClassLinker(); in FindAndAllocateObsoleteMethods()
835 for (auto& m : art_klass->GetDeclaredMethods(art::kRuntimePointerSize)) { in FindAndAllocateObsoleteMethods()
851 art::MutexLock mu(driver_->self_, *art::Locks::thread_list_lock_); in FindAndAllocateObsoleteMethods()
852 art::ThreadList* list = art::Runtime::Current()->GetThreadList(); in FindAndAllocateObsoleteMethods()
856 art::jit::Jit* jit = art::Runtime::Current()->GetJit(); in FindAndAllocateObsoleteMethods()
869 template <> struct SignatureType<art::ArtField> { using type = std::string_view; };
870 template <> struct SignatureType<art::ArtMethod> { using type = art::Signature; };
876 NameAndSignature(const art::DexFile* dex_file, uint32_t id);
903 using FieldNameAndSignature = NameAndSignature<art::ArtField>;
905 FieldNameAndSignature::NameAndSignature(const art::DexFile* dex_file, uint32_t id) in NameAndSignature()
909 using MethodNameAndSignature = NameAndSignature<art::ArtMethod>;
911 MethodNameAndSignature::NameAndSignature(const art::DexFile* dex_file, uint32_t id) in NameAndSignature()
927 art::StackHandleScope<1> hs(driver_->self_); in CheckMethods()
928 art::Handle<art::mirror::Class> h_klass(hs.NewHandle(GetMirrorClass())); in CheckMethods()
932 art::ClassAccessor accessor(*dex_file_, dex_file_->GetClassDef(0)); in CheckMethods()
934 uint32_t num_old_method = h_klass->GetDeclaredMethodsSlice(art::kRuntimePointerSize).size(); in CheckMethods()
950 const art::DexFile& old_dex_file = h_klass->GetDexFile(); in CheckMethods()
951 art::ClassAccessor old_accessor(old_dex_file, *h_klass->GetClassDef()); in CheckMethods()
956 for (const art::ClassAccessor::Method& new_method : accessor.GetMethods()) { in CheckMethods()
1009 art::StackHandleScope<1> hs(driver_->self_); in CheckFields()
1010 art::Handle<art::mirror::Class> h_klass(hs.NewHandle(GetMirrorClass())); in CheckFields()
1012 art::ClassAccessor new_accessor(*dex_file_, dex_file_->GetClassDef(0)); in CheckFields()
1014 const art::DexFile& old_dex_file = h_klass->GetDexFile(); in CheckFields()
1015 art::ClassAccessor old_accessor(old_dex_file, *h_klass->GetClassDef()); in CheckFields()
1020 for (const art::ClassAccessor::Field& new_field : new_accessor.GetFields()) { in CheckFields()
1068 art::StackHandleScope<1> hs(driver_->self_); in CheckClass()
1078 const art::dex::ClassDef& def = dex_file_->GetClassDef(0); in CheckClass()
1080 art::Handle<art::mirror::Class> current_class(hs.NewHandle(GetMirrorClass())); in CheckClass()
1092 if (def.GetJavaAccessFlags() != (current_class->GetAccessFlags() & art::kAccValidClassFlags)) { in CheckClass()
1100 DCHECK_NE(def.class_idx_, art::dex::TypeIndex::Invalid()) << "Invalid type index"; in CheckClass()
1112 if (def.superclass_idx_ != art::dex::TypeIndex::Invalid()) { in CheckClass()
1124 const art::dex::TypeList* interfaces = dex_file_->GetInterfacesList(def); in CheckClass()
1133 const art::dex::TypeList* current_interfaces = current_class->GetInterfaceTypeList(); in CheckClass()
1140 const art::DexFile& orig_dex_file = current_class->GetDexFile(); in CheckClass()
1156 art::StackHandleScope<1> hs(driver_->self_); in CheckRedefinable()
1158 art::Handle<art::mirror::Class> h_klass(hs.NewHandle(GetMirrorClass())); in CheckRedefinable()
1206 RedefinitionDataHolder(art::StackHandleScope<1>* hs, in RedefinitionDataHolder()
1207 art::Runtime* runtime, in RedefinitionDataHolder()
1208 art::Thread* self, in RedefinitionDataHolder()
1210 REQUIRES_SHARED(art::Locks::mutator_lock_) : in RedefinitionDataHolder()
1211 arr_(hs->NewHandle(art::mirror::ObjectArray<art::mirror::Object>::Alloc( in RedefinitionDataHolder()
1213 art::GetClassRoot<art::mirror::ObjectArray<art::mirror::Object>>(runtime->GetClassLinker()), in RedefinitionDataHolder()
1220 bool IsNull() const REQUIRES_SHARED(art::Locks::mutator_lock_) { in IsNull()
1224 art::ObjPtr<art::mirror::ClassLoader> GetSourceClassLoader(jint klass_index) const in GetSourceClassLoader()
1225 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetSourceClassLoader()
1226 return art::ObjPtr<art::mirror::ClassLoader>::DownCast( in GetSourceClassLoader()
1229 art::ObjPtr<art::mirror::Object> GetJavaDexFile(jint klass_index) const in GetJavaDexFile()
1230 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetJavaDexFile()
1233 art::ObjPtr<art::mirror::LongArray> GetNewDexFileCookie(jint klass_index) const in GetNewDexFileCookie()
1234 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewDexFileCookie()
1235 return art::ObjPtr<art::mirror::LongArray>::DownCast( in GetNewDexFileCookie()
1238 art::ObjPtr<art::mirror::DexCache> GetNewDexCache(jint klass_index) const in GetNewDexCache()
1239 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewDexCache()
1240 return art::ObjPtr<art::mirror::DexCache>::DownCast(GetSlot(klass_index, kSlotNewDexCache)); in GetNewDexCache()
1242 art::ObjPtr<art::mirror::Class> GetMirrorClass(jint klass_index) const in GetMirrorClass()
1243 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetMirrorClass()
1244 return art::ObjPtr<art::mirror::Class>::DownCast(GetSlot(klass_index, kSlotMirrorClass)); in GetMirrorClass()
1247 art::ObjPtr<art::mirror::Object> GetOriginalDexFile(jint klass_index) const in GetOriginalDexFile()
1248 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOriginalDexFile()
1249 return art::ObjPtr<art::mirror::Object>::DownCast(GetSlot(klass_index, kSlotOrigDexFile)); in GetOriginalDexFile()
1252 art::ObjPtr<art::mirror::PointerArray> GetOldObsoleteMethods(jint klass_index) const in GetOldObsoleteMethods()
1253 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOldObsoleteMethods()
1254 return art::ObjPtr<art::mirror::PointerArray>::DownCast( in GetOldObsoleteMethods()
1258 art::ObjPtr<art::mirror::ObjectArray<art::mirror::DexCache>> GetOldDexCaches( in GetOldDexCaches()
1259 jint klass_index) const REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOldDexCaches()
1260 return art::ObjPtr<art::mirror::ObjectArray<art::mirror::DexCache>>::DownCast( in GetOldDexCaches()
1264 art::ObjPtr<art::mirror::Class> GetNewClassObject(jint klass_index) const in GetNewClassObject()
1265 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewClassObject()
1266 return art::ObjPtr<art::mirror::Class>::DownCast(GetSlot(klass_index, kSlotNewClassObject)); in GetNewClassObject()
1269 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> GetOldInstanceObjects( in GetOldInstanceObjects()
1270 jint klass_index) const REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOldInstanceObjects()
1271 return art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>>::DownCast( in GetOldInstanceObjects()
1275 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> GetNewInstanceObjects( in GetNewInstanceObjects()
1276 jint klass_index) const REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewInstanceObjects()
1277 return art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>>::DownCast( in GetNewInstanceObjects()
1280 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> GetOldClasses(jint klass_index) const in GetOldClasses()
1281 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOldClasses()
1282 return art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>>::DownCast( in GetOldClasses()
1285 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> GetNewClasses(jint klass_index) const in GetNewClasses()
1286 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewClasses()
1287 return art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>>::DownCast( in GetNewClasses()
1290 bool IsInitialized(jint klass_index) REQUIRES_SHARED(art::Locks::mutator_lock_) { in IsInitialized()
1293 bool IsActuallyStructural(jint klass_index) REQUIRES_SHARED(art::Locks::mutator_lock_) { in IsActuallyStructural()
1297 bool IsInitialStructural(jint klass_index) REQUIRES_SHARED(art::Locks::mutator_lock_) { in IsInitialStructural()
1301 void SetSourceClassLoader(jint klass_index, art::ObjPtr<art::mirror::ClassLoader> loader) in SetSourceClassLoader()
1302 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetSourceClassLoader()
1305 void SetJavaDexFile(jint klass_index, art::ObjPtr<art::mirror::Object> dexfile) in SetJavaDexFile()
1306 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetJavaDexFile()
1309 void SetNewDexFileCookie(jint klass_index, art::ObjPtr<art::mirror::LongArray> cookie) in SetNewDexFileCookie()
1310 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewDexFileCookie()
1313 void SetNewDexCache(jint klass_index, art::ObjPtr<art::mirror::DexCache> cache) in SetNewDexCache()
1314 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewDexCache()
1317 void SetMirrorClass(jint klass_index, art::ObjPtr<art::mirror::Class> klass) in SetMirrorClass()
1318 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetMirrorClass()
1321 void SetOriginalDexFile(jint klass_index, art::ObjPtr<art::mirror::Object> bytes) in SetOriginalDexFile()
1322 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOriginalDexFile()
1325 void SetOldObsoleteMethods(jint klass_index, art::ObjPtr<art::mirror::PointerArray> methods) in SetOldObsoleteMethods()
1326 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOldObsoleteMethods()
1330 art::ObjPtr<art::mirror::ObjectArray<art::mirror::DexCache>> caches) in SetOldDexCaches()
1331 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOldDexCaches()
1335 void SetNewClassObject(jint klass_index, art::ObjPtr<art::mirror::Class> klass) in SetNewClassObject()
1336 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewClassObject()
1341 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> objs) in SetOldInstanceObjects()
1342 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOldInstanceObjects()
1346 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> objs) in SetNewInstanceObjects()
1347 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewInstanceObjects()
1351 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> klasses) in SetOldClasses()
1352 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOldClasses()
1356 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> klasses) in SetNewClasses()
1357 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewClasses()
1360 void SetInitialized(jint klass_index) REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetInitialized()
1363 void SetActuallyStructural(jint klass_index) REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetActuallyStructural()
1366 void SetInitialStructural(jint klass_index) REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetInitialStructural()
1369 int32_t Length() const REQUIRES_SHARED(art::Locks::mutator_lock_) { in Length()
1374 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetRedefinitions()
1379 REQUIRES_SHARED(art::Locks::mutator_lock_) { in operator ==()
1384 REQUIRES_SHARED(art::Locks::mutator_lock_) { in operator !=()
1388 RedefinitionDataIter begin() REQUIRES_SHARED(art::Locks::mutator_lock_);
1389 RedefinitionDataIter end() REQUIRES_SHARED(art::Locks::mutator_lock_);
1392 mutable art::Handle<art::mirror::ObjectArray<art::mirror::Object>> arr_;
1403 art::ObjPtr<art::mirror::Object> GetSlot(jint klass_index, DataSlot slot) const in GetSlot()
1404 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetSlot()
1411 art::ObjPtr<art::mirror::Object> obj) REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetSlot()
1412 DCHECK(!art::Runtime::Current()->IsActiveTransaction()); in SetSlot()
1430 REQUIRES_SHARED(art::Locks::mutator_lock_) { in operator ==()
1435 REQUIRES_SHARED(art::Locks::mutator_lock_) { in operator !=()
1466 Redefiner::ClassRedefinition& GetRedefinition() REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetRedefinition()
1474 art::ObjPtr<art::mirror::ClassLoader> GetSourceClassLoader() const in GetSourceClassLoader()
1475 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetSourceClassLoader()
1478 art::ObjPtr<art::mirror::Object> GetJavaDexFile() const in GetJavaDexFile()
1479 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetJavaDexFile()
1482 art::ObjPtr<art::mirror::LongArray> GetNewDexFileCookie() const in GetNewDexFileCookie()
1483 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewDexFileCookie()
1486 art::ObjPtr<art::mirror::DexCache> GetNewDexCache() const in GetNewDexCache()
1487 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewDexCache()
1490 art::ObjPtr<art::mirror::Class> GetMirrorClass() const in GetMirrorClass()
1491 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetMirrorClass()
1494 art::ObjPtr<art::mirror::Object> GetOriginalDexFile() const in GetOriginalDexFile()
1495 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOriginalDexFile()
1498 art::ObjPtr<art::mirror::PointerArray> GetOldObsoleteMethods() const in GetOldObsoleteMethods()
1499 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOldObsoleteMethods()
1502 art::ObjPtr<art::mirror::ObjectArray<art::mirror::DexCache>> GetOldDexCaches() const in GetOldDexCaches()
1503 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOldDexCaches()
1507 art::ObjPtr<art::mirror::Class> GetNewClassObject() const in GetNewClassObject()
1508 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewClassObject()
1512 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> GetOldInstanceObjects() const in GetOldInstanceObjects()
1513 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOldInstanceObjects()
1516 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> GetNewInstanceObjects() const in GetNewInstanceObjects()
1517 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewInstanceObjects()
1520 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> GetOldClasses() const in GetOldClasses()
1521 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetOldClasses()
1524 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> GetNewClasses() const in GetNewClasses()
1525 REQUIRES_SHARED(art::Locks::mutator_lock_) { in GetNewClasses()
1528 bool IsInitialized() const REQUIRES_SHARED(art::Locks::mutator_lock_) { in IsInitialized()
1531 bool IsActuallyStructural() const REQUIRES_SHARED(art::Locks::mutator_lock_) { in IsActuallyStructural()
1534 bool IsInitialStructural() const REQUIRES_SHARED(art::Locks::mutator_lock_) { in IsInitialStructural()
1541 void SetSourceClassLoader(art::mirror::ClassLoader* loader) in SetSourceClassLoader()
1542 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetSourceClassLoader()
1545 void SetJavaDexFile(art::ObjPtr<art::mirror::Object> dexfile) in SetJavaDexFile()
1546 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetJavaDexFile()
1549 void SetNewDexFileCookie(art::ObjPtr<art::mirror::LongArray> cookie) in SetNewDexFileCookie()
1550 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewDexFileCookie()
1553 void SetNewDexCache(art::ObjPtr<art::mirror::DexCache> cache) in SetNewDexCache()
1554 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewDexCache()
1557 void SetMirrorClass(art::ObjPtr<art::mirror::Class> klass) in SetMirrorClass()
1558 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetMirrorClass()
1561 void SetOriginalDexFile(art::ObjPtr<art::mirror::Object> bytes) in SetOriginalDexFile()
1562 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOriginalDexFile()
1565 void SetOldObsoleteMethods(art::ObjPtr<art::mirror::PointerArray> methods) in SetOldObsoleteMethods()
1566 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOldObsoleteMethods()
1569 void SetOldDexCaches(art::ObjPtr<art::mirror::ObjectArray<art::mirror::DexCache>> caches) in SetOldDexCaches()
1570 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOldDexCaches()
1573 void SetNewClassObject(art::ObjPtr<art::mirror::Class> klass) in SetNewClassObject()
1574 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewClassObject()
1577 void SetOldInstanceObjects(art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> objs) in SetOldInstanceObjects()
1578 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOldInstanceObjects()
1581 void SetNewInstanceObjects(art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> objs) in SetNewInstanceObjects()
1582 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewInstanceObjects()
1585 void SetOldClasses(art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> klasses) in SetOldClasses()
1586 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetOldClasses()
1589 void SetNewClasses(art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> klasses) in SetNewClasses()
1590 REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetNewClasses()
1593 void SetInitialized() REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetInitialized()
1596 void SetActuallyStructural() REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetActuallyStructural()
1599 void SetInitialStructural() REQUIRES_SHARED(art::Locks::mutator_lock_) { in SetInitialStructural()
1618 art::StackHandleScope<3> hs(driver_->self_); in CheckVerification()
1621 art::verifier::FailureKind failure = in CheckVerification()
1622 art::verifier::ClassVerifier::VerifyClass(driver_->self_, in CheckVerification()
1633 art::verifier::HardFailLogMode::kLogWarning, in CheckVerification()
1634 art::Runtime::Current()->GetTargetSdkVersion(), in CheckVerification()
1636 if (failure == art::verifier::FailureKind::kHardFailure) { in CheckVerification()
1647 art::Handle<art::mirror::ClassLoader> source_class_loader, in AllocateAndRememberNewDexFileCookie()
1648 art::Handle<art::mirror::Object> dex_file_obj, in AllocateAndRememberNewDexFileCookie()
1650 art::StackHandleScope<2> hs(driver_->self_); in AllocateAndRememberNewDexFileCookie()
1651 art::MutableHandle<art::mirror::LongArray> old_cookie( in AllocateAndRememberNewDexFileCookie()
1652 hs.NewHandle<art::mirror::LongArray>(nullptr)); in AllocateAndRememberNewDexFileCookie()
1671 art::Handle<art::mirror::LongArray> in AllocateAndRememberNewDexFileCookie()
1696 bool CompareClasses(art::ObjPtr<art::mirror::Class> l, art::ObjPtr<art::mirror::Class> r) in CompareClasses()
1697 REQUIRES_SHARED(art::Locks::mutator_lock_) { in CompareClasses()
1698 auto parents = [](art::ObjPtr<art::mirror::Class> c) REQUIRES_SHARED(art::Locks::mutator_lock_) { in CompareClasses()
1715 art::gc::Heap* heap = driver_->runtime_->GetHeap(); in CollectAndCreateNewInstances()
1716 art::VariableSizedHandleScope hs(driver_->self_); in CollectAndCreateNewInstances()
1717 art::Handle<art::mirror::Class> old_klass(hs.NewHandle(cur_data->GetMirrorClass())); in CollectAndCreateNewInstances()
1718 std::vector<art::Handle<art::mirror::Object>> old_instances; in CollectAndCreateNewInstances()
1719 auto is_instance = [&](art::mirror::Object* obj) REQUIRES_SHARED(art::Locks::mutator_lock_) { in CollectAndCreateNewInstances()
1722 heap->VisitObjects([&](art::mirror::Object* obj) REQUIRES_SHARED(art::Locks::mutator_lock_) { in CollectAndCreateNewInstances()
1728 art::Handle<art::mirror::ObjectArray<art::mirror::Class>> old_classes_arr( in CollectAndCreateNewInstances()
1730 art::Handle<art::mirror::ObjectArray<art::mirror::Class>> new_classes_arr( in CollectAndCreateNewInstances()
1734 art::Handle<art::mirror::Class> obj_array_class( in CollectAndCreateNewInstances()
1735 hs.NewHandle(art::GetClassRoot<art::mirror::ObjectArray<art::mirror::Object>>( in CollectAndCreateNewInstances()
1737 art::Handle<art::mirror::ObjectArray<art::mirror::Object>> old_instances_arr( in CollectAndCreateNewInstances()
1738 hs.NewHandle(art::mirror::ObjectArray<art::mirror::Object>::Alloc( in CollectAndCreateNewInstances()
1751 art::Handle<art::mirror::ObjectArray<art::mirror::Object>> new_instances_arr( in CollectAndCreateNewInstances()
1752 hs.NewHandle(art::mirror::ObjectArray<art::mirror::Object>::Alloc( in CollectAndCreateNewInstances()
1760 for (auto pair : art::ZipCount(art::IterationRange(old_instances.begin(), old_instances.end()))) { in CollectAndCreateNewInstances()
1761 art::Handle<art::mirror::Object> hinstance(pair.first); in CollectAndCreateNewInstances()
1763 auto iterator = art::ZipLeft(old_classes_arr.Iterate<art::mirror::Class>(), in CollectAndCreateNewInstances()
1764 new_classes_arr.Iterate<art::mirror::Class>()); in CollectAndCreateNewInstances()
1767 [&](auto class_pair) REQUIRES_SHARED(art::Locks::mutator_lock_) { in CollectAndCreateNewInstances()
1784 art::ObjPtr<art::mirror::Object> new_instance( in CollectAndCreateNewInstances()
1786 art::mirror::Class::AddFinalizer::kNoAddFinalizer, in CollectAndCreateNewInstances()
1805 art::ScopedObjectAccessUnchecked soa(driver_->self_); in FinishRemainingCommonAllocations()
1806 art::StackHandleScope<2> hs(driver_->self_); in FinishRemainingCommonAllocations()
1809 art::Handle<art::mirror::ClassLoader> loader(hs.NewHandle(GetClassLoader())); in FinishRemainingCommonAllocations()
1811 if (!art::ClassLinker::IsBootClassLoader(soa, loader.Get())) { in FinishRemainingCommonAllocations()
1813 art::Handle<art::mirror::Object> dex_file_obj(hs.NewHandle( in FinishRemainingCommonAllocations()
1854 art::VariableSizedHandleScope hs(driver_->self_); in FinishNewClassAllocations()
1859 [this](RedefinitionDataIter* data, art::Handle<art::mirror::Class> super_class) in FinishNewClassAllocations()
1860 REQUIRES_SHARED(art::Locks::mutator_lock_) -> art::ObjPtr<art::mirror::Class> { in FinishNewClassAllocations()
1861 art::StackHandleScope<3> chs(driver_->self_); in FinishNewClassAllocations()
1862 art::Handle<art::mirror::Class> nc( in FinishNewClassAllocations()
1876 std::vector<art::Handle<art::mirror::Class>> old_types; in FinishNewClassAllocations()
1878 art::gc::Heap* heap = driver_->runtime_->GetHeap(); in FinishNewClassAllocations()
1879 art::Handle<art::mirror::Class> in FinishNewClassAllocations()
1884 auto is_subtype = [&](art::mirror::Object* obj) REQUIRES_SHARED(art::Locks::mutator_lock_) { in FinishNewClassAllocations()
1891 heap->VisitObjects([&](art::mirror::Object* obj) REQUIRES_SHARED(art::Locks::mutator_lock_) { in FinishNewClassAllocations()
1901 art::Handle<art::mirror::Class> cls_array_class( in FinishNewClassAllocations()
1902 hs.NewHandle(art::GetClassRoot<art::mirror::ObjectArray<art::mirror::Class>>( in FinishNewClassAllocations()
1904 art::Handle<art::mirror::ObjectArray<art::mirror::Class>> old_classes_arr( in FinishNewClassAllocations()
1905 hs.NewHandle(art::mirror::ObjectArray<art::mirror::Class>::Alloc( in FinishNewClassAllocations()
1915 art::ScopedAssertNoThreadSuspension sants("Sort classes"); in FinishNewClassAllocations()
1920 [](auto& l, auto& r) REQUIRES_SHARED(art::Locks::mutator_lock_) { in FinishNewClassAllocations()
1931 art::Handle<art::mirror::ObjectArray<art::mirror::Class>> new_classes_arr( in FinishNewClassAllocations()
1932 hs.NewHandle(art::mirror::ObjectArray<art::mirror::Class>::Alloc( in FinishNewClassAllocations()
1941 art::MutableHandle<art::mirror::DexCache> dch(hs.NewHandle<art::mirror::DexCache>(nullptr)); in FinishNewClassAllocations()
1942 art::MutableHandle<art::mirror::Class> superclass(hs.NewHandle<art::mirror::Class>(nullptr)); in FinishNewClassAllocations()
1944 art::Handle<art::mirror::Class>& old_type = old_types[i]; in FinishNewClassAllocations()
1952 [&](art::Handle<art::mirror::Class>& v) in FinishNewClassAllocations()
1953 REQUIRES_SHARED(art::Locks::mutator_lock_) { in FinishNewClassAllocations()
1962 *cur_data + 1, holder.end(), [&](auto it) REQUIRES_SHARED(art::Locks::mutator_lock_) { in FinishNewClassAllocations()
1965 art::ObjPtr<art::mirror::Class> new_type; in FinishNewClassAllocations()
1990 uint32_t Redefiner::ClassRedefinition::GetNewClassSize(art::ClassAccessor& accessor) { in GetNewClassSize()
1996 for (const art::ClassAccessor::Field& f : accessor.GetStaticFields()) { in GetNewClassSize()
2014 return art::mirror::Class::ComputeClassSize(/*has_embedded_vtable=*/ false, in GetNewClassSize()
2021 art::kRuntimePointerSize); in GetNewClassSize()
2024 art::ObjPtr<art::mirror::Class>
2025 Redefiner::ClassRedefinition::AllocateNewClassObject(art::Handle<art::mirror::DexCache> cache) { in AllocateNewClassObject()
2026 art::StackHandleScope<2> hs(driver_->self_); in AllocateNewClassObject()
2027 art::Handle<art::mirror::Class> old_class(hs.NewHandle(GetMirrorClass())); in AllocateNewClassObject()
2028 art::Handle<art::mirror::Class> super_class(hs.NewHandle(old_class->GetSuperClass())); in AllocateNewClassObject()
2032 art::ObjPtr<art::mirror::Class> Redefiner::ClassRedefinition::AllocateNewClassObject( in AllocateNewClassObject()
2033 art::Handle<art::mirror::Class> old_class, in AllocateNewClassObject()
2034 art::Handle<art::mirror::Class> super_class, in AllocateNewClassObject()
2035 art::Handle<art::mirror::DexCache> cache, in AllocateNewClassObject()
2042 art::StackHandleScope<3> hs(driver_->self_); in AllocateNewClassObject()
2043 art::ClassLinker* linker = driver_->runtime_->GetClassLinker(); in AllocateNewClassObject()
2044 const art::DexFile* dex_file = cache->GetDexFile(); in AllocateNewClassObject()
2045 art::ClassAccessor accessor(*dex_file, dex_class_def_index); in AllocateNewClassObject()
2046 art::Handle<art::mirror::Class> new_class(hs.NewHandle(linker->AllocClass( in AllocateNewClassObject()
2064 art::ObjectLock<art::mirror::Class> lock(driver_->self_, new_class); in AllocateNewClassObject()
2067 new_class->SetIfTable(art::GetClassRoot<art::mirror::Object>(linker)->GetIfTable()); in AllocateNewClassObject()
2071 art::MutableHandle<art::mirror::Class> linked_class(hs.NewHandle<art::mirror::Class>(nullptr)); in AllocateNewClassObject()
2072 art::Handle<art::mirror::ObjectArray<art::mirror::Class>> proxy_ifaces( in AllocateNewClassObject()
2073 hs.NewHandle<art::mirror::ObjectArray<art::mirror::Class>>(nullptr)); in AllocateNewClassObject()
2076 art::mirror::Class::SetStatus(new_class, art::ClassStatus::kLoaded, nullptr); in AllocateNewClassObject()
2087 art::ObjectLock<art::mirror::Class> objlock(driver_->self_, linked_class); in AllocateNewClassObject()
2102 art::mirror::Class::SetStatus(linked_class, old_class->GetStatus(), driver_->self_); in AllocateNewClassObject()
2107 if (!art::mirror::Class::EnsureInstanceFieldIds(linked_class) || in AllocateNewClassObject()
2108 !art::mirror::Class::EnsureStaticFieldIds(linked_class) || in AllocateNewClassObject()
2109 !art::mirror::Class::EnsureMethodIds(linked_class)) { in AllocateNewClassObject()
2118 linked_class->VisitMethods([&](art::ArtMethod* m) REQUIRES_SHARED(art::Locks::mutator_lock_) { in AllocateNewClassObject()
2125 }, art::kRuntimePointerSize); in AllocateNewClassObject()
2126 if (art::kIsDebugBuild) { in AllocateNewClassObject()
2127 linked_class->VisitFields([&](art::ArtField* f) REQUIRES_SHARED(art::Locks::mutator_lock_) { in AllocateNewClassObject()
2241 ScopedDisableConcurrentAndMovingGc(art::gc::Heap* heap, art::Thread* self) in ScopedDisableConcurrentAndMovingGc()
2254 art::gc::Heap* heap_;
2255 art::Thread* self_;
2258 class ClassDefinitionPauser : public art::ClassLoadCallback {
2260 explicit ClassDefinitionPauser(art::Thread* self) REQUIRES_SHARED(art::Locks::mutator_lock_) in REQUIRES_SHARED()
2264 release_mu_("SuspendClassDefinition lock", art::kGenericBottomLock), in REQUIRES_SHARED()
2269 art::Locks::mutator_lock_->AssertSharedHeld(self_); in REQUIRES_SHARED()
2271 ~ClassDefinitionPauser() REQUIRES_SHARED(art::Locks::mutator_lock_) { in REQUIRES_SHARED()
2272 art::Locks::mutator_lock_->AssertSharedHeld(self_); in REQUIRES_SHARED()
2275 void Release() REQUIRES(art::Locks::mutator_lock_) { in Release()
2277 art::Locks::mutator_lock_->AssertExclusiveHeld(self_); in Release()
2281 art::MutexLock mu(self_, release_mu_); in Release()
2290 release_barrier_.Increment</*locks=*/art::Barrier::kAllowHoldingLocks>(self_, count); in Release()
2295 void BeginDefineClass() override REQUIRES_SHARED(art::Locks::mutator_lock_) { in BeginDefineClass()
2296 art::Thread* this_thread = art::Thread::Current(); in BeginDefineClass()
2309 art::Locks::mutator_lock_->AssertSharedHeld(this_thread); in BeginDefineClass()
2311 art::ScopedThreadSuspension sts(this_thread, art::ThreadState::kSuspended); in BeginDefineClass()
2313 art::MutexLock mu(this_thread, release_mu_); in BeginDefineClass()
2323 void EndDefineClass() override REQUIRES_SHARED(art::Locks::mutator_lock_) { in EndDefineClass()
2324 art::Thread* this_thread = art::Thread::Current(); in EndDefineClass()
2335 void ClassLoad(art::Handle<art::mirror::Class> klass ATTRIBUTE_UNUSED) override {} in ClassLoad()
2336 void ClassPrepare(art::Handle<art::mirror::Class> klass1 ATTRIBUTE_UNUSED, in ClassPrepare()
2337 art::Handle<art::mirror::Class> klass2 ATTRIBUTE_UNUSED) override {} in ClassPrepare()
2342 void WaitFor(uint32_t t) REQUIRES(!art::Locks::mutator_lock_) { in WaitFor()
2347 art::Thread* self_;
2349 art::Barrier barrier_;
2350 art::Mutex release_mu_;
2351 art::Barrier release_barrier_;
2352 art::ConditionVariable release_cond_;
2359 ScopedSuspendClassLoading(art::Thread* self, art::Runtime* runtime, RedefinitionDataHolder& h) in ScopedSuspendClassLoading()
2360 REQUIRES_SHARED(art::Locks::mutator_lock_) in ScopedSuspendClassLoading()
2362 if (std::any_of(h.begin(), h.end(), [](auto r) REQUIRES_SHARED(art::Locks::mutator_lock_) { in ScopedSuspendClassLoading()
2368 art::ScopedThreadSuspension sts(self_, art::ThreadState::kNative); in ScopedSuspendClassLoading()
2371 art::ScopedSuspendAll ssa(__FUNCTION__); in ScopedSuspendClassLoading()
2374 art::MutexLock mu(self_, *art::Locks::thread_list_lock_); in ScopedSuspendClassLoading()
2375 runtime_->GetThreadList()->ForEach([&](art::Thread* t) { in ScopedSuspendClassLoading()
2389 art::ScopedThreadSuspension sts(self_, art::ThreadState::kNative); in ~ScopedSuspendClassLoading()
2390 art::ScopedSuspendAll ssa(__FUNCTION__); in ~ScopedSuspendClassLoading()
2397 art::Thread* self_;
2398 art::Runtime* runtime_;
2404 ScopedSuspendAllocations(art::Runtime* runtime, RedefinitionDataHolder& h) in ScopedSuspendAllocations()
2405 REQUIRES_SHARED(art::Locks::mutator_lock_) in ScopedSuspendAllocations()
2409 [](auto r) REQUIRES_SHARED(art::Locks::mutator_lock_) { in ScopedSuspendAllocations()
2414 AllocationManager::Get()->PauseAllocations(art::Thread::Current()); in ScopedSuspendAllocations()
2420 ~ScopedSuspendAllocations() REQUIRES_SHARED(art::Locks::mutator_lock_) { in REQUIRES_SHARED()
2422 AllocationManager::Get()->ResumeAllocations(art::Thread::Current()); in REQUIRES_SHARED()
2433 art::StackHandleScope<1> hs(self_); in Run()
2438 [&](auto& l, auto& r) REQUIRES_SHARED(art::Locks::mutator_lock_) { in Run()
2477 art::ClassLinker* cl = runtime_->GetClassLinker(); in Run()
2496 art::ScopedThreadSuspension sts(self_, art::ThreadState::kNative); in Run()
2497 art::ScopedSuspendAll ssa("Final installation of redefined Classes!", /*long_suspend=*/true); in Run()
2499 art::ScopedAssertNoThreadSuspension nts("Updating runtime objects for redefinition"); in Run()
2518 void Redefiner::ClassRedefinition::UpdateMethods(art::ObjPtr<art::mirror::Class> mclass, in UpdateMethods()
2519 const art::dex::ClassDef& class_def) { in UpdateMethods()
2520 art::ClassLinker* linker = driver_->runtime_->GetClassLinker(); in UpdateMethods()
2521 art::PointerSize image_pointer_size = linker->GetImagePointerSize(); in UpdateMethods()
2522 const art::dex::TypeId& declaring_class_id = dex_file_->GetTypeId(class_def.class_idx_); in UpdateMethods()
2523 const art::DexFile& old_dex_file = mclass->GetDexFile(); in UpdateMethods()
2525 for (art::ArtMethod& method : mclass->GetDeclaredMethods(image_pointer_size)) { in UpdateMethods()
2526 const art::dex::StringId* new_name_id = dex_file_->FindStringId(method.GetName()); in UpdateMethods()
2527 art::dex::TypeIndex method_return_idx = in UpdateMethods()
2530 std::vector<art::dex::TypeIndex> new_type_list; in UpdateMethods()
2539 const art::dex::ProtoId* proto_id = dex_file_->FindProtoId(method_return_idx, new_type_list); in UpdateMethods()
2541 const art::dex::MethodId* method_id = dex_file_->FindMethodId(declaring_class_id, in UpdateMethods()
2558 void Redefiner::ClassRedefinition::UpdateFields(art::ObjPtr<art::mirror::Class> mclass) { in UpdateFields()
2561 for (art::ArtField& field : fields_iter) { in UpdateFields()
2563 const art::dex::TypeId* new_declaring_id = in UpdateFields()
2565 const art::dex::StringId* new_name_id = dex_file_->FindStringId(field.GetName()); in UpdateFields()
2566 const art::dex::TypeId* new_type_id = dex_file_->FindTypeId(field.GetTypeDescriptor()); in UpdateFields()
2568 const art::dex::FieldId* new_field_id = in UpdateFields()
2580 std::map<art::ArtMethod*, art::ArtMethod*>* method_map, in CollectNewFieldAndMethodMappings()
2581 std::map<art::ArtField*, art::ArtField*>* field_map) { in CollectNewFieldAndMethodMappings()
2583 art::ZipLeft(data.GetNewClasses()->Iterate(), data.GetOldClasses()->Iterate())) { in CollectNewFieldAndMethodMappings()
2584 for (art::ArtField& f : old_cls->GetSFields()) { in CollectNewFieldAndMethodMappings()
2587 for (art::ArtField& f : old_cls->GetIFields()) { in CollectNewFieldAndMethodMappings()
2590 auto new_methods = new_cls->GetMethods(art::kRuntimePointerSize); in CollectNewFieldAndMethodMappings()
2591 for (art::ArtMethod& m : old_cls->GetMethods(art::kRuntimePointerSize)) { in CollectNewFieldAndMethodMappings()
2597 [&](art::ArtMethod& cand) REQUIRES_SHARED(art::Locks::mutator_lock_) { in CollectNewFieldAndMethodMappings()
2607 static void CopyField(art::ObjPtr<art::mirror::Object> target, in CopyField()
2608 art::ArtField* new_field, in CopyField()
2609 art::ObjPtr<art::mirror::Object> source, in CopyField()
2610 art::ArtField& old_field) REQUIRES(art::Locks::mutator_lock_) { in CopyField()
2611 art::Primitive::Type ftype = old_field.GetTypeAsPrimitiveType(); in CopyField()
2614 if (ftype == art::Primitive::kPrimNot) { in CopyField()
2619 case art::Primitive::kPrim##TYPE: \ in CopyField()
2630 case art::Primitive::kPrimNot: in CopyField()
2631 case art::Primitive::kPrimVoid: in CopyField()
2640 art::ObjPtr<art::mirror::Object> target, in CopyFields()
2641 art::ObjPtr<art::mirror::Class> target_class, in CopyFields()
2642 art::ObjPtr<art::mirror::Object> source, in CopyFields()
2643 art::ObjPtr<art::mirror::Class> source_class) in CopyFields()
2644 REQUIRES(art::Locks::mutator_lock_) { in CopyFields()
2648 for (art::ArtField& f : (is_static ? source_class->GetSFields() : source_class->GetIFields())) { in CopyFields()
2649 art::ArtField* new_field = in CopyFields()
2661 static void ClearField(art::ObjPtr<art::mirror::Object> target, art::ArtField& field) in ClearField()
2662 REQUIRES(art::Locks::mutator_lock_) { in ClearField()
2663 art::Primitive::Type ftype = field.GetTypeAsPrimitiveType(); in ClearField()
2664 if (ftype == art::Primitive::kPrimNot) { in ClearField()
2669 case art::Primitive::kPrim##TYPE: \ in ClearField()
2680 case art::Primitive::kPrimNot: in ClearField()
2681 case art::Primitive::kPrimVoid: in ClearField()
2690 art::ObjPtr<art::mirror::Object> target, in ClearFields()
2691 art::ObjPtr<art::mirror::Class> target_class) in ClearFields()
2692 REQUIRES(art::Locks::mutator_lock_) { in ClearFields()
2694 for (art::ArtField& f : (is_static ? target_class->GetSFields() : target_class->GetIFields())) { in ClearFields()
2703 art::ObjPtr<art::mirror::Object> target, in CopyAndClearFields()
2704 art::ObjPtr<art::mirror::Class> target_class, in CopyAndClearFields()
2705 art::ObjPtr<art::mirror::Object> source, in CopyAndClearFields()
2706 art::ObjPtr<art::mirror::Class> source_class) in CopyAndClearFields()
2707 REQUIRES(art::Locks::mutator_lock_) { in CopyAndClearFields()
2713 source->SetLockWord(art::LockWord::Default(), false); in CopyAndClearFields()
2714 art::WriteBarrier::ForEveryFieldWrite(target); in CopyAndClearFields()
2718 art::WriteBarrier::ForEveryFieldWrite(source); in CopyAndClearFields()
2727 art::Locks::mutator_lock_->AssertExclusiveHeld(driver_->self_); in UpdateClassStructurally()
2728 art::ClassLinker* cl = driver_->runtime_->GetClassLinker(); in UpdateClassStructurally()
2729 art::ScopedAssertNoThreadSuspension sants(__FUNCTION__); in UpdateClassStructurally()
2730 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> new_classes(holder.GetNewClasses()); in UpdateClassStructurally()
2731 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Class>> old_classes(holder.GetOldClasses()); in UpdateClassStructurally()
2733 std::map<art::ArtMethod*, art::ArtMethod*> method_map; in UpdateClassStructurally()
2734 std::map<art::ArtField*, art::ArtField*> field_map; in UpdateClassStructurally()
2736 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> new_instances( in UpdateClassStructurally()
2738 art::ObjPtr<art::mirror::ObjectArray<art::mirror::Object>> old_instances( in UpdateClassStructurally()
2742 std::vector<art::ObjPtr<art::mirror::Class>> old_classes_vec(old_classes->Iterate().begin(), in UpdateClassStructurally()
2745 for (auto [new_class, old_class] : art::ZipLeft(new_classes->Iterate(), old_classes->Iterate())) { in UpdateClassStructurally()
2759 art::ZipLeft(new_instances->Iterate(), old_instances->Iterate())) { in UpdateClassStructurally()
2767 for (auto [old_class, new_class] : art::ZipLeft(old_classes->Iterate(), new_classes->Iterate())) { in UpdateClassStructurally()
2773 for (art::ArtMethod& m : old_class->GetMethods(art::kRuntimePointerSize)) { in UpdateClassStructurally()
2775 art::ArtMethod* new_method = in UpdateClassStructurally()
2776 new_class->FindClassMethod(m.GetNameView(), m.GetSignature(), art::kRuntimePointerSize); in UpdateClassStructurally()
2777 DCHECK(new_class->GetMethodsSlice(art::kRuntimePointerSize).Contains(new_method)) in UpdateClassStructurally()
2791 const auto& info) REQUIRES(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2792 constexpr bool is_method = std::is_same_v<art::ArtMethod*, decltype(field_or_method)>; in UpdateClassStructurally()
2793 static_assert(is_method || std::is_same_v<art::ArtField*, decltype(field_or_method)>, in UpdateClassStructurally()
2796 if (LIKELY(info.GetType() != art::ReflectionSourceType::kSourceDexCacheResolvedField && in UpdateClassStructurally()
2797 info.GetType() != art::ReflectionSourceType::kSourceDexCacheResolvedMethod)) { in UpdateClassStructurally()
2815 art::ObjPtr<art::mirror::Class> f_or_m_class = field_or_method->GetDeclaringClass(); in UpdateClassStructurally()
2825 [&](art::ObjPtr<art::mirror::Class> cand) REQUIRES(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2826 auto direct_methods = cand->GetDirectMethods(art::kRuntimePointerSize); in UpdateClassStructurally()
2829 [&](art::ArtMethod& m) REQUIRES(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2834 auto pred = [&](art::ArtField& f) REQUIRES(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2843 [&](art::ObjPtr<art::mirror::Class> cand) REQUIRES(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2851 [&](art::ObjPtr<art::mirror::Class> cand) REQUIRES(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2861 [&](art::ArtField* f, const auto& info) REQUIRES(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2867 return static_cast<art::ArtField*>(nullptr); in UpdateClassStructurally()
2875 [&](art::ArtMethod* m, const auto& info) REQUIRES(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2881 return static_cast<art::ArtMethod*>(nullptr); in UpdateClassStructurally()
2893 std::unordered_map<art::ObjPtr<art::mirror::Object>, in UpdateClassStructurally()
2894 art::ObjPtr<art::mirror::Object>, in UpdateClassStructurally()
2895 art::HashObjPtr> map; in UpdateClassStructurally()
2896 for (auto [new_class, old_class] : art::ZipLeft(new_classes->Iterate(), old_classes->Iterate())) { in UpdateClassStructurally()
2900 art::ZipLeft(new_instances->Iterate(), old_instances->Iterate())) { in UpdateClassStructurally()
2916 art::ZipLeft(new_classes->Iterate(), art::MakeIterationRange(old_classes_vec))) { in UpdateClassStructurally()
2920 art::jit::Jit* jit = driver_->runtime_->GetJit(); in UpdateClassStructurally()
2932 art::MutexLock mu(driver_->self_, *art::Locks::thread_list_lock_); in UpdateClassStructurally()
2934 [](art::Thread* t) { t->GetInterpreterCache()->Clear(t); }); in UpdateClassStructurally()
2937 if (art::kIsDebugBuild) { in UpdateClassStructurally()
2943 [](art::ObjPtr<art::mirror::Class> orig) REQUIRES_SHARED(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2945 [&](art::ArtMethod* method) REQUIRES_SHARED(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2953 art::kRuntimePointerSize); in UpdateClassStructurally()
2954 orig->VisitFields([&](art::ArtField* field) REQUIRES_SHARED(art::Locks::mutator_lock_) { in UpdateClassStructurally()
2964 art::ObjPtr<art::mirror::Class> mclass(holder.GetMirrorClass()); in UpdateClassInPlace()
2967 art::ObjPtr<art::mirror::DexCache> new_dex_cache(holder.GetNewDexCache()); in UpdateClassInPlace()
2968 art::ObjPtr<art::mirror::Object> original_dex_file(holder.GetOriginalDexFile()); in UpdateClassInPlace()
2970 const art::dex::ClassDef& class_def = dex_file_->GetClassDef(0); in UpdateClassInPlace()
2974 art::ObjPtr<art::mirror::ClassExt> ext(mclass->GetExtData()); in UpdateClassInPlace()
2997 art::jit::Jit* jit = driver_->runtime_->GetJit(); in UpdateClassInPlace()
2999 art::PointerSize image_pointer_size = in UpdateClassInPlace()
3004 for (art::ArtMethod& method : mclass->GetDeclaredMethods(image_pointer_size)) { in UpdateClassInPlace()
3030 art::ObjPtr<art::mirror::Class> klass = GetMirrorClass(); in RestoreObsoleteMethodMapsIfUnneeded()
3031 art::ObjPtr<art::mirror::ClassExt> ext = klass->GetExtData(); in RestoreObsoleteMethodMapsIfUnneeded()
3032 art::ObjPtr<art::mirror::PointerArray> methods = ext->GetObsoleteMethods(); in RestoreObsoleteMethodMapsIfUnneeded()
3033 art::ObjPtr<art::mirror::PointerArray> old_methods = cur_data->GetOldObsoleteMethods(); in RestoreObsoleteMethodMapsIfUnneeded()
3043 art::ArtMethod* expected = nullptr; in RestoreObsoleteMethodMapsIfUnneeded()
3045 expected = old_methods->GetElementPtrSize<art::ArtMethod*>(i, art::kRuntimePointerSize); in RestoreObsoleteMethodMapsIfUnneeded()
3047 if (methods->GetElementPtrSize<art::ArtMethod*>(i, art::kRuntimePointerSize) != expected) { in RestoreObsoleteMethodMapsIfUnneeded()
3062 art::StackHandleScope<2> hs(driver_->self_); in EnsureClassAllocationsFinished()
3063 art::Handle<art::mirror::Class> klass(hs.NewHandle( in EnsureClassAllocationsFinished()
3070 art::Handle<art::mirror::ClassExt> ext = in EnsureClassAllocationsFinished()
3071 hs.NewHandle(art::mirror::Class::EnsureExtDataPresent(klass, driver_->self_)); in EnsureClassAllocationsFinished()
3088 if (!art::mirror::ClassExt::ExtendObsoleteArrays( in EnsureClassAllocationsFinished()
3089 ext, driver_->self_, klass->GetDeclaredMethodsSlice(art::kRuntimePointerSize).size())) { in EnsureClassAllocationsFinished()