summaryrefslogtreecommitdiff
path: root/absl/base
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-05-15 12:21:46 -0700
committerGravatar Andy Soffer <asoffer@google.com>2019-05-15 15:37:33 -0400
commitfa00c321073c7ea40a4fc3dfc8a06309eae3d025 (patch)
tree6bd77267f450a1eedf65a5fb3858ca1c8faa44e7 /absl/base
parent436ba6c4a0ea3a06eca6e055f9c8d296bf3bae12 (diff)
Export of internal Abseil changes.
-- 6258612abc571fa7f51f34046b410c73486505fe by Derek Mauro <dmauro@google.com>: Rollback checking the return value of pthread functions in thread_identity.cc. PiperOrigin-RevId: 248381230 -- fda6acddab04fc53eeb84ec253de4a9655bf9a36 by CJ Johnson <johnsoncj@google.com>: Removes too-restrictive benchmark abstraction in inlined_vector_benchmark PiperOrigin-RevId: 248366325 -- 68674991e63c919de8a3eebced5adec6466ec8fe by Abseil Team <absl-team@google.com>: Check for pthread_setmask() failure. Log a fatal error message if pthread_setmask() fails. PiperOrigin-RevId: 248347115 -- 45389e44c0d1badafb6b560cae3df99fc8bd16ac by Derek Mauro <dmauro@google.com>: Fix a -Wredundant-move warning in GCC 9. PiperOrigin-RevId: 248338682 -- 12cfbacf599084a8ac6bf4395026cbf193c85a26 by Derek Mauro <dmauro@google.com>: Check the return value of pthread functions in thread_identity.cc. PiperOrigin-RevId: 248327118 -- 2bc69998e68cfee96e812ce800e83cce7a715091 by Benjamin Barenblat <bbaren@google.com>: Encourage judicious use of ABSL_PREDICT_{TRUE,FALSE} Recommend that users use branch prediction annotations only on hot, consistently mispredicted branches. PiperOrigin-RevId: 248222450 GitOrigin-RevId: 6258612abc571fa7f51f34046b410c73486505fe Change-Id: I09d409f9a3941ee926b8476b5473f9c4899cc3ff
Diffstat (limited to 'absl/base')
-rw-r--r--absl/base/internal/low_level_alloc.cc5
-rw-r--r--absl/base/optimization.h6
2 files changed, 10 insertions, 1 deletions
diff --git a/absl/base/internal/low_level_alloc.cc b/absl/base/internal/low_level_alloc.cc
index 5a8199e6..36e4f1ba 100644
--- a/absl/base/internal/low_level_alloc.cc
+++ b/absl/base/internal/low_level_alloc.cc
@@ -294,7 +294,10 @@ class SCOPED_LOCKABLE ArenaLock {
arena_->mu.Unlock();
#ifndef ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING
if (mask_valid_) {
- pthread_sigmask(SIG_SETMASK, &mask_, nullptr);
+ const int err = pthread_sigmask(SIG_SETMASK, &mask_, nullptr);
+ if (err != 0) {
+ ABSL_RAW_LOG(FATAL, "pthread_sigmask failed: %d", err);
+ }
}
#endif
left_ = true;
diff --git a/absl/base/optimization.h b/absl/base/optimization.h
index 6974f1f6..0dcbef32 100644
--- a/absl/base/optimization.h
+++ b/absl/base/optimization.h
@@ -163,6 +163,12 @@
// Compilers can use the information that a certain branch is not likely to be
// taken (for instance, a CHECK failure) to optimize for the common case in
// the absence of better information (ie. compiling gcc with `-fprofile-arcs`).
+//
+// Recommendation: Modern CPUs dynamically predict branch execution paths,
+// typically with accuracy greater than 97%. As a result, annotating every
+// branch in a codebase is likely counterproductive; however, annotating
+// specific branches that are both hot and consistently mispredicted is likely
+// to yield performance improvements.
#if ABSL_HAVE_BUILTIN(__builtin_expect) || \
(defined(__GNUC__) && !defined(__clang__))
#define ABSL_PREDICT_FALSE(x) (__builtin_expect(x, 0))