summaryrefslogtreecommitdiff
path: root/absl/base
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2018-11-06 13:01:25 -0800
committerGravatar Shaindel Schwartz <shaindel@google.com>2018-11-06 16:06:39 -0500
commit7990fd459e9339467814ddb95000c87cb1e4d945 (patch)
treeb6d2b5e5d1471695a7551db93b68ca43883c6547 /absl/base
parentf95179062eb65ce40895cc76f1398cce25394369 (diff)
Export of internal Abseil changes.
-- ee19e203eca970ff88e8f25ce4e19c32e143b988 by Jon Cohen <cohenjon@google.com>: Exception safety testing no longer uses absl::optional PiperOrigin-RevId: 220336204 -- 460666eb0b316a8b4aeedc589644d53b05251bd1 by Derek Mauro <dmauro@google.com>: Rework SwissTable SSE2 support - Use SSE2 on MSVC when available https://github.com/abseil/abseil-cpp/issues/210 - Emulate _mm_cmpgt_epi8 with other SSE2 instructions when using -funsigned-char under GCC https://github.com/abseil/abseil-cpp/issues/209 PiperOrigin-RevId: 220312351 -- 1f4318ecedf8d539b7b698eb803d613ad6b69278 by Abseil Team <absl-team@google.com>: Change CollectPerfectRatios to use 10 trials to smooth out the outliers in the sample. PiperOrigin-RevId: 220286579 -- 6755abc2673553a7f578bb29c6e9ca8d991bc9c8 by Abseil Team <absl-team@google.com>: Internal change PiperOrigin-RevId: 220274307 -- 8645b6187329ebf0aaf3c2de2888ba44466cd879 by Abseil Team <absl-team@google.com>: * #endif for a header guard should reference the guard macro in a comment PiperOrigin-RevId: 220206868 -- 3987a7ad11319230910931cd2468b60b3fd1b85c by Gennadiy Civil <misterg@google.com>: Internal Change PiperOrigin-RevId: 220136674 -- cc908c1db2ee0d4523dc813e33f600583bb986c5 by Abseil Team <absl-team@google.com>: absl: fix backoff logic in SpinLockWait There are 3 bugs in loop variable handling: 1. It starts with 0, but AbslInternalSpinLockDelay ignores loop == 0. So it does not actually wait when it should. 2. loop is incremented after successful state changes, but it should not (why would be increase backoff delay after that?). 3. loop is incremented after CAS failures, but it should not (why would be increase backoff delay after that?). Use the same handling of loop as used in SpinLock. PiperOrigin-RevId: 220136079 -- a0a1c6ef5910ebd28e07215d7df03cc0da0b3eed by Abseil Team <absl-team@google.com>: absl: relax unnecessarily strong memory ordering in SpinLock::SlowLock We don't need to acquire visibility over anything when setting kSpinLockSleeper. Replace the confusing and unnecessarily strong memory order with relaxed. PiperOrigin-RevId: 220023380 -- c50858b51af28b9fca1a62616324f85f3e84ea74 by Tom Manshreck <shreck@google.com>: Update comments in flat_hash_map, node_hash_{set, map} and the containers developer guide PiperOrigin-RevId: 219938692 -- e87b7d1a5f61e165b1c44d3b16d8d967197cdfce by CJ Johnson <johnsoncj@google.com>: Rearranges the public methods of InlinedVector and cleans up the comments PiperOrigin-RevId: 219896257 -- f3234c466f792e0fc4bfd21fc7919dba5e679375 by CJ Johnson <johnsoncj@google.com>: Adds branch prediction to exceptional early exit cases of inlined vector's API PiperOrigin-RevId: 219887173 -- 4dfccf1a81ca0425912d3da25a8470f78c532ce4 by CJ Johnson <johnsoncj@google.com>: Fixes the InlinedVector public interface to use the allocator type references instead of assuming the type Also cleans up some cruft in formatting and comments PiperOrigin-RevId: 219878876 -- 4bb6a2b892abb10bd6a424db7e94ed8640802470 by Tom Manshreck <shreck@google.com>: Add comments on constructor and assignment operator support to flat_hash_set PiperOrigin-RevId: 219825338 -- c23f973e2f7f4feea0da36bf8a9c3f8a8954bb74 by Abseil Team <absl-team@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 219823847 GitOrigin-RevId: ee19e203eca970ff88e8f25ce4e19c32e143b988 Change-Id: I288c927ca481dc57340420dbb4c278a05cf15e83
Diffstat (limited to 'absl/base')
-rw-r--r--absl/base/BUILD.bazel3
-rw-r--r--absl/base/CMakeLists.txt2
-rw-r--r--absl/base/internal/exception_safety_testing.h2
-rw-r--r--absl/base/internal/spinlock.cc2
-rw-r--r--absl/base/internal/spinlock_wait.cc7
5 files changed, 8 insertions, 8 deletions
diff --git a/absl/base/BUILD.bazel b/absl/base/BUILD.bazel
index 9b86ce77..44de05e3 100644
--- a/absl/base/BUILD.bazel
+++ b/absl/base/BUILD.bazel
@@ -187,7 +187,6 @@ cc_library(
deps = [
":base",
":config",
- ":core_headers",
],
)
@@ -236,7 +235,7 @@ cc_library(
"//absl/memory",
"//absl/meta:type_traits",
"//absl/strings",
- "//absl/types:optional",
+ "//absl/utility",
"@com_google_googletest//:gtest",
],
)
diff --git a/absl/base/CMakeLists.txt b/absl/base/CMakeLists.txt
index 3c580d43..d506bc47 100644
--- a/absl/base/CMakeLists.txt
+++ b/absl/base/CMakeLists.txt
@@ -381,7 +381,7 @@ set(EXCEPTION_SAFETY_TESTING_TEST_PUBLIC_LIBRARIES
absl::memory
absl::meta
absl::strings
- absl::optional
+ absl::utility
)
absl_test(
diff --git a/absl/base/internal/exception_safety_testing.h b/absl/base/internal/exception_safety_testing.h
index 0ecc4177..d4d41a8a 100644
--- a/absl/base/internal/exception_safety_testing.h
+++ b/absl/base/internal/exception_safety_testing.h
@@ -33,7 +33,7 @@
#include "absl/meta/type_traits.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
-#include "absl/types/optional.h"
+#include "absl/utility/utility.h"
namespace testing {
diff --git a/absl/base/internal/spinlock.cc b/absl/base/internal/spinlock.cc
index 1b97efbc..cef149e6 100644
--- a/absl/base/internal/spinlock.cc
+++ b/absl/base/internal/spinlock.cc
@@ -141,7 +141,7 @@ void SpinLock::SlowLock() {
// owner to think it experienced contention.
if (lockword_.compare_exchange_strong(
lock_value, lock_value | kSpinLockSleeper,
- std::memory_order_acquire, std::memory_order_relaxed)) {
+ std::memory_order_relaxed, std::memory_order_relaxed)) {
// Successfully transitioned to kSpinLockSleeper. Pass
// kSpinLockSleeper to the SpinLockWait routine to properly indicate
// the last lock_value observed.
diff --git a/absl/base/internal/spinlock_wait.cc b/absl/base/internal/spinlock_wait.cc
index 0fde9c04..365a7939 100644
--- a/absl/base/internal/spinlock_wait.cc
+++ b/absl/base/internal/spinlock_wait.cc
@@ -38,14 +38,15 @@ namespace base_internal {
uint32_t SpinLockWait(std::atomic<uint32_t> *w, int n,
const SpinLockWaitTransition trans[],
base_internal::SchedulingMode scheduling_mode) {
- for (int loop = 0; ; loop++) {
+ int loop = 0;
+ for (;;) {
uint32_t v = w->load(std::memory_order_acquire);
int i;
for (i = 0; i != n && v != trans[i].from; i++) {
}
if (i == n) {
- SpinLockDelay(w, v, loop, scheduling_mode); // no matching transition
- } else if (trans[i].to == v || // null transition
+ SpinLockDelay(w, v, ++loop, scheduling_mode); // no matching transition
+ } else if (trans[i].to == v || // null transition
w->compare_exchange_strong(v, trans[i].to,
std::memory_order_acquire,
std::memory_order_relaxed)) {