| diff -ru abseil.orig/absl/container/internal/raw_hash_set.h abseil/absl/container/internal/raw_hash_set.h |
| --- abseil.orig/absl/container/internal/raw_hash_set.h 2019-06-30 20:26:47.151231330 -0700 |
| +++ abseil/absl/container/internal/raw_hash_set.h 2019-07-12 18:05:38.959802013 -0700 |
| @@ -295,10 +295,15 @@ |
| // The seed consists of the ctrl_ pointer, which adds enough entropy to ensure |
| // non-determinism of iteration order in most cases. |
| inline size_t HashSeed(const ctrl_t* ctrl) { |
| +#if DCTV_DETERMINISTIC_ABSEIL |
| + (void) ctrl; |
| + return 0; |
| +#else |
| // The low bits of the pointer have little or no entropy because of |
| // alignment. We shift the pointer to try to use higher entropy bits. A |
| // good number seems to be 12 bits, because that aligns with page size. |
| return reinterpret_cast<uintptr_t>(ctrl) >> 12; |
| +#endif |
| } |
| |
| inline size_t H1(size_t hash, const ctrl_t* ctrl) { |
| diff -ru abseil.orig/absl/hash/internal/hash.cc abseil/absl/hash/internal/hash.cc |
| --- abseil.orig/absl/hash/internal/hash.cc 2019-06-30 20:26:47.163231365 -0700 |
| +++ abseil/absl/hash/internal/hash.cc 2019-07-12 18:03:57.631770564 -0700 |
| @@ -17,7 +17,9 @@ |
| namespace absl { |
| namespace hash_internal { |
| |
| +#if !DCTV_DETERMINISTIC_ABSEIL |
| ABSL_CONST_INIT const void* const CityHashState::kSeed = &kSeed; |
| +#endif |
| |
| } // namespace hash_internal |
| } // namespace absl |
| diff -ru abseil.orig/absl/hash/internal/hash.h abseil/absl/hash/internal/hash.h |
| --- abseil.orig/absl/hash/internal/hash.h 2019-06-30 20:26:47.163231365 -0700 |
| +++ abseil/absl/hash/internal/hash.h 2019-07-12 18:05:54.415806870 -0700 |
| @@ -760,9 +760,15 @@ |
| // On other platforms this is still going to be non-deterministic but most |
| // probably per-build and not per-process. |
| ABSL_ATTRIBUTE_ALWAYS_INLINE static uint64_t Seed() { |
| +#if DCTV_DETERMINISTIC_ABSEIL |
| + return 0; |
| +#else |
| return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(kSeed)); |
| +#endif |
| } |
| +#if !DCTV_DETERMINISTIC_ABSEIL |
| static const void* const kSeed; |
| +#endif |
| |
| uint64_t state_; |
| }; |