Avoid an unnecessary ComputeModifiedUtf8Hash().
The DescriptorHashPair already has the hash as the member
`second`, so avoid recalculating it in release mode.
Also split "HashEquals" classes into separate "Hash" and
"Equals" classes to disambiguate their operators in traces.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 175869411
Change-Id: I87cbe613778c7d310ba5c2bf437729244780472c
diff --git a/runtime/class_table.h b/runtime/class_table.h
index 544a26b..375954a 100644
--- a/runtime/class_table.h
+++ b/runtime/class_table.h
@@ -103,18 +103,22 @@
using DescriptorHashPair = std::pair<const char*, uint32_t>;
- class ClassDescriptorHashEquals {
+ class ClassDescriptorHash {
public:
// uint32_t for cross compilation.
uint32_t operator()(const TableSlot& slot) const NO_THREAD_SAFETY_ANALYSIS;
+ // uint32_t for cross compilation.
+ uint32_t operator()(const DescriptorHashPair& pair) const NO_THREAD_SAFETY_ANALYSIS;
+ };
+
+ class ClassDescriptorEquals {
+ public:
// Same class loader and descriptor.
bool operator()(const TableSlot& a, const TableSlot& b) const
NO_THREAD_SAFETY_ANALYSIS;
// Same descriptor.
bool operator()(const TableSlot& a, const DescriptorHashPair& b) const
NO_THREAD_SAFETY_ANALYSIS;
- // uint32_t for cross compilation.
- uint32_t operator()(const DescriptorHashPair& pair) const NO_THREAD_SAFETY_ANALYSIS;
};
class TableSlotEmptyFn {
@@ -132,8 +136,8 @@
// should be compared for a matching class descriptor and class loader.
typedef HashSet<TableSlot,
TableSlotEmptyFn,
- ClassDescriptorHashEquals,
- ClassDescriptorHashEquals,
+ ClassDescriptorHash,
+ ClassDescriptorEquals,
TrackingAllocator<TableSlot, kAllocatorTagClassTable>> ClassSet;
ClassTable();