summaryrefslogtreecommitdiff
path: root/runtime/class_table.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2021-02-05 13:33:28 +0000
committer Vladimir Marko <vmarko@google.com> 2021-02-08 10:49:38 +0000
commiteae6a7121925b95477b92b404d85645e665bc948 (patch)
tree1a2155272c19c5aa60ad5eebe27e881f87e63088 /runtime/class_table.h
parent1ee12675375f97790f2ad2bbd0196c1847f858fb (diff)
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
Diffstat (limited to 'runtime/class_table.h')
-rw-r--r--runtime/class_table.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/runtime/class_table.h b/runtime/class_table.h
index 544a26b992..375954ac18 100644
--- a/runtime/class_table.h
+++ b/runtime/class_table.h
@@ -103,18 +103,22 @@ class ClassTable {
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 @@ class ClassTable {
// should be compared for a matching class descriptor and class loader.
typedef HashSet<TableSlot,
TableSlotEmptyFn,
- ClassDescriptorHashEquals,
- ClassDescriptorHashEquals,
+ ClassDescriptorHash,
+ ClassDescriptorEquals,
TrackingAllocator<TableSlot, kAllocatorTagClassTable>> ClassSet;
ClassTable();