summaryrefslogtreecommitdiff
path: root/runtime/class_table.h
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_table.h
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_table.h')
-rw-r--r--runtime/class_table.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/runtime/class_table.h b/runtime/class_table.h
index 1c9b0ce2e9..3374622f00 100644
--- a/runtime/class_table.h
+++ b/runtime/class_table.h
@@ -187,9 +187,7 @@ class ClassTable {
REQUIRES_SHARED(Locks::mutator_lock_);
// Update a class in the table with the new class. Returns the existing class which was replaced.
- ObjPtr<mirror::Class> UpdateClass(const char* descriptor,
- ObjPtr<mirror::Class> new_klass,
- size_t hash)
+ ObjPtr<mirror::Class> UpdateClass(ObjPtr<mirror::Class> new_klass, size_t hash)
REQUIRES(!lock_)
REQUIRES_SHARED(Locks::mutator_lock_);