From 4ca70a3102c10e2e77e97fc3b9180f00304ed29b Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Tue, 21 Feb 2017 16:22:24 -0800 Subject: [PATCH] Fix handling of array types when extracting the offline inline caches Test: m test-art-host regression test is being worked out Bug: 35621933 Change-Id: If762db76cc0493db8c8babab62035e915b660da5 --- runtime/jit/jit_code_cache.cc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index c226a3829..b1ba95287 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -1264,12 +1264,27 @@ void JitCodeCache::GetProfiledMethods(const std::set& dex_base_loca if (cls == nullptr) { break; } - const DexFile& class_dex_file = cls->GetDexFile(); - dex::TypeIndex type_index = cls->GetDexTypeIndex(); - if (ContainsElement(dex_base_locations, class_dex_file.GetBaseLocation())) { + + const DexFile* class_dex_file = nullptr; + dex::TypeIndex type_index; + + if (cls->GetDexCache() == nullptr) { + DCHECK(cls->IsArrayClass()) << cls->PrettyClass(); + class_dex_file = dex_file; + type_index = cls->FindTypeIndexInOtherDexFile(*dex_file); + } else { + class_dex_file = &(cls->GetDexFile()); + type_index = cls->GetDexTypeIndex(); + } + if (!type_index.IsValid()) { + // Could be a proxy class or an array for which we couldn't find the type index. + // TODO(calin): can we really miss the type index for arrays here? + continue; + } + if (ContainsElement(dex_base_locations, class_dex_file->GetBaseLocation())) { // Only consider classes from the same apk (including multidex). profile_classes.emplace_back(/*ProfileMethodInfo::ProfileClassReference*/ - &class_dex_file, type_index); + class_dex_file, type_index); } } if (!profile_classes.empty()) { -- 2.11.0