From dcddc54407e44b55815e9aa784c84f5c933ca310 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 31 Jan 2023 08:00:06 -0800 Subject: 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 --- absl/container/internal/raw_hash_set.cc | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'absl/container/internal/raw_hash_set.cc') 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 #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(reinterpret_cast(&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 -- cgit v1.2.3