summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* `absl/log/internal`: Document conditional ABSL_ATTRIBUTE_UNUSED, add C++17 TODOGravatar Dino Radakovic2024-04-17
| | | | | | | Once absl's support floor moves to C++17, we'll be able to replace it with [`[[maybe_unused]]`](https://en.cppreference.com/w/cpp/language/attributes/maybe_unused). PiperOrigin-RevId: 625680108 Change-Id: I823b70c0f833dcf9c41bca0c2566b12ec65785de
* `log/internal/check_op`: Add ABSL_ATTRIBUTE_UNUSED to CHECK macros when ↵Gravatar Dino Radakovic2024-04-15
| | | | | | | | | | | | | | STRIP_LOG is enabled When `STRIP_LOG` is off, the internal variable `absl_log_internal_check_op_result` is passed to `absl::log_internal::LogMessageFatal()` and used in the failure message. When `STRIP_LOG` is on, the variable is truly unused. Applying a `ABSL_ATTRIBUTE_UNUSED` on the variable triggers `-Wused-but-marked-unused` when `STRIP_LOG` is off, not applying the attribute triggers `-Wunused-but-set-variable` when `STRIP_LOG` is on. Define a new internal macro `ABSL_LOG_INTERNAL_ATTRIBUTE_UNUSED_IF_STRIP_LOG` that evaluates to `ABSL_ATTRIBUTE_UNUSED` when `STRIP_LOG` is on and nothing when `STRIP_LOG` is off to address both of these scenarios. PiperOrigin-RevId: 625049155 Change-Id: Ia3f8a6ca916dd67a287bbda4b9bd6c574c92247a
* log_benchmark: Add VLOG_IS_ON benchmarkGravatar Abseil Team2024-04-12
| | | | | PiperOrigin-RevId: 624149255 Change-Id: I74815463226adaf183af531b8d373782d20b2ef2
* Restore string_view detection checkGravatar Abseil Team2024-04-09
| | | | | PiperOrigin-RevId: 623195368 Change-Id: Iadb9bdedee4d9b5ced4fff9e6316ee63f9a89ea5
* Remove an unnecessary ABSL_ATTRIBUTE_UNUSED from a logging macroGravatar Derek Mauro2024-04-09
| | | | | PiperOrigin-RevId: 623158262 Change-Id: If6a29faa89f893747de22a3b02bd69573b5af15f
* In example code, add missing template parameter.Gravatar Abseil Team2024-04-05
| | | | | PiperOrigin-RevId: 622164857 Change-Id: I806ebeb4da81403c8a9d57f3529b2bfbc1a07d01
* Optimize crc32 V128_From2x64 on ArmGravatar Connal de Souza2024-04-04
| | | | | | | This removes redundant vector-vector moves and results in Extend being up to 3% faster. PiperOrigin-RevId: 621948170 Change-Id: Id82816aa6e294d34140ff591103cb20feac79d9a
* Annotate that Mutex should warn when unused.Gravatar Chris Kennelly2024-04-04
| | | | | | | This often indicates a bug from adding synchronization logic but not using it. PiperOrigin-RevId: 621921486 Change-Id: Iec49134c5e4bb50d9fc728c1f8a4fd2e86856782
* Add ABSL_ATTRIBUTE_LIFETIME_BOUND to Cord::Flatten/TryFlatGravatar Abseil Team2024-04-04
| | | | | | | These were already on the declarations, but it seems like the definitions need them as well. PiperOrigin-RevId: 621868985 Change-Id: I2595aae506924f8b1dad3b07efe1660ae0e4488e
* Deprecate `absl::exchange`, `absl::forward` and `absl::move`, whichGravatar Derek Mauro2024-04-04
| | | | | | | | | | | | | | | | were only useful before C++14. Callers should use `std::exchange`, `std::forward` and `std::move` instead. One thing to note is that some compilers issue warnings about pessimizing and redundant moves. Some compilers were able to apply this analysis to std::move but not absl::move. If you get a warning about one of these issues now that absl::move is an alias for std::move, you should remove this use of move. See https://developers.redhat.com/blog/2019/04/12/understanding-when-not-to-stdmove-in-c PiperOrigin-RevId: 621861324 Change-Id: I60f98b59be5ff425bd17fbce43d9218c361720c2
* Temporarily revert dangling std::string_view detection until dependent is fixedGravatar Abseil Team2024-04-02
| | | | | PiperOrigin-RevId: 621413395 Change-Id: I20e9fac94e81e59c0d723f115670c8cf68e9b44a
* Use _decimal_ literals for the CivilDay example.Gravatar Devin Jeanpierre2024-04-02
| | | | | | | Using `07` is a neat pun, but it not friendly to the reader. If the reader naively copies it and then changes the `7` to an `8` or a `9`, it will fail compilation: `invalid digit ... in octal constant`. Best avoided. Note that the other examples do not use octal literals. PiperOrigin-RevId: 621335289 Change-Id: I6b11a639c5ba675eb29467baf45996ceff0ed9bf
* Fix bug in BM_EraseIf.Gravatar Vitaly Goldshteyn2024-04-02
| | | | | PiperOrigin-RevId: 621258501 Change-Id: Id094f3f0d0bc4a9fa8f3d1f90cfcd4c53beeb776
* Add internal traits to absl::string_view for lifetimebound detectionGravatar Abseil Team2024-04-02
| | | | | | | | | This helps compilers that understand `ABSL_ATTRIBUTE_LIFETIME_BOUND` flag constructs such as `absl::StatusOr<std::string_view> str = std::string(...)` as error-prone. PiperOrigin-RevId: 621196818 Change-Id: I78d4c66854cde9d06eaaec05869d956376109d9c
* Add internal traits to absl::StatusOr for lifetimebound detectionGravatar Abseil Team2024-04-02
| | | | | | | | | This helps compilers that understand `ABSL_ATTRIBUTE_LIFETIME_BOUND` flag constructs such as `absl::StatusOr<std::string_view> str = std::string(...)` as error-prone. PiperOrigin-RevId: 621169918 Change-Id: Id621f63b9da4dc72eb4bd42c62d88bcc15a05243
* Add internal traits to absl::Span for lifetimebound detectionGravatar Abseil Team2024-04-02
| | | | | PiperOrigin-RevId: 621169753 Change-Id: Ib6d7b248e14f29f1f91c24b8e1cf9703962b0e36
* Add missing dependency for log test build targetGravatar Abseil Team2024-04-02
| | | | | PiperOrigin-RevId: 621155521 Change-Id: I1705451bc1b931bfae3e1a2977bc56127e15faed
* Add internal traits for lifetimebound detectionGravatar Abseil Team2024-04-01
| | | | | | | | | | | | | | | | | | | | | | | | This will helps compilers that understand `ABSL_ATTRIBUTE_LIFETIME_BOUND` flag constructs such as `absl::StatusOr<std::string_view> str = std::string(...)` as error-prone. For standard types, this is done via specializing the type traits. For all other types, this is done by detecting the presence of a Boolean member trait such as: `using absl_internal_is_view = std::true_type;` in the type. This is purely intended as a safety feature, and the values of these traits (even if wrong!) must NOT be depended on for correct behavior. Furthermore, only high-value types (such as `absl::StatusOr`) are the intended users here. Do not declare or use these traits on arbitrary types that are unlikely to be misused. Do not depend on any of these to be stable, as they not (yet) public APIs. Moreover, the trait declarations and mechanisms are all subject to change. (For example, if `[[clang::lifetimebound]]` becomes possible to detect directly, the traits may need to be altered to utilize that, and distinguish between assignments and constructions.) Should these or similar APIs be made public at a later point, the detection mechanisms may be altered quickly, and may (either loudly or silently) break existing code depending on these internal APIs without notice. PiperOrigin-RevId: 620868493 Change-Id: I4a528a1dcf0df6ffbc3641d09537bc4c674aee4e
* Use local decoding buffer in HexStringToBytesGravatar Abseil Team2024-03-28
| | | | | PiperOrigin-RevId: 620141661 Change-Id: I9dc9243b1d227f7cf32319bc1fec94aba850d4c1
* Only check if the frame pointer is inside a signal stack with known boundsGravatar Abseil Team2024-03-28
| | | | | | | | This function previously returned true whenever the signal stack had unknown bounds, that is obviously incorrect. PiperOrigin-RevId: 620084964 Change-Id: I3821730b45773300569b9cbdb7e72442ed109d04
* Roll forward: enable small object optimization in swisstable.Gravatar Evan Brown2024-03-28
| | | | | PiperOrigin-RevId: 619984581 Change-Id: I68fc9d6e9dd447bdccdbfd270073e11865f85965
* Optimize LowLevelHash by breaking dependency between final loads and ↵Gravatar Connal de Souza2024-03-28
| | | | | | | | | previous len/ptr updates. No functional change. PiperOrigin-RevId: 619979819 Change-Id: I71a4ae14272bcdf1da2e201ed286f95213ecb5e2
* Fix the wrong link.Gravatar Abseil Team2024-03-27
| | | | | | | | | It took me way too much time to figure out why parameters of `absl::LogUniform` have nothing to do with the contents of the linked wiki page. The new link does not match the function exactly, but it is still much closer than the log-normal distribution. PiperOrigin-RevId: 619749575 Change-Id: Idbe748ed0dadf3ca22dc592f296f770ce04de8be
* Optimize InsertMiss for tables without kDeleted slots.Gravatar Vitaly Goldshteyn2024-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL contains two optimizations that were measured together. 1) InsertMiss (i. e. successful insert) optimization: The idea that in case there is no kDeleted, we already know 99% of the information. So we are finding the position to insert with 2 asm instructions (or 3 in case of ARM or portable) and passing that as a hint into `prepare_insert`. `prepare_insert` is out of the line in order to minimize effect on InsertHit (the most important case). `prepare_insert` may use the hint in case we still have growth and no kDeleted is guaranteed. In case of kDeleted, we still call `find_first_non_full` in order to potentially find kDeleted slot earlier. We may consider different ways to do it faster for kDeleted later. 2) `find_first_non_full` optimization: After optimization #1 `find_first_non_full` is used: 1. during resize and copy 2. right after resize 3. during DropDeletedWithoutResize 3. in InsertMiss for tables with kDeleted In cases 1-3 the table is quite sparse. 1. After resize it is 7/16 sparse 2. During resize it is 7/16 maximum, but during first inserts it is much sparser. 3. During copy it may be up to 7/8, but at the beginning it is way sparser. 4. During DropDeletedWithoutResize it is 25/32 sparse, but at the beginning it is way sparser. The only case, where the table is not known to be sparse, with `find_first_non_full` usage is a table with deleted elements. But according to hashz, we have <3% such tables. Adding an extra branch wouldn't hurt much there. PiperOrigin-RevId: 619681885 Change-Id: Id3e2852cc6d85f6c8f90982d7aeb14799696bf39
* Use GrowthInfo without applying any optimizations based on it.Gravatar Vitaly Goldshteyn2024-03-27
| | | | | PiperOrigin-RevId: 619649335 Change-Id: I8b3380816418a363fb6686db7966248cb530c491
* Disable small object optimization while debugging some failing tests.Gravatar Evan Brown2024-03-27
| | | | | PiperOrigin-RevId: 619598530 Change-Id: Ie4b808a3b826db8c271c81914c7a88d2c6216eb2
* Adjust conditonal compilation in non_temporal_memcpy.hGravatar Abseil Team2024-03-27
| | | | | | | | | | This change will allow the AVX version of non-temporal memcpy to be compiled even if the compiler isn't run with AVX support. This allows runtime dispatch to select the AVX implementation for CPUs that are known to be compatible with AVX instructions. PiperOrigin-RevId: 619594422 Change-Id: Ia7d92404ef8d10d152030b29b71948ed954f28f5
* Reformat log/internal/BUILDGravatar Abseil Team2024-03-27
| | | | | PiperOrigin-RevId: 619563536 Change-Id: I81df471817ddd4aba5aaa525adcdae5e7e03b886
* Remove deprecated errno constants from the absl::Status mappingGravatar Derek Mauro2024-03-27
| | | | | | | | | | | | | | ENOSTR, ETIME, ENODATA, and ENOSR are deprecated by POSIX and C++23. This change also turns on the deprecation warnings used by Chromium. See also: https://wg21.link/LWG3869 https://github.com/llvm/llvm-project/pull/80542 https://buganizer.corp.google.com/issues/331100926 PiperOrigin-RevId: 619551374 Change-Id: Ica8d5008cbee52ce88d58a1fcb79dbe794045bae
* Introduce GrowthInfo with tests, but without usage.Gravatar Vitaly Goldshteyn2024-03-26
| | | | | | | The motivation is to use presence of kDeleted slots for optimizing InsertMiss for tables without kDeleted slots. PiperOrigin-RevId: 619411282 Change-Id: Icc30606374aba7ce60b41f93ee8d44894e1b8aa5
* Enable small object optimization in swisstable.Gravatar Evan Brown2024-03-26
| | | | | | | See [implementation commit](https://github.com/abseil/abseil-cpp/commit/1449c9a106b090f61441ba245c781d7d2f89000c) for design details. PiperOrigin-RevId: 619309882 Change-Id: I093c00365dda2268be86ba3d21421b6ffb59a5ce
* Refactor the GCC unintialized memory warning suppression in raw_hash_set.h.Gravatar Evan Brown2024-03-26
| | | | | | Motivation: there are new uninitialized memory warnings when we enable small object optimization. PiperOrigin-RevId: 619295212 Change-Id: If10762bab0e43c9619fc03f6d1eef5b8836bbf9a
* Respect `NDEBUG_SANITIZER`Gravatar Abseil Team2024-03-26
| | | | | | | | | | | | | | | | | | | | | Often code needs to know that it's built with sanitizers. There are two common use for such information: 1. Work around incompatibility with sanitizers 2. Use sanitizers for more aggressive bug detection With the current `ABSL_HAVE_*_SANITIZER` we can't distinguish this two cased, and we didn't need that before. Now user can define `NDEBUG_SANITIZER` to ask code like this to avoid unnecessary checks. I am not 100% sure that `NDEBUG` is not enough. However relying on `NDEBUG` today will relax many tests, which runs in NDEBUG mode only. So new `NDEBUG_SANITIZER` is safer approach. PiperOrigin-RevId: 619268413 Change-Id: I58185cd6886593a3742b8424deccdec366c2a35a
* Revert integer-to-string conversion optimizations pending more thorough analysisGravatar Abseil Team2024-03-26
| | | | | PiperOrigin-RevId: 619261152 Change-Id: Id3409b326c52ace0fda42537e0b91dbb2d6a2287
* Fix a bug in `Cord::{Append,Prepend}(CordBuffer)`: callGravatar Marcin Kowalczyk2024-03-26
| | | | | | | | | | | `MaybeRemoveEmptyCrcNode()`. Otherwise appending a `CordBuffer` an empty Cord with a CRC node crashes (`RemoveCrcNode()` which increases the refcount of a nullptr child). Cosmetics: in `Cord::InlineRep::AppendArray()`, return early for empty `src` before removing the empty CRC node. PiperOrigin-RevId: 619107278 Change-Id: I4f1bc6b75c662f4678c61e3ef310e8597d62e2e1
* Add `BM_EraseIf` benchmark.Gravatar Vitaly Goldshteyn2024-03-25
| | | | | PiperOrigin-RevId: 618970135 Change-Id: Ifb9d0b425904d5cb37d80ec28ab7845957209313
* Record sizeof(key_type), sizeof(value_type) in hashtable profiles.Gravatar Chris Kennelly2024-03-25
| | | | | | | | This can identify situations where flat_hash_* is suboptimal for large elements. PiperOrigin-RevId: 618937993 Change-Id: I2bde069bc3526b14ad1718ba6f50467002aeed16
* Fix ClangTidy warnings in btree.h.Gravatar Evan Brown2024-03-25
| | | | | PiperOrigin-RevId: 618872032 Change-Id: I9fdfadff906494eb64cee976c02a1fff57923c79
* LSC: Move expensive variables on their last use to avoid copies.Gravatar Abseil Team2024-03-24
| | | | | PiperOrigin-RevId: 618650101 Change-Id: I6cff17a9db0dc45ad3b1f833df6ea3d7d04a7449
* PR #1644: unscaledcycleclock: remove RISC-V supportGravatar aurel322024-03-22
| | | | | | | | | | | | | | | | | | | | | | Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1644 Starting with Linux 6.6 [1], RDCYCLE is a privileged instruction on RISC-V and can't be used directly from userland. There is a sysctl option to change that as a transition period, but it will eventually disappear. The RDTIME instruction is another less accurate alternative, however its frequency varies from board to board, and there is currently now way to get its frequency from userland [2]. Therefore this patch just removes the code for unscaledcycleclock on RISC-V. Without processor specific implementation, abseil relies on std::chrono::steady_clock::now().time_since_epoch() which is basically a wrapper around clock_gettime (CLOCK_MONOTONIC), which in turns use __vdso_clock_gettime(). On RISC-V this VDSO is just a wrapper around RDTIME correctly scaled to use nanoseconds units. This fixes the testsuite on riscv64, tested on a VisionFive 2 board. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3 [2] https://github.com/abseil/abseil-cpp/pull/1631 Merge 43356a2548cfde76e164d446cb69004b488c6a71 into 76f8011beabdaee872b5fde7546e02407b220cb1 Merging this change closes #1644 COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1644 from aurel32:rv64-no-unscaledcycleclock 43356a2548cfde76e164d446cb69004b488c6a71 PiperOrigin-RevId: 618286262 Change-Id: Ie4120a727e7d0bb185df6e06ea145c780ebe6652
* Reland: Make DLOG(FATAL) not understood as [[noreturn]]Gravatar Peter Boström2024-03-22
| | | | | | | | Having DLOG(FATAL) be [[noreturn]] in debug builds makes dead-code warnings impossible to satisfy between the release and debug build. PiperOrigin-RevId: 618257732 Change-Id: Ib1c2cb6a026401fbaa0a6e0770adfc166b964ece
* Separate out absl::StatusOr constraints into statusor_internal.hGravatar Abseil Team2024-03-21
| | | | | PiperOrigin-RevId: 617920100 Change-Id: I0717560a88d32c067ce26b463b14d0db458b28b6
* Use Layout::WithStaticSizes in btree.Gravatar Evan Brown2024-03-21
| | | | | PiperOrigin-RevId: 617877687 Change-Id: I29c52f9288f099255c4adb7c1f9fa8831ac55b05
* `layout`: Delete outdated comments about ElementType alias not being used ↵Gravatar Dino Radakovic2024-03-21
| | | | | | | | | because of MSVC Code below those comments does use ElementType. PiperOrigin-RevId: 617854731 Change-Id: I7996b8cbaa2fb65855a801f634a57d821408b1f3
* Performance improvement for absl::AsciiStrToUpper() and absl::AsciiStrToLower()Gravatar Abseil Team2024-03-20
| | | | | PiperOrigin-RevId: 617613544 Change-Id: I526b5bc087edf54046c77795dddf5412478ac6a8
* `layout_benchmark`: Replace leftover comment with intended call to MyAlignGravatar Dino Radakovic2024-03-20
| | | | | PiperOrigin-RevId: 617573381 Change-Id: I0ddab2ab7cf68651424b3cf385b484d27106dd59
* Remove absl::aligned_storage_tGravatar Derek Mauro2024-03-19
| | | | | | | | | | Consistent with std::aligned_storage_t, it is deprecated in C++23. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1413r3.pdf has a suggested replacement PiperOrigin-RevId: 617367005 Change-Id: I009533c5609c8ffd77e406e1fc88e51a3ce99f9f
* Delete ABSL_ANNOTATE_MEMORY_IS_INITIALIZED under Thread SanitizerGravatar Abseil Team2024-03-19
| | | | | PiperOrigin-RevId: 617266753 Change-Id: I6cac7b4616001c8d435fb1786da81b746f2d14cb
* Remove vestigial variables in the DumpNode() helper in absl::CordGravatar Derek Mauro2024-03-19
| | | | | | | Fixes #1636 (GCC -Wmaybe-uninitialized warning) PiperOrigin-RevId: 617253727 Change-Id: I246cd21d8123d4dfa7780b1c4cac8ea1558a4067
* Do hashtablez sampling on the first insertion into an empty SOO hashtable.Gravatar Evan Brown2024-03-19
| | | | | | | | | When sampling triggers, we skip SOO and allocate a backing array. We must do this because the HashtablezInfoHandle is part of the heap allocation (along with the control bytes and slots). By default, we sample 1 in ~1024 hashtables when sampling is enabled. This will impact performance because (a) we won't benefit from SOO so we would have worse data locality (more cache/TLB misses), and (b) the backing array capacity will be 3 instead of 1 so (b.1) we skip the rehash after the second insertion and (b.2) we potentially waste up to two slots worth of memory. We also add an soo_capacity field to HashtablezInfo to allow for distinguishing which sampled tables may otherwise have been SOO - this will allow us to know approximately what fraction of tables are in SOO mode. PiperOrigin-RevId: 617252334 Change-Id: Ib48b7a4870bd74ea3ba923ed8f350a3b75dbb7d3