summaryrefslogtreecommitdiff
path: root/absl
Commit message (Collapse)AuthorAge
* Merge pull request #1189 from renau:masterGravatar Copybara-Service2022-05-31
|\ | | | | | | | | PiperOrigin-RevId: 452108013 Change-Id: I71fa7bc792d34327680dc3daa96a8d6d4116b49a
* | Allow for using b-tree with `value_type`s that can only be constructed by ↵Gravatar Evan Brown2022-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | the allocator (ignoring copy/move constructors). We were using `init_type`s for temp values that we would move into slots, but in this case, we need to have actual slots. We use node handles for managing slots outside of nodes. Also, in btree::copy_or_move_values_in_order, pass the slots from the iterators rather than references to values. This allows for moving from map keys instead of copying for standard layout types. In the test, fix a couple of ClangTidy warnings from missing includes and calling `new` instead of `make_unique`. PiperOrigin-RevId: 452062967 Change-Id: I870e89ae1aa5b3cfa62ae6e75b73ffc3d52e731c
* | Stop using sleep timeouts for Linux futex-based SpinLockGravatar Derek Mauro2022-05-31
| | | | | | | | | | | | | | | | | | | | | | | | Timeouts were once necessary when the SpinLock Unlock used an atomic store and could therefore have a race and a missed wakeup, however, the Unlock path now uses an atomic exchange, so the missed wakeup cannot happen. Fixes #1179 PiperOrigin-RevId: 452047517 Change-Id: I844944879b51b7f7ddac148e063a376cddd0d05a
* | Automated rollback of commit f2463433d6c073381df2d9ca8c3d8f53e5ae1362.Gravatar Abseil Team2022-05-31
| | | | | | | | | | PiperOrigin-RevId: 451979149 Change-Id: Ic9b02306f2c5324b6648989a895f128c9eb5743d
* | time.h: Use uint32_t literals for calls to overloaded MakeDurationGravatar Anqi D2022-05-30
| | | | | | | | | | | | | | | | | | This fixes an overload that is ambiguous for some toolchains, because 0U does not always refer to a uint32_t (on some toolchains, uint32_t is an unsigned long). PiperOrigin-RevId: 451962182 Change-Id: Id13700817ea3eb6d04e2cc02f20726040eb447fb
| * Avoid variable shadowing which can be a compile error depending on compile flagsGravatar Jose Renau2022-05-30
|/
* Fix typos.Gravatar Abseil Team2022-05-27
| | | | | PiperOrigin-RevId: 451434783 Change-Id: I572e77a67e18e8dd530bf0347c76863c9bb1946f
* Clarify the behaviour of `AssertHeld` and `AssertReaderHeld` when the ↵Gravatar Abseil Team2022-05-27
| | | | | | | calling thread doesn't hold the mutex. PiperOrigin-RevId: 451410449 Change-Id: Iffd4c7463f1051474debbed256703589d96a548c
* Enable __thread on AsyloGravatar Abseil Team2022-05-26
| | | | | PiperOrigin-RevId: 451201387 Change-Id: Ibeac4f24d00e28bbfc61e476936d669321a2cb24
* Add implementation of is_invocable_r to absl::base_internal for C++ < 17, ↵Gravatar Dino Radakovic2022-05-26
| | | | | | | define it as alias of std::is_invocable_r when C++ >= 17 PiperOrigin-RevId: 451171660 Change-Id: I6dc0e40eabac72b82c4a19e292158e43118cb080
* Optimize SwissMap iteration for aarch64 by 5-6%Gravatar Abseil Team2022-05-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benchmarks: https://pastebin.com/tZ7dr67W. Works well especially on smaller ranges. After a week on spending optimizing NEON SIMD where I almost managed to make hash tables work with NEON SIMD without performance hits (still 1 cycle to optimize and I gave up a little), I found an interesting optimization for aarch64 to use cls instruction (count leading sign bits). The loop has a property that ctrl_ group is not matched against count when the first slot is empty or deleted. ``` void skip_empty_or_deleted() { while (IsEmptyOrDeleted(*ctrl_)) { uint32_t shift = Group{ctrl_}.CountLeadingEmptyOrDeleted(); ctrl_ += shift; slot_ += shift; } ... } ``` However, `kEmpty` and `kDeleted` have format of `1xxxxxx0` and `~ctrl & (ctrl >> 7)` always sets the lowest bit to 1. In naive implementation, it does +1 to start counting zero bits, however, in aarch64 we may start counting one bits immediately. This saves 1 cycle and 5% of iteration performance. Then it becomes hard to find a supported and sustainable C++ version of it. `__clsll` is not supported by GCC and was supported only since clang 8, `__builtin_clrsb` is not producing optimal codegen for clang. `__rbit` is not supported by GCC and there is no intrinsic to do that, however, in clang we have `__builtin_bitreverse{32,64}`. For now I decided to enable this only for clang, only if they have appropriate builtins. PiperOrigin-RevId: 451168570 Change-Id: I7e9256a60aecdc88ced4e6eb15ebc257281b6664
* Fix detection of ABSL_HAVE_ELF_MEM_IMAGE on HaikuGravatar Derek Mauro2022-05-25
| | | | | | | | Fixes #1181 ORIGINAL_AUTHOR=jerome.duval@gmail.com PiperOrigin-RevId: 451006334 Change-Id: Id61e5889fb55594d09e92e7bb98fdf8bfbc13cc4
* Import of CCTZ from GitHub.Gravatar Abseil Team2022-05-23
| | | | | PiperOrigin-RevId: 450445030 Change-Id: I1c1e5ed67f81a181454f7fc6751bf42a3bc2bc48
* Cord: workaround a GCC 12.1 bug that triggers a spurious warningGravatar Derek Mauro2022-05-20
| | | | | | | | | | | | | See the GCC bug report https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105585 and Abseil bug report https://github.com/abseil/abseil-cpp/issues/1175 Fixes #1175 PiperOrigin-RevId: 450083136 Change-Id: I207aaffaec9166b335065dd6ef148a721b94048e
* Change workaround for MSVC bug regarding compile-time initialization to ↵Gravatar Abseil Team2022-05-19
| | | | | | | | | trigger from MSC_VER 1910 to 1930. 1929 is the last _MSC_VER for Visual Studio 2019. PiperOrigin-RevId: 449909831 Change-Id: Ibca931cc31131235eba55d2a1b97c7a062f059db
* Don't default to the unscaled cycle clock on any Apple targets.Gravatar Tom Rybka2022-05-19
| | | | | | | | Previously was disabled on iPhone, but still enabled for macOS. The unscaled cycle clock does not work correctly when run on a VM. PiperOrigin-RevId: 449876559 Change-Id: I679ade90b43462e8d2794b1a2b32569d59029ed9
* Use SSE instructions for prefetch when __builtin_prefetch is unavailableGravatar Derek Mauro2022-05-18
| | | | | | | | | | | | This notably gets prefetch working on MSVC Implementation note: https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-prefetchcacheline MSVC does have PreFetchCacheLine, but that would require including <windows.h> in a header PiperOrigin-RevId: 449602543 Change-Id: I5e6ca4b7c3d287779aa03c2fd348b41fb65c3680
* Replace direct uses of __builtin_prefetch from SwissTable with the wrapper ↵Gravatar Greg Falcon2022-05-18
| | | | | | | | | | | functions. Add a new (internal) feature test macro to detect whether the wrappers are no-ops on a given platform. Note that one-arg __builtin_prefetch(x) is equivalent to __builtin_prefetch(x, 0, 3), per `man BUILTIN_PREFETCH(3)` and gcc docs. PiperOrigin-RevId: 449508660 Change-Id: I144e750205eec0c956d8dd62bc72e10bdb87c4f7
* Cast away an unused variable to play nice with -Wunused-but-set-variable.Gravatar Abseil Team2022-05-17
| | | | | PiperOrigin-RevId: 449351955 Change-Id: Id30280107bb29f7d715327b99a2c954809513a48
* Use NullSafeStringView for const char* args to absl::StrCat, treating null ↵Gravatar Dino Radakovic2022-05-17
| | | | | | | | | pointers as "" Fixes #1167 PiperOrigin-RevId: 449328725 Change-Id: I813785db77b94efa49eeeff4c93449334c380935
* raw_logging: Extract the inlined no-hook-registered behavior for ↵Gravatar Andy Getzendanner2022-05-17
| | | | | | | LogPrefixHook to a default implementation. PiperOrigin-RevId: 449306617 Change-Id: Ia3e87d2edcae7e9874998f21a0e2ff245e48fd96
* absl: fix use-after-free in Mutex/CondVarGravatar Abseil Team2022-05-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both Mutex and CondVar signal PerThreadSem/Waiter after satisfying the wait condition, as the result the waiting thread may return w/o waiting on the PerThreadSem/Waiter at all. If the waiting thread then exits, it currently destroys Waiter object. As the result Waiter::Post can be called on already destroyed object. PerThreadSem/Waiter must be type-stable after creation and must not be destroyed. The futex-based implementation is the only one that is not affected by the bug since there is effectively nothing to destroy (maybe only UBSan/ASan could complain about calling methods on a destroyed object). Here is the problematic sequence of events: 1: void Mutex::Block(PerThreadSynch *s) { 2: while (s->state.load(std::memory_order_acquire) == PerThreadSynch::kQueued) { 3: if (!DecrementSynchSem(this, s, s->waitp->timeout)) { 4: PerThreadSynch *Mutex::Wakeup(PerThreadSynch *w) { 5: ... 6: w->state.store(PerThreadSynch::kAvailable, std::memory_order_release); 7: IncrementSynchSem(this, w); 8: ... 9: } Consider line 6 is executed, then line 2 observes kAvailable and line 3 is not called. The thread executing Mutex::Block returns from the method, acquires the mutex, releases the mutex, exits and destroys PerThreadSem/Waiter. Now Mutex::Wakeup resumes and executes line 7 on the destroyed object. Boom! CondVar uses a similar pattern. Moreover the semaphore-based Waiter implementation is not even destruction-safe (the Waiter cannot be used to signal own destruction). So even if Mutex/CondVar would always pair Waiter::Post with Waiter::Wait before destroying PerThreadSem/Waiter, it would still be subject to use-after-free bug on the semaphore. PiperOrigin-RevId: 449159939 Change-Id: I497134fa8b6ce1294a422827c5f0de0e897cea31
* absl: fix live-lock in CondVarGravatar Abseil Team2022-05-17
| | | | | | | | CondVar::WaitWithTimeout can live-lock when timeout is racing with Signal/SignalAll and Signal/SignalAll thread is not scheduled due to priorities, affinity or other scheduler artifacts. This could lead to stalls of up to tens of seconds in some cases. PiperOrigin-RevId: 449159670 Change-Id: I64bbd277c1f91964cfba3306ba8a80eeadf85f64
* Add a stress test for base_internal::ThreadIdentity reuse.Gravatar Abseil Team2022-05-16
| | | | | PiperOrigin-RevId: 449067700 Change-Id: I972b1736c28d76ed500e9ad6fd15c7a469a5825f
* Improve compiler errors for mismatched ParsedFormat inputs.Gravatar Samuel Benzaquen2022-05-13
| | | | | PiperOrigin-RevId: 448582508 Change-Id: I67fbff5f42a083e093ea2c20749e073ca03feb0b
* Internal changeGravatar Abseil Team2022-05-12
| | | | | PiperOrigin-RevId: 448361090 Change-Id: Iec6063b88a778dfe815081612650eaa456503265
* Fix an msan warning in cord_ringbuffer_testGravatar Benjamin Barenblat2022-05-12
| | | | | | | | | Stop the absl::Cord destructor from running on the constinit cord in CordTest.ConstinitConstructor. This allows inspecting the cord at any point while the test is exiting, which is important for the semantics of the test. PiperOrigin-RevId: 448327386 Change-Id: Icef9faa2b63f1f0ae60b3430dcf6184f5dead885
* Fix spelling error "charachter"Gravatar Abseil Team2022-05-11
| | | | | PiperOrigin-RevId: 448159349 Change-Id: I6b25a90d8a3b6d3a888274d156aa696d77fb042d
* Document that Consume(Prefix|Suffix)() don't modify the input on failureGravatar Abseil Team2022-05-11
| | | | | PiperOrigin-RevId: 448075898 Change-Id: Ia4047f833bf27c62752b41f4ba65ab3be88a0181
* Fixes for C++20 support when not using std::optional.Gravatar Abseil Team2022-05-10
| | | | | | | | | | | * Avoid warnings due to deprecation of volatile return types. Also fix up optional_test.cc due to ABSL_USES_STD_OPTIONAL always being false in its body. Bug: chromium:1284275 PiperOrigin-RevId: 447796238 Change-Id: If050206c979c6c08af22e71ff0ea91e7f7932f0c
* raw_logging: Document that AbortHook's buffers live for as long as the ↵Gravatar Andy Getzendanner2022-05-05
| | | | | | | process remains alive. PiperOrigin-RevId: 446725910 Change-Id: I291fa8c1c41155b1530969f64b2b7f44b1576c92
* raw_logging: Rename SafeWriteToStderr to indicate what about it is safe ↵Gravatar Andy Getzendanner2022-05-04
| | | | | | | | | (answer: it's async-signal-safe). Also, preserve errno across calls to make it actually signal-safe. PiperOrigin-RevId: 446620926 Change-Id: I875fbec02b909e8424ddf763303b0d6007f8548f
* Correct the comment about the probe sequence. It's (i/2 + i)/2 not (i/2 - i)/2.Gravatar Abseil Team2022-05-04
| | | | | | | Also note that this probe sequence visits every group exactly once. PiperOrigin-RevId: 446535602 Change-Id: I13169be3f8ee6a4ddbbe8be84f1e1a482444d0cc
* Improve analysis of the number of extra `==` operations, which was overly ↵Gravatar Abseil Team2022-05-04
| | | | | | | | | | | | | | | | complicated, slightly incorrect. The old analysis viewed it as birthday attack, which asks how often there are multiple values in the probe same probe sequence with the same H2. In their own words, this analysis "breaks down" at around `n = 12`. Instead we can answer a simpler question, which is, if a probe sequence examines `k` objects that are not what we are looking for, what's the number of calls `==`? The expectation is simply `k/128`. PiperOrigin-RevId: 446518063 Change-Id: Ie879bd4f6c97979822bc9d550b9e2503b1418c78
* In btree, move rightmost_ into the CompressedTuple instead of root_.Gravatar Evan Brown2022-05-04
| | | | | | | We also add accessors for rightmost()/mutable_rightmost(). PiperOrigin-RevId: 446515231 Change-Id: I4b8cb46f4bd209a0f51dcdcb96c9479e480828a3
* raw_logging: Rename LogPrefixHook to reflect the other half of it's job ↵Gravatar Andy Getzendanner2022-05-04
| | | | | | | (filtering by severity). PiperOrigin-RevId: 446476285 Change-Id: Ibd0913e06244424241200d17177a4f220fcb7861
* Don't construct/destroy object twiceGravatar Abseil Team2022-05-03
| | | | | PiperOrigin-RevId: 446274314 Change-Id: Ibf641808c533a10e0aef8d1601095e539ae5c43a
* Rename function_ref_benchmark.cc into more generic ↵Gravatar Dino Radakovic2022-05-03
| | | | | | | function_type_benchmark.cc, add missing includes PiperOrigin-RevId: 446209567 Change-Id: I9aac8ce10b93ed71f1260931995af1d32db6f780
* Fixed typo in `try_emplace` comment.Gravatar Abseil Team2022-05-02
| | | | | PiperOrigin-RevId: 446010475 Change-Id: I28020510f3888a11f35b1960e9af441145ebf39b
* Fix a typo in a comment.Gravatar Abseil Team2022-04-29
| | | | | PiperOrigin-RevId: 445394311 Change-Id: I265b6a83f79bbed4321e24e6da4730a2c43ddb07
* Adds ABSL_CONST_INIT to initializing declarations where it is missingGravatar Derek Mauro2022-04-25
| | | | | | | Fixes #1159 PiperOrigin-RevId: 444278141 Change-Id: Iae055fe78b438c31150a9e7601b734f4981f002e
* Automated visibility attribute cleanup.Gravatar Abseil Team2022-04-25
| | | | | PiperOrigin-RevId: 444259007 Change-Id: Ic518f66a33e387b7a551f37f7c0f6003c743dcb0
* Fix typo in absl/time/time.hGravatar Dino Radakovic2022-04-22
| | | | | PiperOrigin-RevId: 443726104 Change-Id: Ibd015472fe3e403c2da49bdeeb365ca9a817b8a5
* Fix typo: "a the condition" -> "a condition".Gravatar Abseil Team2022-04-22
| | | | | PiperOrigin-RevId: 443723710 Change-Id: Ic39b0cf2b289efa9cd9434616949dd08a1a35117
* Export of internal Abseil changesGravatar Abseil Team2022-04-19
| | | | | | | | | | | -- 6457ad659de86ce4cae1e9f7cb03a701c6c2851e by Abseil Team <absl-team@google.com>: Introduced ErrnoToStatusCode and ErrnoToStatus to abseil. PiperOrigin-RevId: 442903450 Change-Id: I9c062b34a3811216f43eef56e631eada3b4e3e84 GitOrigin-RevId: 6457ad659de86ce4cae1e9f7cb03a701c6c2851e
* Export of internal Abseil changesGravatar Abseil Team2022-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- 3d018c03a34bf273a4b24b3584ed77f0a6d21686 by Abseil Team <absl-team@google.com>: Fix a spelling typo (s/boundries/boundaries). PiperOrigin-RevId: 442041877 Change-Id: I608020697d37b85316bb9a0838e4b457659c926c -- 518b8119e51db24ce7fb0fd2fe537ec43825c3e6 by Dino Radakovic <dinor@google.com>: absl/types/internal/variant: Make include guard uppercase https://google.github.io/styleguide/cppguide.html#The__define_Guard PiperOrigin-RevId: 441911692 Change-Id: I9837dd07f20204d8253f20627b0917a34dc21825 -- b91696c38310a7cae8c1ea9e2d479495f5dc3f69 by Greg Falcon <gfalcon@google.com>: Add an internal-only API to wrap __builtin_prefetch() if available. This private API is intended for future use by the Abseil implementation. Like any internal-namespaced function, it may be changed or removed at any time. PiperOrigin-RevId: 441894616 Change-Id: Iaa48bd4680b373f4a0d5afab0cb35e2a1908595f -- 0f01e8b0551a662e02dff60840c54320f987315f by Derek Mauro <dmauro@google.com>: C++20: Use the standard `constinit` keyword for `ABSL_CONST_INIT` when available PiperOrigin-RevId: 441778874 Change-Id: I70c616469752ff23b326b1c615437599f42cc6aa GitOrigin-RevId: 3d018c03a34bf273a4b24b3584ed77f0a6d21686
* Export of internal Abseil changesGravatar Abseil Team2022-04-14
| | | | | | | | | | | | | -- 155545fafefd0a0cef83853f1addea1ecf4a4618 by Derek Mauro <dmauro@google.com>: Support ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS on MSVC https://docs.microsoft.com/en-us/cpp/cpp/no-sanitize-address PiperOrigin-RevId: 441737758 Change-Id: Ida9b185a929ffa22ad2ffdcfbd53076f69bfc036 GitOrigin-RevId: 155545fafefd0a0cef83853f1addea1ecf4a4618
* Export of internal Abseil changesGravatar Abseil Team2022-04-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- f4c7e510922668c68be4aa79a00867c3d3ca9f95 by Derek Mauro <dmauro@google.com>: Many improvements to LeakChecker builds The presence of the LeakChecker is now detected when possible. GCC users using LeakChecker in standalone mode still need to use -DLEAK_CHECKER. This is now documented in the header. The hacky targets used for testing leak checking have been removed in favor of testing in AddressSanitizer mode on Kokoro. Fixes #885 Fixes #1153 PiperOrigin-RevId: 441203393 Change-Id: Ibe64ef6b104bcaf31839ff7184e558cc86abdd1c -- 5c70a23aa83b8152ab95d2cf21662fc63c80ef7d by Abseil Team <absl-team@google.com>: Add a benchmark for stacktrace PiperOrigin-RevId: 441196473 Change-Id: I4c9aa2e797aa2cae09abfaaee3abe5c09eb62fc4 -- 50b406052273b9d5bad04a7860a96e4d5d956c02 by Abseil Team <absl-team@google.com>: Internal change. PiperOrigin-RevId: 441114481 Change-Id: I667af7a50d5631ca91289dd24c91ba90233e0184 -- 568b4eaac120b420bce5290179d407d2b57d5bae by Dino Radakovic <dinor@google.com>: Internal change PiperOrigin-RevId: 440894155 Change-Id: Ia587ffc65a8321126585fb363b7c0ca8cc2a0da2 -- d53948eace4f3a10ac5a6c1496dc51b81adc412c by Abseil Team <absl-team@google.com>: Explicitly give internal linkage to symbols which are not used outside of their translation units. PiperOrigin-RevId: 440424519 Change-Id: I531c5e229d443375483b7550a34f48042589a99b GitOrigin-RevId: f4c7e510922668c68be4aa79a00867c3d3ca9f95
* Export of internal Abseil changesGravatar Abseil Team2022-04-07
| | | | | | | | | | | -- 0c8848ebedc07470c7ab647a5bb8949481540ce9 by Dino Radakovic <dinor@google.com>: Define absl::base_internal::invoke using std::invoke when C++ >= 17 PiperOrigin-RevId: 439880834 Change-Id: I3622fcf473501d54c57575118a11d54c19573446 GitOrigin-RevId: 0c8848ebedc07470c7ab647a5bb8949481540ce9
* Export of internal Abseil changesGravatar Abseil Team2022-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- ef2bf829c333f378ecc12f3259e3187cdb75a3d5 by Abseil Team <absl-team@google.com>: debugging: fix the VDSO symbol name used for unwinding on RISC-V Linux The name listed in `man vdso` is incorrect. Instead, use the name from `linux-5.16/arch/riscv/kernel/vdso/rt_sigreturn.S` PiperOrigin-RevId: 439654174 Change-Id: Ib39d066f416681720068e806e828a2c76a14a532 -- 43dfad824afd36cfc3e5049b4fea71a2bccb066c by Benjamin Barenblat <bbaren@google.com>: Check printf format strings in str_format_convert_test Add ABSL_PRINTF_ATTRIBUTE to appropriate functions in strings/internal/str_format/convert_test. Correct TypedFormatConvertTest.Char, which was accidentally passing values of types larger than int to StrPrint. PiperOrigin-RevId: 439388148 Change-Id: I6cde4e8e0c6455064138192430f07f4c990be0bc -- f84b4ab2c3b070c8af0c82742ac7a8a4bf443bca by Derek Mauro <dmauro@google.com>: Use __builtin_memcmp in the absl::string_view implementation starting with MSVC 16.9, where it first appeared This enables more constexpr operations PiperOrigin-RevId: 439317316 Change-Id: Iaf1ce76b60901d4b2d5b96be5900c56572f57b15 GitOrigin-RevId: ef2bf829c333f378ecc12f3259e3187cdb75a3d5