summaryrefslogtreecommitdiff
path: root/runtime/class_linker-inl.h
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2021-02-23 01:05:32 +0000
committer David Srbecky <dsrbecky@google.com> 2021-10-05 13:12:20 +0000
commit6fbcc2915949d0680e6e9578a5836ee8dcbc467f (patch)
treeb5dfdf2ab21f693ca2d702345263bcefa9448291 /runtime/class_linker-inl.h
parent0069ad7ddb159a8d368e0f6a289d0335238ae6c4 (diff)
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
Diffstat (limited to 'runtime/class_linker-inl.h')
-rw-r--r--runtime/class_linker-inl.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h
index da066d1180..4e8f8edf64 100644
--- a/runtime/class_linker-inl.h
+++ b/runtime/class_linker-inl.h
@@ -455,10 +455,8 @@ void ClassLinker::VisitKnownDexFiles(Thread* self, Visitor visitor) {
ReaderMutexLock rmu(self, *Locks::dex_lock_);
std::for_each(dex_caches_.begin(),
dex_caches_.end(),
- [&](DexCacheData& dcd) REQUIRES(Locks::mutator_lock_) {
- if (dcd.IsValid()) {
- visitor(dcd.dex_file);
- }
+ [&](const auto& entry) REQUIRES(Locks::mutator_lock_) {
+ visitor(/*dex_file=*/entry.first);
});
}