summaryrefslogtreecommitdiff
path: root/absl/container/internal/raw_hash_set.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2023-01-31 08:00:06 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-01-31 08:01:11 -0800
commitdcddc54407e44b55815e9aa784c84f5c933ca310 (patch)
tree05bae0e3d6fb8db2258d55c94506aa70ee6232cb /absl/container/internal/raw_hash_set.cc
parented59f62f8bbc5f05bcba2f89ee16f107e03813f2 (diff)
Rollback in sanitizer mode, detect when references become invalidated by randomly rehashing on insertions when there is no reserved growth.
Rollback of ed59f62f8bbc5f05bcba2f89ee16f107e03813f2 PiperOrigin-RevId: 506003574 Change-Id: I1766321f279a3226e2821e0390387d5639d28964
Diffstat (limited to 'absl/container/internal/raw_hash_set.cc')
-rw-r--r--absl/container/internal/raw_hash_set.cc15
1 files changed, 0 insertions, 15 deletions
diff --git a/absl/container/internal/raw_hash_set.cc b/absl/container/internal/raw_hash_set.cc
index 5dc8b2fa..3677ac59 100644
--- a/absl/container/internal/raw_hash_set.cc
+++ b/absl/container/internal/raw_hash_set.cc
@@ -19,7 +19,6 @@
#include <cstring>
#include "absl/base/config.h"
-#include "absl/hash/hash.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
@@ -52,20 +51,6 @@ inline size_t RandomSeed() {
return value ^ static_cast<size_t>(reinterpret_cast<uintptr_t>(&counter));
}
-bool CommonFieldsGenerationInfoEnabled::
- should_rehash_for_bug_detection_on_insert(const ctrl_t* ctrl,
- size_t capacity) const {
- if (reserved_growth_ == kReservedGrowthJustRanOut) return true;
- if (reserved_growth_ > 0) return false;
- // Note: we can't use the abseil-random library because abseil-random
- // depends on swisstable. We want to return true with probability
- // `min(1, RehashProbabilityConstant() / capacity())`. In order to do this,
- // we probe based on a random hash and see if the offset is less than
- // RehashProbabilityConstant().
- return probe(ctrl, capacity, absl::HashOf(RandomSeed())).offset() <
- RehashProbabilityConstant();
-}
-
bool ShouldInsertBackwards(size_t hash, const ctrl_t* ctrl) {
// To avoid problems with weak hashes and single bit tests, we use % 13.
// TODO(kfm,sbenza): revisit after we do unconditional mixing