From 6fbcc2915949d0680e6e9578a5836ee8dcbc467f Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Tue, 23 Feb 2021 01:05:32 +0000 Subject: Change ClassLinker::dex_caches_ from list to unordered_map. Move the DexFile* pointer from struct field out to map key. This makes it easy and fast to find DexCache from DexFile. Add check that given DexFile* is registered only once. Test: test.py -b -r --host --64 Test: generated images are identical as before Change-Id: I84a6d6cbf963af2408abe5bb5e4c99d0ca11df78 --- runtime/class_linker_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/class_linker_test.cc') diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index e0f498d6aa..035a9cbfa5 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -1520,7 +1520,8 @@ TEST_F(ClassLinkerTest, RegisterDexFileName) { MutableHandle dex_cache(hs.NewHandle(nullptr)); { ReaderMutexLock mu(soa.Self(), *Locks::dex_lock_); - for (const ClassLinker::DexCacheData& data : class_linker->GetDexCachesData()) { + for (const auto& entry : class_linker->GetDexCachesData()) { + const ClassLinker::DexCacheData& data = entry.second; dex_cache.Assign(soa.Self()->DecodeJObject(data.weak_root)->AsDexCache()); if (dex_cache != nullptr) { break; -- cgit v1.2.3-59-g8ed1b