summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2024-05-09 07:45:02 +0000
committer VladimĂ­r Marko <vmarko@google.com> 2024-05-13 06:04:55 +0000
commitffc0d1f69841fe4dcc8dca0676fb13466b9b8132 (patch)
treebc0846ea69dd927ac32be495a5fea03ef52af9dd /runtime/class_linker.cc
parent0bfa9a15cca4fbd2710ee3eead13bdd4dccaf86b (diff)
Faster `ClassTable::UpdateClass()`.
In the `ClassTable::UpdateClass()`, both the old and the new `Class` objects reference the same dex file and type index. Therefore it's better to do the lookup with the new `Class` object as the `Class:DescriptorEquals(ObjPtr<Class>)` can avoid the string comparison for the descriptor match in this case and we compare descriptors only for hash conflicts. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 338123769 Change-Id: I23960c9c3b34b7f7fdd2fce6b191fd9c4efe7320
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 08cc153d84..501470c4b5 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -6403,7 +6403,7 @@ bool ClassLinker::LinkClass(Thread* self,
const ObjPtr<mirror::ClassLoader> class_loader = h_new_class.Get()->GetClassLoader();
ClassTable* const table = InsertClassTableForClassLoader(class_loader);
const ObjPtr<mirror::Class> existing =
- table->UpdateClass(descriptor, h_new_class.Get(), ComputeModifiedUtf8Hash(descriptor));
+ table->UpdateClass(h_new_class.Get(), ComputeModifiedUtf8Hash(descriptor));
CHECK_EQ(existing, klass.Get());
WriteBarrierOnClassLoaderLocked(class_loader, h_new_class.Get());
}