diff --git a/absl/base/internal/low_level_alloc.cc b/absl/base/internal/low_level_alloc.cc index 158b609..2dd3604 100644 --- a/absl/base/internal/low_level_alloc.cc +++ b/absl/base/internal/low_level_alloc.cc
@@ -19,6 +19,7 @@ #include "absl/base/internal/low_level_alloc.h" +#include <optional> #include <type_traits> #include "absl/base/call_once.h"
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 5f5a1d9..51065c1 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h
@@ -964,7 +964,14 @@ ctrl_t* control() const { ABSL_SWISSTABLE_ASSERT(capacity() > 0); - ABSL_SWISSTABLE_IGNORE_UNINITIALIZED_RETURN(heap_or_soo_.control().get()); + // Assume that the control bytes don't alias `this`. + ctrl_t* ctrl = heap_or_soo_.control().get(); + [[maybe_unused]] size_t num_control_bytes = NumControlBytes(capacity()); + ABSL_ASSUME(reinterpret_cast<uintptr_t>(ctrl + num_control_bytes) <= + reinterpret_cast<uintptr_t>(this) || + reinterpret_cast<uintptr_t>(this + 1) <= + reinterpret_cast<uintptr_t>(ctrl)); + ABSL_SWISSTABLE_IGNORE_UNINITIALIZED_RETURN(ctrl); } void set_control(ctrl_t* c) { heap_or_soo_.control().set(c); } @@ -3016,14 +3023,13 @@ absl::PrefetchToLocalCache(slot_array() + seq.offset()); #endif Group g{ctrl + seq.offset()}; - // TODO(b/424834054): assert that Match doesn't have too many collisions. for (uint32_t i : g.Match(h2)) { if (ABSL_PREDICT_TRUE(equal_to(key, slot_array() + seq.offset(i)))) return iterator_at(seq.offset(i)); } if (ABSL_PREDICT_TRUE(g.MaskEmpty())) return end(); seq.next(); - AssertOnProbe(seq); + ABSL_SWISSTABLE_ASSERT(seq.index() <= capacity() && "full table!"); } } @@ -3280,7 +3286,6 @@ absl::PrefetchToLocalCache(slot_array() + seq.offset()); #endif Group g{ctrl + seq.offset()}; - // TODO(b/424834054): assert that Match doesn't have too many collisions. for (uint32_t i : g.Match(h2)) { if (ABSL_PREDICT_TRUE(equal_to(key, slot_array() + seq.offset(i)))) return {iterator_at(seq.offset(i)), false}; @@ -3299,7 +3304,7 @@ return {iterator_at(index), true}; } seq.next(); - AssertOnProbe(seq); + ABSL_SWISSTABLE_ASSERT(seq.index() <= capacity() && "full table!"); } } @@ -3381,20 +3386,6 @@ IterateOverFullSlots(common(), sizeof(slot_type), assert_consistent); } - void AssertOnProbe([[maybe_unused]] const probe_seq<Group::kWidth>& seq) { - ABSL_SWISSTABLE_ASSERT(seq.index() <= capacity() && "full table!"); - // We only assert that the hash function has good quality for non-default - // hash functions. - if constexpr (std::is_same_v<hasher, hash_default_hash<key_type>>) return; - // TODO(b/424834054): investigate and see if we can remove the deleted - // elements condition. - ABSL_SWISSTABLE_ASSERT( - (seq.index() <= 256 || seq.index() <= capacity() / 2 || - !common().growth_info().HasNoDeleted()) && - "The hash function has low entropy and is non-default. Please replace " - "it with absl::Hash."); - } - // Attempts to find `key` in the table; if it isn't found, returns an iterator // where the value can be inserted into, with the control byte already set to // `key`'s H2. Returns a bool indicating whether an insertion can take place.
diff --git a/absl/hash/hash_test.cc b/absl/hash/hash_test.cc index c100005..2a95ee5 100644 --- a/absl/hash/hash_test.cc +++ b/absl/hash/hash_test.cc
@@ -1266,11 +1266,6 @@ // Test that we don't cause excessive collisions on the hash table for // doubles in the range [-1024, 1024]. See cl/773069881 for more information. TEST(SwisstableCollisions, DoubleRange) { -#ifdef GOOGLE_UNSUPPORTED_OS_LOONIX - // TODO(b/424834054): make this test pass on Loonix. - GTEST_SKIP() << "Test fails on Loonix."; -#endif - absl::flat_hash_set<double> set; for (double t = -1024.0; t < 1024.0; t += 1.0) { set.insert(t); @@ -1282,12 +1277,6 @@ // Test that for each pair of adjacent bytes in a string, if there's only // entropy in those two bytes, then we don't have excessive collisions. TEST(SwisstableCollisions, LowEntropyStrings) { - if (sizeof(size_t) < 8) { - // TODO(b/424834054): make this test pass on 32-bit platforms. We need to - // make 32-bit Mix() stronger. - GTEST_SKIP() << "Test fails on 32-bit platforms"; - } - constexpr char kMinChar = 0; constexpr char kMaxChar = 64; // These sizes cover the different hashing cases. @@ -1302,7 +1291,7 @@ set.insert(s); ASSERT_LT(HashtableDebugAccess<decltype(set)>::GetNumProbes(set, s), 64) - << size << " " << b; + << "size: " << size << "; bit: " << b; } } }
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index 21728b0..0eeeb4e 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h
@@ -955,24 +955,9 @@ } ABSL_ATTRIBUTE_ALWAYS_INLINE inline uint64_t Mix(uint64_t lhs, uint64_t rhs) { - // For 32 bit platforms we are trying to use all 64 lower bits. - if constexpr (sizeof(size_t) < 8) { - uint64_t m = lhs * rhs; - return m ^ absl::byteswap(m); - } - // absl::uint128 is not an alias or a thin wrapper around the intrinsic. - // We use the intrinsic when available to improve performance. - // TODO(b/399425325): Try to remove MulType since compiler seem to generate - // the same code with just absl::uint128. - // See https://gcc.godbolt.org/z/s3hGarraG for details. -#ifdef ABSL_HAVE_INTRINSIC_INT128 - using MulType = __uint128_t; -#else // ABSL_HAVE_INTRINSIC_INT128 - using MulType = absl::uint128; -#endif // ABSL_HAVE_INTRINSIC_INT128 - // Though the 128-bit product on AArch64 needs two instructions, it is - // still a good balance between speed and hash quality. - MulType m = lhs; + // Though the 128-bit product needs multiple instructions on non-x86-64 + // platforms, it is still a good balance between speed and hash quality. + absl::uint128 m = lhs; m *= rhs; return Uint128High64(m) ^ Uint128Low64(m); }
diff --git a/absl/strings/str_split.h b/absl/strings/str_split.h index 761568a..cf53ccf 100644 --- a/absl/strings/str_split.h +++ b/absl/strings/str_split.h
@@ -127,7 +127,7 @@ absl::string_view Find(absl::string_view text, size_t pos) const; private: - const std::string delimiter_; + std::string delimiter_; }; // ByAsciiWhitespace