diff options
author | 2022-04-20 17:21:21 +0100 | |
---|---|---|
committer | 2022-04-20 17:28:28 +0100 | |
commit | a23cf27371c4dba8fcc920d688b362926564107d (patch) | |
tree | cee1150b2fbdbe41a7a12a4d927f874e107fa029 /runtime/class_table.cc | |
parent | 1ae89252330db4619eabf732bf688aabd82f763c (diff) |
Add comments about class/intern table search order.
Also add a related comment about pruning classes only from
the last class set in the `ClassTable` and move some local
variables out of a loop.
Test: Rely on TreeHugger.
Bug: 181943478
Change-Id: Iba1296fb60fde2f90e1e256865bf02ebc3d8f292
Diffstat (limited to 'runtime/class_table.cc')
-rw-r--r-- | runtime/class_table.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/class_table.cc b/runtime/class_table.cc index a4bc1fbc00..10f60ab508 100644 --- a/runtime/class_table.cc +++ b/runtime/class_table.cc @@ -135,6 +135,11 @@ size_t ClassTable::NumReferencedNonZygoteClasses() const { ObjPtr<mirror::Class> ClassTable::Lookup(const char* descriptor, size_t hash) { DescriptorHashPair pair(descriptor, hash); ReaderMutexLock mu(Thread::Current(), lock_); + // Search from the last table, assuming that apps shall search for their own classes + // more often than for boot image classes. For prebuilt boot images, this also helps + // by searching the large table from the framework boot image extension compiled as + // single-image before the individual small tables from the primary boot image + // compiled as multi-image. for (ClassSet& class_set : ReverseRange(classes_)) { auto it = class_set.FindWithHash(pair, hash); if (it != class_set.end()) { |