diff options
-rw-r--r-- | runtime/class_linker.cc | 2 | ||||
-rw-r--r-- | runtime/mirror/class.cc | 1 | ||||
-rw-r--r-- | runtime/mirror/class.h | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index f092772239..4bd702d0aa 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2780,7 +2780,7 @@ void ClassLinker::LoadClass(Thread* self, const DexFile& dex_file, klass->SetDexClassDefIndex(dex_file.GetIndexForClassDef(dex_class_def)); klass->SetDexTypeIndex(dex_class_def.class_idx_); - klass->SetDexCacheStrings(klass->GetDexCache()->GetStrings()); + CHECK(klass->GetDexCacheStrings() != nullptr); const uint8_t* class_data = dex_file.GetClassData(dex_class_def); if (class_data == nullptr) { diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc index 566505911b..bd3bfbf9fe 100644 --- a/runtime/mirror/class.cc +++ b/runtime/mirror/class.cc @@ -149,6 +149,7 @@ void Class::SetStatus(Status new_status, Thread* self) { void Class::SetDexCache(DexCache* new_dex_cache) { SetFieldObject<false>(OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_), new_dex_cache); + SetDexCacheStrings(new_dex_cache != nullptr ? new_dex_cache->GetStrings() : nullptr); } void Class::SetClassSize(uint32_t new_class_size) { diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h index 56867dd319..812cfd30b1 100644 --- a/runtime/mirror/class.h +++ b/runtime/mirror/class.h @@ -658,6 +658,7 @@ class MANAGED Class FINAL : public Object { template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags> DexCache* GetDexCache() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + // Also updates the dex_cache_strings_ variable from new_dex_cache. void SetDexCache(DexCache* new_dex_cache) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); ALWAYS_INLINE ObjectArray<ArtMethod>* GetDirectMethods() |