From ffc0d1f69841fe4dcc8dca0676fb13466b9b8132 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 9 May 2024 07:45:02 +0000 Subject: 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)` 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 --- runtime/class_table.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'runtime/class_table.h') 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 UpdateClass(const char* descriptor, - ObjPtr new_klass, - size_t hash) + ObjPtr UpdateClass(ObjPtr new_klass, size_t hash) REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); -- cgit v1.2.3-59-g8ed1b