diff options
| author | Weiming Zhao <weimingz@codeaurora.org> | 2017-07-10 21:23:32 +0000 |
|---|---|---|
| committer | Weiming Zhao <weimingz@codeaurora.org> | 2017-07-10 21:23:32 +0000 |
| commit | ba5b8c8ee77e7b2c2d05c04a36d15a9b5182e314 (patch) | |
| tree | 2df7891ba4bd91f35039e8026bd86104cd248b6a | |
| parent | 77f23b9c218cd87d4eb5d6c40d876d640b389ae7 (diff) | |
| download | bcm5719-llvm-ba5b8c8ee77e7b2c2d05c04a36d15a9b5182e314.tar.gz bcm5719-llvm-ba5b8c8ee77e7b2c2d05c04a36d15a9b5182e314.zip | |
Revert "[libc++] Refactoring __sync_* builtins; NFC"
This reverts commit 72ff8866bca49ee7d24c87673293b4ce88a039ec.
llvm-svn: 307593
| -rw-r--r-- | libcxx/include/__atomic_support | 31 | ||||
| -rw-r--r-- | libcxx/include/__refstring | 9 | ||||
| -rw-r--r-- | libcxx/src/locale.cpp | 2 | ||||
| -rw-r--r-- | libcxx/src/support/runtime/exception_fallback.ipp | 10 | ||||
| -rw-r--r-- | libcxx/src/support/runtime/new_handler_fallback.ipp | 6 |
5 files changed, 12 insertions, 46 deletions
diff --git a/libcxx/include/__atomic_support b/libcxx/include/__atomic_support deleted file mode 100644 index e53140cb569..00000000000 --- a/libcxx/include/__atomic_support +++ /dev/null @@ -1,31 +0,0 @@ -// -*- C++ -*- -//===------------------------ __atomic_support -----------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___ATOMIC_SUPPORT -#define _LIBCPP___ATOMIC_SUPPORT - -#include <__config> - -template<typename T> -T __libcpp_sync_add_and_fetch(T *ptr, T value) { - return __sync_add_and_fetch(ptr, value); -} - -template<typename T> -T __libcpp_sync_fetch_and_add(T *ptr, T value) { - return __sync_fetch_and_add(ptr, value); -} - -template<typename T> -T __libcpp_sync_lock_test_and_set(T *ptr, T value) { - return __sync_lock_test_and_set(ptr, value); -} - -#endif //_LIBCPP___ATOMIC_SUPPORT diff --git a/libcxx/include/__refstring b/libcxx/include/__refstring index de89b79a4b9..7f417a03c49 100644 --- a/libcxx/include/__refstring +++ b/libcxx/include/__refstring @@ -14,7 +14,6 @@ #include <stdexcept> #include <cstddef> #include <cstring> -#include <__atomic_support> #ifdef __APPLE__ #include <dlfcn.h> #include <mach-o/dyld.h> @@ -84,7 +83,7 @@ __libcpp_refstring::__libcpp_refstring(const __libcpp_refstring &s) _NOEXCEPT : __imp_(s.__imp_) { if (__uses_refcount()) - __libcpp_sync_add_and_fetch(&rep_from_data(__imp_)->count, 1); + __sync_add_and_fetch(&rep_from_data(__imp_)->count, 1); } inline @@ -93,10 +92,10 @@ __libcpp_refstring& __libcpp_refstring::operator=(__libcpp_refstring const& s) _ struct _Rep_base *old_rep = rep_from_data(__imp_); __imp_ = s.__imp_; if (__uses_refcount()) - __libcpp_sync_add_and_fetch(&rep_from_data(__imp_)->count, 1); + __sync_add_and_fetch(&rep_from_data(__imp_)->count, 1); if (adjust_old_count) { - if (__libcpp_sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0) + if (__sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0) { ::operator delete(old_rep); } @@ -108,7 +107,7 @@ inline __libcpp_refstring::~__libcpp_refstring() { if (__uses_refcount()) { _Rep_base* rep = rep_from_data(__imp_); - if (__libcpp_sync_add_and_fetch(&rep->count, count_t(-1)) < 0) { + if (__sync_add_and_fetch(&rep->count, count_t(-1)) < 0) { ::operator delete(rep); } } diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp index eb72f3f1d03..3b4c83a0900 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -667,7 +667,7 @@ locale::id::__get() void locale::id::__init() { - __id_ = __libcpp_sync_add_and_fetch(&__next_id, 1); + __id_ = __sync_add_and_fetch(&__next_id, 1); } // template <> class collate_byname<char> diff --git a/libcxx/src/support/runtime/exception_fallback.ipp b/libcxx/src/support/runtime/exception_fallback.ipp index cdf008afef7..69c06a9ce3a 100644 --- a/libcxx/src/support/runtime/exception_fallback.ipp +++ b/libcxx/src/support/runtime/exception_fallback.ipp @@ -9,7 +9,6 @@ //===----------------------------------------------------------------------===// #include <cstdio> -#include <__atomic_support> namespace std { @@ -21,13 +20,13 @@ _LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler; unexpected_handler set_unexpected(unexpected_handler func) _NOEXCEPT { - return __libcpp_sync_lock_test_and_set(&__unexpected_handler, func); + return __sync_lock_test_and_set(&__unexpected_handler, func); } unexpected_handler get_unexpected() _NOEXCEPT { - return __libcpp_sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0); + return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0); } @@ -42,13 +41,14 @@ void unexpected() terminate_handler set_terminate(terminate_handler func) _NOEXCEPT { - return __libcpp_sync_lock_test_and_set(&__terminate_handler, func); + return __sync_lock_test_and_set(&__terminate_handler, func); } terminate_handler get_terminate() _NOEXCEPT { - return __libcpp_sync_fetch_and_add(&__terminate_handler, (terminate_handler)0); + return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0); + } #ifndef __EMSCRIPTEN__ // We provide this in JS diff --git a/libcxx/src/support/runtime/new_handler_fallback.ipp b/libcxx/src/support/runtime/new_handler_fallback.ipp index 75f985d3914..b7092d542d9 100644 --- a/libcxx/src/support/runtime/new_handler_fallback.ipp +++ b/libcxx/src/support/runtime/new_handler_fallback.ipp @@ -8,8 +8,6 @@ // //===----------------------------------------------------------------------===// -#include <__atomic_support> - namespace std { _LIBCPP_SAFE_STATIC static std::new_handler __new_handler; @@ -17,13 +15,13 @@ _LIBCPP_SAFE_STATIC static std::new_handler __new_handler; new_handler set_new_handler(new_handler handler) _NOEXCEPT { - return __libcpp_sync_lock_test_and_set(&__new_handler, handler); + return __sync_lock_test_and_set(&__new_handler, handler); } new_handler get_new_handler() _NOEXCEPT { - return __libcpp_sync_fetch_and_add<new_handler>(&__new_handler, nullptr); + return __sync_fetch_and_add(&__new_handler, nullptr); } } // namespace std |

