diff options
author | 2017-02-13 18:32:04 -0800 | |
---|---|---|
committer | 2017-02-13 19:34:54 -0800 | |
commit | 5812e20ff7cbc8efa0b8d7486ada2f58840a6ad5 (patch) | |
tree | be0e9fdeb90bcbad76b17b3aae4e746d977d80ee /runtime/class_linker-inl.h | |
parent | 518f373324f355f8e58440dfbc3f5a1f2244bde7 (diff) |
Revert^3 "Hash-based dex cache type array."
Assert failing for "earchbox:search":
F zygote64: class_linker.cc:4612] Check failed: handle_scope_iface.Get() != nullptr
Test: m test-art-host
Bug: 34839984
Bug: 30627598
Bug: 34659969
This reverts commit 85c0f2ac03417f5125bc2ff1dab8109859c67d5c.
Change-Id: I39846c20295af5875b0f945be7035c73ded23135
Diffstat (limited to 'runtime/class_linker-inl.h')
-rw-r--r-- | runtime/class_linker-inl.h | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h index bd510ca0e1..3438810069 100644 --- a/runtime/class_linker-inl.h +++ b/runtime/class_linker-inl.h @@ -78,18 +78,6 @@ 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) { @@ -103,6 +91,25 @@ 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(); } |