Skip to content

Update to abseil-cpp 20260107.1#31

Open
bourdakos1 wants to merge 3126 commits intofirebase:mainfrom
bourdakos1:jan-lts
Open

Update to abseil-cpp 20260107.1#31
bourdakos1 wants to merge 3126 commits intofirebase:mainfrom
bourdakos1:jan-lts

Conversation

@bourdakos1
Copy link
Contributor

Sync from https://github.com/abseil/abseil-cpp/releases/tag/20260107.1

Removed all test and benchmark files:

rm -rf `find absl/ -name "*_test.cc"`
rm -rf `find absl/ -name "*_test.c"`
rm -rf `find absl/ -name "*_benchmark.cc"`
rm absl/status/internal/status_matchers.*
rm -rf absl/time/internal/cctz/testdata
rm -rf `find absl/ -name "BUILD.bazel"`
rm -rf `find absl/ -name "CMakeLists.txt"`
rm -rf absl/copts
rm -rf `grep -rl '#include "gtest/gtest.h"'`
rm -rf `grep -rl '#include "gmock/gmock.h"'`
rm -rf `grep -rEl "^int main\(" absl/`

Tested with:

swift build
swift test

For new mutex api support

Abseil Team and others added 30 commits July 17, 2025 12:08
…o memory is provided

PiperOrigin-RevId: 784266735
Change-Id: I537a6472ce284e97734d56ccff1863108ed3eb39
…s://github.com/google/pprof suitable format for inspection.

PiperOrigin-RevId: 784620356
Change-Id: Iceb25ca22e4969c18fbca912018de41198ead7b7
…reakage

PiperOrigin-RevId: 784690676
Change-Id: Ief3ebd9f6850594b530992867a0642fca6525fdc
The code is correct, but the compiler can't optimize away the check.

PiperOrigin-RevId: 785603401
Change-Id: I9277e3b71965322691108f08597728dd84737329
PiperOrigin-RevId: 786301329
Change-Id: I342de39e40e90c82501baac9858291b7c4d5c2d0
PiperOrigin-RevId: 786333780
Change-Id: Ic49399acc9b4689fad52270afea1fbac07360283
PiperOrigin-RevId: 786406173
Change-Id: Ifc362a702f82a6b3ad33210980dda6f40f14fca4
This allows dynamic memory allocation for computing stack traces to avoid a stack overflow.

PiperOrigin-RevId: 786512779
Change-Id: Ib5ef8fef436672b99d9678137e3b2bb65ca47eba
…to-32).

PiperOrigin-RevId: 786713025
Change-Id: I0e5489899f2960d71e39dc58f5033bef3a52e36c
PiperOrigin-RevId: 786730361
Change-Id: I8184cd8a259570ff247077d7e3adaf430bd08ecc
Optimize multiply() (renamed to MultiplyWithExtraX33()) to eliminate
several instructions that were present only to avoid introducing an
extra factor of x^33 into the multiplication.  It's actually fine to
introduce the extra factor of x^33 as long as it's canceled out with an
extra factor of x^-33 in all the kCRC32CPowers[] entries.

To make this work, the number of bits dropped by ComputeZeroConstant()
had to be increased from 2 to at least 3, since 2^(i + 3 +
kNumDroppedBits) - 33 must be >= 0 for all i including i=0; otherwise
kCRC32CPowers[0] would need a negative power of x.  However, this is
fine since it's more efficient to utilize CRC32_u32() and CRC32_u64()
for bits 2 and 3 anyway.  So, increase kNumDroppedBits to 4.

Add a Python script that generates the updated kCRC32CPowers[].  It
isn't wired up to the build system, but rather is just added so that
kCRC32CPowers[] can be reproduced.

Also add a test which tests ExtendCrc32cByZeroes() with all the length
bits, thus testing all the entries of kCRC32CPowers[].

Note that the kCRC32CPowers[] generation script and new test case are
things we should have had anyway, regardless of the x^33 optimization.

This change slightly improves the performance of Extend() for lengths
greater than or equal to 2048 bytes, and also the performance of
ExtendByZeroes().  It also slightly reduces the binary code size.

Before:
    BM_Calculate/2048                   84.3 ns         84.3 ns      8307735
    BM_Calculate/10000                   376 ns          375 ns      1865976
    BM_Calculate/500000                18538 ns        18531 ns        37813
    BM_ExtendByZeroes/1                 3.55 ns         3.55 ns    197111095
    BM_ExtendByZeroes/10                3.90 ns         3.89 ns    179773877
    BM_ExtendByZeroes/100               6.06 ns         6.06 ns    115242160
    BM_ExtendByZeroes/1000              12.0 ns         12.0 ns     58078004
    BM_ExtendByZeroes/10000             9.97 ns         9.97 ns     70335772
    BM_ExtendByZeroes/100000            12.1 ns         12.1 ns     58157829
    BM_ExtendByZeroes/1000000           14.4 ns         14.4 ns     48527365

After:
    BM_Calculate/2048                   82.8 ns         82.7 ns      8478296
    BM_Calculate/10000                   375 ns          375 ns      1869663
    BM_Calculate/500000                18547 ns        18538 ns        37846
    BM_ExtendByZeroes/1                 2.96 ns         2.96 ns    236772500
    BM_ExtendByZeroes/10                3.85 ns         3.85 ns    182059238
    BM_ExtendByZeroes/100               5.42 ns         5.42 ns    129077546
    BM_ExtendByZeroes/1000              9.43 ns         9.42 ns     74232457
    BM_ExtendByZeroes/10000             8.14 ns         8.14 ns     86244218
    BM_ExtendByZeroes/100000            10.7 ns         10.7 ns     65467391
    BM_ExtendByZeroes/1000000           11.0 ns         11.0 ns     63575936
PiperOrigin-RevId: 786828855
Change-Id: I6208625fd1c35c2c137e756cf5fadc1adccfdd5d
Swisstable relies on the hash having good entropy in both the high and low bits.

PiperOrigin-RevId: 786854836
Change-Id: I6fc7041534984a0e937a11f50a2b478390a1a509
Imported from GitHub PR abseil/abseil-cpp#1911

We have recently started experimenting with using Clang to compile abseil (instead of gcc) on ppc64 and this test started failing:
```
# ./bin/absl_demangle_test
abseil-cpp/absl/debugging/internal/demangle_test.cc:1996: Failure
Expected: (stack_consumed) < (kStackConsumptionUpperLimit), actual: 9668 vs 8192

[  FAILED  ] Demangle.DemangleStackConsumption (5 ms)
```
This PR increases the value of `kStackConsumptionUpperLimit` to accommodate higher stack usage.
Merge fb14c03227fc4d86493c5af23dcf05990c73c2bb into 7ece455

Merging this change closes #1911

COPYBARA_INTEGRATE_REVIEW=abseil/abseil-cpp#1911 from miladfarca:ppc-fix-test fb14c03227fc4d86493c5af23dcf05990c73c2bb
PiperOrigin-RevId: 787192848
Change-Id: I1343b9a22a92e5663e6e27e827c7b0584800ebbc
PiperOrigin-RevId: 787195786
Change-Id: I8204d52a092884abf678a32c6b74ff054970e430
argument.

This is already undefined behavior since the argument is immediately
used to construct a string_view, and passing a null argument to the
single-arg string_view constructor is undefined behavior. Adding the
check will prevent introduction of new bugs when using standard
library implementations that do not detect this case.

PiperOrigin-RevId: 787676394
Change-Id: Ia3e069071e28c8e17df956b8b713bf17fb1e3be3
PiperOrigin-RevId: 788447014
Change-Id: I7b285de1156553835bdc062f6d2bad967eaf2970
PiperOrigin-RevId: 788502749
Change-Id: Ibb2a8d46eca84dd87011c8e1bbd20b829f211ea4
PiperOrigin-RevId: 788531193
Change-Id: Icca9ff096c2ec2fc0662f1f94ecfb232a8492974
PiperOrigin-RevId: 788575830
Change-Id: I10d97c367472edd89efd59eda455764285f6ad88
PiperOrigin-RevId: 788918981
Change-Id: I509a6a9bb3493c177cd4725383cd6e48b4479b68
This aligns these classes more closely with std::scoped_lock.

PiperOrigin-RevId: 788920634
Change-Id: If29e8092b782bfbb11a1da31834dc738f1cbcfbc
Imported from GitHub PR abseil/abseil-cpp#1914

```
: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
   50 |   return getpagesize();
      |   ~~~~~~ ^~~~~~~~~~~~~
../_deps/absl-src/absl/base/internal/poison.cc:79:29: error: use of undeclared identifier 'data'
   79 |   return static_cast<char*>(data) + block_size / 2;
      |                             ^
1 warning and 1 error generated.
gmake[2]: *** [_deps/absl-build/absl/base/CMakeFiles/poison.dir/build.make:76: _deps/absl-build/absl/base/CMakeFiles/poison.dir/internal/poison.cc.obj] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1843: _deps/absl-build/absl/base/CMakeFiles/poison.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
```

Merge 6b172a21d1e012a335033c77fa4a6ec43bcf8c4a into 785b11b

Merging this change closes #1914

COPYBARA_INTEGRATE_REVIEW=abseil/abseil-cpp#1914 from Ricardicus:master 6b172a21d1e012a335033c77fa4a6ec43bcf8c4a
PiperOrigin-RevId: 788985640
Change-Id: Ife849052c340985d08a4dda131dad086e670d901
Up to 13% performance improvement for the platforms affected.

PiperOrigin-RevId: 789033088
Change-Id: I1d74360377e3c40dfaae2108ec55f907960d177a
We both call DecrementExpectHighRefcount which assumes ref>1,
and we PREDICT_FALSE that it's 1.

PiperOrigin-RevId: 789316655
Change-Id: Icbb1586d91a34f8c02b2ce1341af3c36c8837c80
PiperOrigin-RevId: 789441157
Change-Id: I2ed5d12f4b9725edbe3fd6cf629a0563a2f2d739
PiperOrigin-RevId: 789459507
Change-Id: I573dec1c33b047388509cfea129342ea7bdfe494
PiperOrigin-RevId: 790659770
Change-Id: I882eb8e76e6aed998d7cb2c646a6edac95197d0f
…`, suppress the default behavior that forwards to `ScopedMockLog::Log` so that unexpected logs are printed with full metadata. Many of these tests are poking at those metadata, and a failure message that doesn't include them is unhelpful.

Also, add a GoogleTest debug `PrintTo` routine for `LogEntry`, so that unexpected calls to `ScopedMockLog::Send` print metadata legibly.

PiperOrigin-RevId: 790735226
Change-Id: If21821812a9b7ecfaefef9ea5085f161f9331cf4
PiperOrigin-RevId: 790764902
Change-Id: I09ec1bf76b5bd57363c2b8781af5de62c3c1b78d
PiperOrigin-RevId: 790765458
Change-Id: Iff8cedf78a5b9d28eba63515d22e5ac35c34542c
derekmauro and others added 30 commits December 19, 2025 04:50
These are hash containers ordered by insertion.

PiperOrigin-RevId: 846682470
Change-Id: I1c7fc54197d074666754f94b477782400197a14e
PiperOrigin-RevId: 846705319
Change-Id: I27c925ead3415b11f5eee5f8657d234d464225b5
PiperOrigin-RevId: 846769302
Change-Id: Ice80fd61edaf7fa4b97286444251abccb204679f
PiperOrigin-RevId: 846785448
Change-Id: Ic21788f29f6c42382d49a64246eebf92964af6e4
PiperOrigin-RevId: 846842509
Change-Id: I91a82eb9bafd01b3341efcd9aef3b699dc8fe10a
PiperOrigin-RevId: 847827629
Change-Id: I84dec0fafa6cdbb8ffee013f9d5ad9b3cb977ee4
This is equivalent to the current logic.

PiperOrigin-RevId: 847847676
Change-Id: Ibd99b2db34fec7cd23247f6de2b22e8ea4b89a15
…ations.

PiperOrigin-RevId: 847935770
Change-Id: I7f96940e5ba11d6a602d34e7dc3dbfde112bb142
PiperOrigin-RevId: 849837011
Change-Id: I3b742863d328f01a2461f2b876b2aaf04ce9cd5f
PiperOrigin-RevId: 850046633
Change-Id: I5ed7d3031c8e60ddac80df9d0bea073f07017236
PiperOrigin-RevId: 850059542
Change-Id: I35bcd2cb43d3ce33fd316e89ac93e7574a7e151c
PiperOrigin-RevId: 850064010
Change-Id: Ieb280f2ba70726bbd4f27d2aed1f0ff4e5a683d1
Note: we don't use std::pair because PodRand requires a pod type.
PiperOrigin-RevId: 850090182
Change-Id: I01d46ede3371d2424a8f392d3f192e55b86afd6a
input_iterator, not forward_iterator

PiperOrigin-RevId: 850356318
Change-Id: If728cc6f4c0eedd4729b73860df8498f4fe6a139
PiperOrigin-RevId: 850445526
Change-Id: I15e34dc543dc5aa72ae58ff471410d219fef2444
For length in [17, 32] we compute two chain of dependent CRC32  operations to have good entropy in the resulting two 32 bit numbers.
1. x := CRC32(CRC32(state, A), D)
2. y := CRC32(CRC32(bswap(state), C), B)

On ARM:
  CRC32 has 2 cycles latency and throughput equal to 1.
  Computations will be pipelined without any wait.
On x86:
  CRC32 has 3 cycles latency and throughput equal to 1.
  There will be 1 extra cycle wait, but we can do `cmp` in parallel.

At the end we multiply (mul - x) * (y - mul). mul is added to fill upper 32 bits of CRC result with good entropy bits. `mul = rotr(kMul, len)`

We also mixing length differently:
1. `state + 8 * len` (`lea` instruction), later one or two CRC shuffle these bits well into low 32 bit.
2. `rotr(kMul, len)` is used for filling high 32 bits before multiplication in `Mix`. This avoid reading from `kStaticRandomData`.

For smaller strings we try to extremely minimize binary size and register pressure.
CRC instruction fused with memory read is used. llvm-mca reporting 1 cycle smaller latency compared to separate `mov` + `crc`.

ASM analysis https://godbolt.org/z/e1xrKzhdc:
1. 100+ bytes binary size saving (per inline instance)
2. 25+ instruction saving
3. 2 registers are not used (r8 and r9).

Latency in isolation without accounting comparison are controversial.
1. latency for 8 bytes in isolation is 1 cycle better: https://godbolt.org/z/zc39eM3K9
2. latency for 1-3 bytes in isolation is 2 cycles better: https://godbolt.org/z/qMKfbv438
3. latency for 16 bytes in isolation is 3 cycles worse: https://godbolt.org/z/vcqr8oGv3
4. latency for 32 bytes in isolation is 5 cycles worse:
https://godbolt.org/z/nEPP5jP58

PiperOrigin-RevId: 850659551
Change-Id: I02a2434f2d98473b099c171ef1c56adffa821c60
This change introduces absl::chunked_queue, a sequence container
optimized for use as a FIFO (First-In, First-Out) queue. It is similar
in purpose to std::deque but with different performance trade-offs and
features.

absl::chunked_queue stores elements in a series of
exponentially-growing chunks of memory.

absl::chunked_queue is often a better choice than std::deque in the
following situations:
  * Large queues: For very large numbers of elements, the exponential
    growth strategy of absl::chunked_queue can lead to fewer, larger
    memory allocations compared to std::deque, which can be a
    performance advantage.
  * Strict FIFO processing: When you only need to add elements to the
    back (push_back) and remove them from the front (pop_front).

std::deque should be preferred in the following cases:
  * Operations at both ends: std::deque is designed for efficient
    insertions and deletions at both the front and the
    back. absl::chunked_queue is optimized for push_back and pop_front
    and does not offer a pop_back method.
  * Random access: std::deque provides amortized O(1) random access to
    elements via operator[]. absl::chunked_queue does not support
    random access.
PiperOrigin-RevId: 850999629
Change-Id: Ie71737c10b6125b9e498109267cac87a4ca2f9e8
…y assume that benchmark was not run if 0ns reported.

PiperOrigin-RevId: 852831533
Change-Id: Ibf2e60dcb308928358ddf80dc4d2f7eda8a78530
PiperOrigin-RevId: 852842182
Change-Id: Iadec9bb2fec60b9962a557f82ac998f3cf8d56fe
PiperOrigin-RevId: 852845312
Change-Id: I26dcfc5784383d1cf86fab795ba931445f24c575
PiperOrigin-RevId: 852923303
Change-Id: I41ef782f514ad4301b928b49f3659f4dac3d11fd
The class is intentionally designed for exactly what is needed here: no type
erasure, and therefore allocations and no locks taken. It's also not conceivable
that we would ever change this without introducing a new API, as doing so would
serve no purpose and harm performance.

PiperOrigin-RevId: 852955861
Change-Id: I67bb75cf17c1184392bbec6ed9d15faee2f6376b
…cated

Updates `absl::Mutex` and related RAII lockers (`absl::MutexLock`,
etc) to deprecate legacy APIs in favor of standard-compliant
alternatives.
  * `absl::Mutex`: Adds `[[deprecated]]` to legacy CamelCase methods
    (e.g., `Lock`, `ReaderLock`) in favor of standard C++ lower-case
    methods (`lock`, `lock_shared`) which support `std::scoped_lock`.
  * `absl::MutexLock` (and friends): Adds `[[deprecated]]` to
    constructors accepting raw pointers, favoring new
    reference-accepting constructors.

To support this change, warnings coming from external repositories
are now suppressed in Bazel CI builds.

PiperOrigin-RevId: 852978576
Change-Id: I54ae951f28a1b7d90fcb46ceeaf09f192af257df
* Fix unused variable warning in GCC7

PiperOrigin-RevId: 853321697
Change-Id: I44b09e10e6ca1bb9b9f30a01a0f5acd5923371c1

* Fix self-move handling in absl::linked_hash_{set|map}

PiperOrigin-RevId: 853340964
Change-Id: I818695f01d53b5515be24122e1988e69ad6421d4
* Fix sign-extension issue in absl::HexStringToBytes()
* Restrict MSVC CRC32 intrinsics to x64.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.