3377 Commits

Author SHA1 Message Date
Corentin Le Molgat
6f0c4e732b CMake: Add TESTONLY flag to heterogeneous_lookup_testing
note: This fix https://github.com/abseil/abseil-cpp/issues/2018
PiperOrigin-RevId: 871830812
Change-Id: Ic83f23637f1ba8e38fafe36b9c2ec63f9a4340e7
2026-02-18 06:06:41 -08:00
Derek Mauro
43a941465c Add FAQ entries about hash tables and sanitizers
PiperOrigin-RevId: 871598323
Change-Id: I1787b0ae5034e2318f821217c473bd3e32364ab6
2026-02-17 18:52:44 -08:00
Derek Mauro
b4de535253 Update FAQ.md with bzlmod instructions, and fix some typos and awkward
wording

PiperOrigin-RevId: 871473578
Change-Id: I5089bd2d1408ce5dabdee56793af9775950861ae
2026-02-17 13:37:37 -08:00
Chris Kennelly
91e52dc714 Revert: Record insert misses in hashtable profiling.
By comparing to the total number of objects, we can better determine the hit/miss ratio of various call sites and suitable container reservation sizes based on typical inputs.

PiperOrigin-RevId: 871381187
Change-Id: I88e92f028622177d1f343be3e65bcb7a3e41d234
2026-02-17 10:24:17 -08:00
Derek Mauro
6ec9964c32 Inline deprecated versions of absl::Base64Escape() and
absl::WebSafeBase64Escape()

PiperOrigin-RevId: 871304867
Change-Id: Id35fbc05d7f2f483333e6975e5a16f3a04d361fe
2026-02-17 07:26:05 -08:00
Derek Mauro
586a3fbe2a Deprecate the versions of Base64Escape() and WebSafeBase64Escape()
that use an output parameter.

These versions are clearly inferior to the versions that return
a string.

This is a response to https://github.com/abseil/abseil-cpp/issues/2015

Fixes #2015

PiperOrigin-RevId: 870281461
Change-Id: I92f23d51d05a243dde88c997c1e8448819c5bc77
2026-02-14 16:54:10 -08:00
Abseil Team
5ec376e34b Remove helper libraries for absl/extend
PiperOrigin-RevId: 869797319
Change-Id: I0d1c145f5e6275a455b73f2dd645aeaff6af0885
2026-02-13 10:41:31 -08:00
Abseil Team
4da1361dde Resolve the filename and build_id associated with an image only once.
PiperOrigin-RevId: 869771210
Change-Id: I2116080c5af9db1fbea58260f3fdd1f05cafa3c6
2026-02-13 09:39:35 -08:00
Derek Mauro
351df81acd Test that absl::ParseTime() rejects input with embedded NULs
This change adds the test case from https://github.com/google/cctz/pull/337

PiperOrigin-RevId: 869318402
Change-Id: Ic6136aa56bf41e85e0ad42b6410c7430729bcd13
2026-02-12 11:54:56 -08:00
Abseil Team
27a426287c Import of CCTZ from GitHub.
Fixes #2014

PiperOrigin-RevId: 869283027
Change-Id: Ibd7ef8507a8968d1b35fc45a2f023a7d1bde7691
2026-02-12 10:39:15 -08:00
Evan Brown
92b4141fef Use crc32 with union and rotate in CombineRawImpl.
The hash quality ends up depending on the locations of bits in the values working well in conjunction with the polynomial used by crc32. We minimized probe benchmark geomean across the 64 possible rotation values (we see ~75% geomean improvement).

Benchmarks show improvements in lookup latency and hash quality. Loadtests are neutral or leaning positive.

ASM diff x86: https://godbolt.org/z/jvG1aY31e
ASM diff ARM: https://godbolt.org/z/dPdP6d6d8
ASM diff x86 hashtable lookup (simplified): https://godbolt.org/z/E9ehME647

PiperOrigin-RevId: 868281226
Change-Id: Ifc3bf79de50f15d3d74170911013ca19e73ee240
2026-02-10 13:02:46 -08:00
Derek Mauro
35e6a9517b Delete the internal version of throw_delegate
PiperOrigin-RevId: 868253845
Change-Id: I1cf9e2208242d0fdba8de43bfc5d698377d1c157
2026-02-10 11:57:29 -08:00
Derek Mauro
919b8f9c21 Check for overflow on every iteration in a loop inside of CUnescapeInternal()
For example, \x100000041 could overflow a 32-bit integer and result in
0x41 ('A'), bypassing the exceeds 0xFF check. While this may be hard
to exploit, it is better to be safe and correct.

PiperOrigin-RevId: 868181068
Change-Id: I7d7763e0fe248f7cd7a4cfcc73554d7b20355795
2026-02-10 09:21:09 -08:00
Abseil Team
af4f27f00a Construct {flat,node}_hash_{set,map} w/ from_range
Adds constructors accepting std::from_range if building with C++23. See https://en.cppreference.com/w/cpp/ranges/from_range.html for context.

PiperOrigin-RevId: 867742476
Change-Id: I9ab07e772477bcc29fff438903b90945b89c5a1f
2026-02-09 13:15:24 -08:00
Derek Mauro
7313246786 Fix sign-extension issue in absl::HexStringToBytes()
Fixes #2006

PiperOrigin-RevId: 867661246
Change-Id: Ia4ad66620e0298287993b228bf604b8b75302c7d
2026-02-09 10:15:20 -08:00
Abseil Team
b1b9c189ae Remove ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_ guard
All supported STLs are now SFINAE-friendly

PiperOrigin-RevId: 867626864
Change-Id: I604d19cda49f83e74638bed869b6da30cc013df5
2026-02-09 08:55:42 -08:00
Derek Mauro
81839fc522 Open up the throw_delegate library to public usage
This library contains helper functions that allow throwing exceptions
consistently from anywhere, without risk of ODR violations. When
execptions are disabled, these functions abort the program.

The old internal spellings will be removed in a follow up change.

PiperOrigin-RevId: 867594519
Change-Id: Ibd7a447f5577247bced718617f5da662d983d185
2026-02-09 07:28:03 -08:00
Derek Mauro
edeeb359ad absl::Now(): Mention the possibility of injecting an absl::Clock
to improve testability

PiperOrigin-RevId: 866593907
Change-Id: I952ce8c892e9e820863d9a65ddf635f7d56d8e99
2026-02-06 13:33:43 -08:00
Derek Mauro
12961243df Import of CCTZ from GitHub.
PiperOrigin-RevId: 866482056
Change-Id: I719d414c764b2e110ea70fa84b5d83351930e57d
2026-02-06 08:57:08 -08:00
Abseil Team
cb4ad96a5a Correctly define ABSL_UNREACHABLE when Abseil Hardened Fast is enabled
Currently, when Abseil Hardened Fast is set and NDEBUG is set,
ABSL_UNREACHABLE performs undefined behavior, as the assert is a no-op
and the various ABSL_UNREACHABLE_IMPLs can in fact be reached, violating
assumptions we have told the compiler to make.

PiperOrigin-RevId: 866148746
Change-Id: I4fcad9681d167c40be082521c3bebd9fc27109dc
2026-02-05 15:51:26 -08:00
Chris Kennelly
2f40498d6f Add comment explaining why assertion may fail.
PiperOrigin-RevId: 866119930
Change-Id: Ib4868de270cc9e3d48f0c76c75614f7408a6c3d1
2026-02-05 14:43:44 -08:00
Abseil Team
fc3eb05099 Remove unused dependency in absl/types/optional.h
PiperOrigin-RevId: 866108635
Change-Id: If8981b0c4631d4bc81df1eb51f7b737cb97d3d2c
2026-02-05 14:16:04 -08:00
Abseil Team
bf24e8b443 Perform ValidateDownCast only in Abseil Hardened Extensive mode
Enabling downcast validation checks has incurred about 0.5% overhead on some Google workloads.  Consequently it does not seem like a good inclusion in Abseil Hardened Fast mode, though it remains enabled in Abseil Hardened Extensive mode.

PiperOrigin-RevId: 866108195
Change-Id: Ic796e8bce90bb0d80ad60269a0b3857f19f2c95c
2026-02-05 14:14:37 -08:00
Abseil Team
0e2e1ba7d4 Remove unused dependency in absl/types/optional.h
PiperOrigin-RevId: 866096664
Change-Id: Ibb4a59f691953e5d0e4cf3ff667f0f0c898d3d75
2026-02-05 13:47:59 -08:00
Vitaly Goldshteyn
742e99ce1a Specialize long strings hash for ARM to benefit from AES instruction differences.
```
name                                     CYCLES/op     CYCLES/op   vs base
BM_HASHING_Combine_contiguous_Fleet_hot  540.0m ±  2%   507.0m ± 2%   -6.11% (p=0.002 n=6)
BM_HASHING_Combine_contiguous_Fleet_cold  2.124 ± 12%    2.027 ± 3%   -4.54% (p=0.041 n=6)
```

ASM diff
1. 33-64: -4 cycles https://godbolt.org/z/nEYEKP4M3
2. 65+: -6 cycles https://godbolt.org/z/xsnjh678c
3. -104 bytes of binary size: https://godbolt.org/z/j8absY8M8

PiperOrigin-RevId: 866058683
Change-Id: I7d2f13532ce4fd2bec0382af0ba116967d5aa063
2026-02-05 12:19:14 -08:00
Abseil Team
f4fdd8d615 Add --define="absl=1" to the Bazel build commands in CI
This is to allow using Abseil in GoogleTest, which would allow use of RE2.

PiperOrigin-RevId: 865975476
Change-Id: Ifdf62384b82a14e0fb569076333bee96647e7c1f
2026-02-05 09:09:12 -08:00
Derek Mauro
cd765c9dd1 Upgrade CI to Bazel 9.0.0
This requires a GoogleTest dependency update for compatibility

The use of --action_env for setting up the compiler is changed
because of https://github.com/bazelbuild/bazel/issues/26222

Also fix the path to the symbolizer in sanitizer builds

PiperOrigin-RevId: 865570744
Change-Id: I403202956913519c714d6eed4968a9615853ac42
2026-02-04 14:05:30 -08:00
Derek Mauro
1ad4d33262 Upgrade CI to XCode 26.2
PiperOrigin-RevId: 865469257
Change-Id: Ib263a72dc3d0bd8a2ff516bd2b73f62ca3ef7beb
2026-02-04 10:24:31 -08:00
Vitaly Goldshteyn
7a992d5351 Specialize Mix4x16Vectors for ARM to benefit from direct instructions.
```
name                                     CYCLES/op    CYCLES/op   vs base
BM_HASHING_Combine_contiguous_Fleet_hot  556.0m ± 1%   544.5m ± 1%  -2.07% (p=0.000 n=30)
BM_HASHING_Combine_contiguous_Fleet_cold  2.133 ± 1%    2.125 ± 2%       ~ (p=0.249 n=30)
```

ASM diff
1. -4 cycles 33-64: https://godbolt.org/z/d6dGEsafM
2. -4 cycles 65+: https://godbolt.org/z/WrfYYe496
3. -32 bytes binary size: https://godbolt.org/z/d1n7dqc4a

PiperOrigin-RevId: 865411163
Change-Id: Ia591b7270890a0aa50abca817aa88a9e4af50ed8
2026-02-04 08:08:27 -08:00
Derek Mauro
045a92b1ad Update Abseil CI
The docker images for Linux have all been combined into a single image
that contain the latest and minimum versions of GCC that are
supported, along with a recent Clang and both a normal and a
TSAN-instrumented libc++.  Bazel is now Bazelisk, which allows for
easier testing of other Bazel versions.

Summary:
Linux Clang x86_64: 22.1.0-rc2 (needed to test a C++26 feature)
Linux Clang aarch64: 21.1.8 (the latest release candidate is broken on ARM)
GCC latest: 15.2.0
GCC floor: 9.5.0
Bazel 8.5.1
CMake 4.2.3

MacOS and Windows is also updated to Bazel 8.5.1 so the vendor cache,
which is dependent on the Bazel version, also works on these
platforms.

PiperOrigin-RevId: 864975917
Change-Id: I072f93164b8ecc0b3a6f2c3d0efecea5bdd05c02
2026-02-03 11:43:53 -08:00
Abseil Team
62701e8e96 Avoid -Wsign-conversion in extend/internal/reflection.cc
PiperOrigin-RevId: 864885420
Change-Id: I06b452a8a20f92890ec754300dcfdae9c647b752
2026-02-03 08:13:28 -08:00
Derek Mauro
49cd3c7a20 Minor formatting change
PiperOrigin-RevId: 864057241
Change-Id: Ia742fced241ce1ebab57115074ef75fa95793da9
2026-02-01 14:57:04 -08:00
Abseil Team
0e5031d3c0 Add helper libraries for absl/extend
PiperOrigin-RevId: 863363038
Change-Id: If6845e9711d39cee83f166291eb86720ba9ca5b7
2026-01-30 13:11:56 -08:00
Abseil Team
b2f60a18b5 Undo add helper libraries for absl/extend
PiperOrigin-RevId: 863302753
Change-Id: I0908c0421bac4e3c8c6d72424980f612ea8a57f8
2026-01-30 10:41:21 -08:00
Abseil Team
bf4988f5f6 Add helper libraries for absl/extend
PiperOrigin-RevId: 863296052
Change-Id: Ia633bfc74418cc030b4c614d04617d8c5b9860a0
2026-01-30 10:26:58 -08:00
Vitaly Goldshteyn
0783addf46 AES based hash function for long strings >32 bytes on ARM CPUs.
```
name                                      CYCLES/op    CYCLES/op   vs base
BM_HASHING_Combine_contiguous_Fleet_hot  704.0m ± 1%   564.5m ± 1%  -19.82% (p=0.000 n=30)
BM_HASHING_Combine_contiguous_Fleet_cold  2.422 ± 1%    2.159 ± 2%  -10.88% (p=0.000 n=30)
```

We implement exactly the same behavior as on X86. It may be improved for the following reasons:
1. `vaeseq_u8` do `^key` before encryption, but `_mm_aesenc_si128` do that after encryption. We workaround by doing manually `^key` at the end. That adds extra instruction. Note: just using `vaeseq_u8` produces bad hash quality.
2. `vaeseq_u8` and `vaesmcq_u8` are separate instructions on ARM, so we may combine instructions more efficiently.
3. Worth mentioning that separate behavior for ARM may complicate maintance.

llvm-mca:
1. 33-64 case shows +4 cycles. https://godbolt.org/z/47GacMYqE
2. 65+ case also shows +4 cycles. https://godbolt.org/z/19xaecs9x
3. -204 bytes of binary size: https://godbolt.org/z/KcjEMb8Pv

Microbenchmarks are showing visible win, so likely reduction in micro-ops and number of loads compensate latency increase reported by llvm-mca.

PiperOrigin-RevId: 863270586
Change-Id: I9f867d00a8c147bdd1a482f38aca9f95cce9a58e
2026-01-30 09:21:59 -08:00
Derek Mauro
1fdbcb591f Add absl::Clock, an abstract interface that interface allows
decoupling code that uses time from the code that creates a point in
time.  You can use this to your advantage by injecting Clocks into
interfaces rather than having implementations call absl::Now()
directly. absl::Clock::GetRealClock() returns an absl::Clock backed by
absl::Now().

Add absl::SimulatedClock, a test-only Clock implementation that does
not "tick" on its own. Time is advanced by explicit calls to the
AdvanceTime() or SetTime() functions. This is intended to be used for
dependency injection in tests to test how code behaves under simulated
time conditions.

PiperOrigin-RevId: 862858341
Change-Id: Ied9946dd84063c95505269971d3c996d4b66c6d8
2026-01-29 12:51:12 -08:00
Abseil Team
0437a6d16a Fix ODR violation in absl/functional/bind_front.h
Library features are not predefined and are only available if you include `<version>` or the relavent standard library header providing this feature. This header guards inclusion of `<functional>` using the feature detection macro, of which the header actually defines it. So depending on include order, the effective `absl::bind_front` may be `std::bind_front` or the polyfill implementation.

PiperOrigin-RevId: 859719650
Change-Id: I8a2fbad004ef5e86ac43058ae7bfe39878ea7907
2026-01-22 12:15:36 -08:00
Abseil Team
e56fcf42ab Removing template workaround as the ::benchmark::internal::Benchmark type has now been made non-internal.
PiperOrigin-RevId: 859601861
Change-Id: Ib227f9eea67863cf664f7094be11241d7bdf1a70
2026-01-22 07:34:28 -08:00
Gaetano
dd3cb9eb82 PR #1993: Disable leak sanitizer on clang/windows
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1993

leak sanitizer is not supported on windows, when compiling with clang
on window we get:

```
lld-link: error: undefined symbol: __lsan_do_recoverable_leak_check
>>> referenced by abseil-cpp\absl\debugging\leak_check.cc:46
```

Merge 8c07b9ca7c into 889ddc99e1

Merging this change closes #1993

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1993 from kalman5:patch-1 8c07b9ca7c
PiperOrigin-RevId: 859108154
Change-Id: I12c2b6ae250ba6afb05736c0c04007aa0aa187c4
2026-01-21 08:14:21 -08:00
Abseil Team
889ddc99e1 Ensure absl/base/casts.h usage of typeid is well-formed
PiperOrigin-RevId: 857291008
Change-Id: Ieb46a451a0b1468c5105aa7c93c7c57e1fc57119
2026-01-16 13:51:51 -08:00
Derek Mauro
569ff20318 Cleanup duplicated bit-rotation code
PiperOrigin-RevId: 857286087
Change-Id: Ie79f5b9e7ca8417f6311750c0de469ca6de4a8f9
2026-01-16 13:38:01 -08:00
Abseil Team
ae164c5888 Ensure __cpp_lib_bit_cast is defined when available by including <version>
PiperOrigin-RevId: 857265797
Change-Id: Ie3c6b466ffbc33406833b06bbec8a4f18433810b
2026-01-16 12:39:59 -08:00
Abseil Team
28e6a799ba Make absl::Condition work with C++23 deducing-this
Closes: #1992
PiperOrigin-RevId: 857136106
Change-Id: Iae31d7c6c9a0fda16ebf2c4f68764da521d036bf
2026-01-16 06:34:20 -08:00
Abseil Team
eef1a08f4b Update absl::Span and std::span differences comment
PiperOrigin-RevId: 856366482
Change-Id: I55a33a56f83ed2c0bf30bd14a08c770f18e13d32
2026-01-14 14:31:15 -08:00
Vitaly Goldshteyn
5b086d78c4 Restrict MSVC CRC32 intrinsics to x64.
PiperOrigin-RevId: 856342608
Change-Id: I29518c859b35b8e1d88f26f68f8d35115bc3a883
2026-01-14 13:31:33 -08:00
Derek Mauro
fa3783ec81 Reimplement STLStringResizeUninitializedAmortized() using
StringResizeAndOverwriteImpl()

This change bridges the gap between the legacy uninitialized resize
behavior and the modern absl::StringResizeAndOverwrite(). The internal
StringResizeAndOverwriteImpl function is used directly because the
public Abseil API requires the buffer to be initialized, whereas these
legacy functions rely on the behavior of leaving it uninitialized
(which is technically UB but relied upon here).

This is part of the work to migrate away from these legacy
utilities.

PiperOrigin-RevId: 855779916
Change-Id: If22484048024eae8ddedd29ebb08e8884e0198a3
2026-01-13 10:18:30 -08:00
Abseil Team
6e0a3164d2 Update *SymbolizeURL APIs to add crash_pc parameter.
PiperOrigin-RevId: 855335009
Change-Id: I1632c5a89e91b857dc18ff9434abf22c3f622d8f
2026-01-12 12:21:10 -08:00
Evan Brown
83b229ada5 Refactor GroupSse2Impl to improve codegen for hashtable lookups on x86_64.
Currently, clang isn't using blsr to clear the least significant bit because we are using uint16_t as the bitmask integer type and there are only blsr instructions for 32 and 64 bit registers. When we change to use uint32_t, clang generates blsr, but it also adds an unnecessary movzx (zero-extending move) even though the high bits of the output of vpmovmskb are zeroed. In order to avoid this problem, we use inline asm.

PiperOrigin-RevId: 854341062
Change-Id: I38b7e8913bf76ffd8e94b081afb52128fbcb795d
2026-01-09 14:19:43 -08:00
Chris Kennelly
e8e23f7a30 Avoid reentrancy in hashtable profiling during profile generation.
PiperOrigin-RevId: 854217867
Change-Id: I85d7a5a9025ccb107daf49dfe2ce11b0405f4de2
2026-01-09 09:12:10 -08:00