diff options
author | Vladimir Marko <vmarko@google.com> | 2017-02-14 14:08:12 +0000 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2017-02-20 14:13:14 +0000 |
commit | bfb80d25eaeb7a604d5dd25a370e3869e96a33ab (patch) | |
tree | 96068dd9b9b3bc2e1bcc25d38bbd2420d5b0f1bb /runtime/class_linker-inl.h | |
parent | 7a49d93ee265b978ab29cae659e46d41da78459a (diff) | |
download | art-bfb80d25eaeb7a604d5dd25a370e3869e96a33ab.tar.gz art-bfb80d25eaeb7a604d5dd25a370e3869e96a33ab.tar.bz2 art-bfb80d25eaeb7a604d5dd25a370e3869e96a33ab.zip |
Revert^4 "Hash-based dex cache type array."
Added extra output to the abort message to collect more data
when we hit the crash. Added extra check when loading an app
image to verify that the class table isn't already broken.
Test: testrunner.py --host
Bug: 34839984
Bug: 30627598
Bug: 34659969
This reverts commit 5812e20ff7cbc8efa0b8d7486ada2f58840a6ad5.
Change-Id: I9bb442a184c236dcb75b3e42a095f39cd6bee59d
Diffstat (limited to 'runtime/class_linker-inl.h')
-rw-r--r-- | runtime/class_linker-inl.h | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h index 3438810069..bd510ca0e1 100644 --- a/runtime/class_linker-inl.h +++ b/runtime/class_linker-inl.h @@ -78,6 +78,18 @@ inline mirror::String* ClassLinker::ResolveString(dex::StringIndex string_idx, return string.Ptr(); } +inline ObjPtr<mirror::Class> ClassLinker::LookupResolvedType( + dex::TypeIndex type_idx, + ObjPtr<mirror::DexCache> dex_cache, + ObjPtr<mirror::ClassLoader> class_loader) { + ObjPtr<mirror::Class> type = dex_cache->GetResolvedType(type_idx); + if (type == nullptr) { + type = Runtime::Current()->GetClassLinker()->LookupResolvedType( + *dex_cache->GetDexFile(), type_idx, dex_cache, class_loader); + } + return type; +} + inline mirror::Class* ClassLinker::ResolveType(dex::TypeIndex type_idx, ArtMethod* referrer) { Thread::PoisonObjectPointersIfDebug(); if (kIsDebugBuild) { @@ -91,25 +103,6 @@ inline mirror::Class* ClassLinker::ResolveType(dex::TypeIndex type_idx, ArtMetho Handle<mirror::ClassLoader> class_loader(hs.NewHandle(declaring_class->GetClassLoader())); const DexFile& dex_file = *dex_cache->GetDexFile(); resolved_type = ResolveType(dex_file, type_idx, dex_cache, class_loader); - // Note: We cannot check here to see whether we added the type to the cache. The type - // might be an erroneous class, which results in it being hidden from us. - } - return resolved_type.Ptr(); -} - -inline mirror::Class* ClassLinker::ResolveType(dex::TypeIndex type_idx, ArtField* referrer) { - Thread::PoisonObjectPointersIfDebug(); - ObjPtr<mirror::Class> declaring_class = referrer->GetDeclaringClass(); - ObjPtr<mirror::DexCache> dex_cache_ptr = declaring_class->GetDexCache(); - ObjPtr<mirror::Class> resolved_type = dex_cache_ptr->GetResolvedType(type_idx); - if (UNLIKELY(resolved_type == nullptr)) { - StackHandleScope<2> hs(Thread::Current()); - Handle<mirror::DexCache> dex_cache(hs.NewHandle(dex_cache_ptr)); - Handle<mirror::ClassLoader> class_loader(hs.NewHandle(declaring_class->GetClassLoader())); - const DexFile& dex_file = *dex_cache->GetDexFile(); - resolved_type = ResolveType(dex_file, type_idx, dex_cache, class_loader); - // Note: We cannot check here to see whether we added the type to the cache. The type - // might be an erroneous class, which results in it being hidden from us. } return resolved_type.Ptr(); } |