History log of /external/libcxx/src/memory.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c79549b70e66c251c15dd145c964edb70fa2e2b3 17-Jan-2018 Dan Albert <danalbert@google.com> Revert "Revert "Merge to upstream r304942.""

This reverts commit 38a0d5af7e5d13553fe623053e05dffc06403280.

Test: make checkbuild
Test: ./run_tests.py
Test: ./run_tests.py --bitness 64
/external/libcxx/src/memory.cpp
38a0d5af7e5d13553fe623053e05dffc06403280 11-Jan-2018 Dan Albert <danalbert@google.com> Revert "Merge to upstream r304942."

This reverts commit 83b1388ecd96b1cc641522ae3b6338898be32a17, reversing
changes made to f20819f925e1ca67fc187e5f08413624a5994efc.

Test: treehugger
Bug: None
/external/libcxx/src/memory.cpp
474dfc389d4314a9b635e739b478a92ddae97123 04-May-2017 Eric Fiselier <eric@efcs.ca> Fix incorrect usage of __libcpp_mutex_trylock. Patch from Andrey Khalyavin

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
83e040ffab30c02aca00c58d0450ca52e7083736 04-May-2017 Eric Fiselier <eric@efcs.ca> Use nullptr instead of the literal 0

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
a7ae303de36dfa1e0a165c52cd073c51dc85e8cb 17-Jan-2017 Eric Fiselier <eric@efcs.ca> Add ABI option to remove recently inlined __shared_count functions from the library.

In order to allow inlining of previously out-of-line functions without an ABI break
libc++ provides legacy definitions in the dylib that old programs can
continue to use. Unfortunatly Windows link.exe detects this hack and diagnoses the duplicate
definitions.

This patch disable the duplicate definitions on Windows by adding an ABI option
which disables all "legacy out-of-line symbols"

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292190 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
8993759ae957800a061e60d1809482efb03e3ba3 17-Jan-2017 Kevin Hu <hxy9243@gmail.com> [Test patch] Inline hot functions in libcxx shared_ptr

Moves hot functions such as atomic add into the memory header file
so that they can be inlined, which brings performance benefits.

Patch by Kevin Hu, Aditya Kumar, Sebastian Pop

Differential Revision: https://reviews.llvm.org/D24991


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292184 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
46a0c2ef0cfee26a9c56d61763693966346a00e5 05-Jan-2017 Eric Fiselier <eric@efcs.ca> Fix std::pointer_safety type in ABI v2

In the C++ standard `std::pointer_safety` is defined
as a C++11 strongly typed enum. However libc++ currently defines
it as a class type which simulates a C++11 enumeration. This
can be detected in valid C++ code.

This patch introduces an the _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE ABI option.
When defined `std::pointer_safety` is implemented as an enum type.
Unfortunatly this also means it can no longer be provided as an extension
in C++03.

Additionally this patch moves the definition for `get_pointer_safety()`
out of the dylib, and into the headers. New usages of `get_pointer_safety()`
will now use the inline version instead of the dylib version. However in
order to keep the dylib ABI compatible the old definition is explicitly
compiled into it.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
ff4f2987804aa25f30c57e9c5cfe7e4233c05770 29-Sep-2016 Eric Fiselier <eric@efcs.ca> Mark libc++ internal globals with _LIBCPP_SAFE_STATIC.

This patch applies the _LIBCPP_SAFE_STATIC attribute to internal globals,
most of which are locking primitives, in order to ensure that they can
safely be used during program startup.

This patch also fixes an unsafe static init issue with the global locks
used to implement atomic operations on shared pointers. Previously the
locks were initialized using a dynamically initialized pointer, so it was
possible that the pointer was uninitialized.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282640 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
db870e60158350d5192e34027919e33252d059ed 02-Aug-2016 Ben Craig <ben.craig@codeaurora.org> Fixing 'Aquire' typo and libcxx build.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277456 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
16d768ba0d9a4c9a1b67f5600f1584977577007c 01-Aug-2016 Ben Craig <ben.craig@codeaurora.org> Improve shared_ptr dtor performance

If the last destruction is uncontended, skip the atomic store on
__shared_weak_owners_. This shifts some costs from normal
shared_ptr usage to weak_ptr uses.

https://reviews.llvm.org/D22470


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@277357 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
ba9dccd902a8276e17a066e9e635fb2cc9a34d1f 18-Jun-2016 Eric Fiselier <eric@efcs.ca> Enable building and using atomic shared_ptr for GCC.

Summary:
Currently the implementation of [util.smartptr.shared.atomic] is provided only when using Clang, and not with GCC. This is a relic of not having a GCC implementation of <atomic>, even though <atomic> isn't actually used in the implementation. This patch enables support for atomic shared_ptr functions when using GCC.

Note that this is not a header only change. Previously only Clang builds of libc++.so would provide the required symbols. There is no reason for this restriction.
After this change both Clang and GCC builds should be binary compatible with each other WRT these symbols.


Reviewers: mclow.lists, rmaprath, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D21407

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
35ff03b7c2a50d197049edbe223042aec221fec1 06-May-2016 Asiri Rathnayake <asiri.rathnayake@arm.com> Refactor pthread usage of libcxx.

This patch extracts out all the pthread dependencies of libcxx into the
new header __threading_support. The motivation is to make it easy to
re-target libcxx into platforms that do not support pthread.

Original patch from Fulvio Esposito (fulvio.esposito@outlook.com) - D11781

Applied with tweaks - D19412

Change-Id: I301111f0075de93dd8129416e06babc195aa936b

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268734 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
00f4a49b0b76dea78a68ea2dd7333408f52caa5b 19-Aug-2015 Eric Fiselier <eric@efcs.ca> [libcxx] Allow use of <atomic> in C++03. Try 3.

Summary:
After putting this question up on cfe-dev I have decided that it would be best to allow the use of `<atomic>` in C++03. Although static initialization is a concern the syntax required to get it is C++11 only. Meaning that C++11 constant static initialization cannot silently break in C++03, it will always cause a syntax error. Furthermore `ATOMIC_VAR_INIT` and `ATOMIC_FLAG_INIT` remain defined in C++03 even though they cannot be used because C++03 usages will cause better error messages.

The main change in this patch is to replace `__has_feature(cxx_atomic)`, which only returns true when C++ >= 11, to `__has_extension(c_atomic)` which returns true whenever clang supports the required atomic builtins.


This patch adds the following macros:
* `_LIBCPP_HAS_C_ATOMIC_IMP` - Defined on clang versions which provide the C `_Atomic` keyword.
* `_LIBCPP_HAS_GCC_ATOMIC_IMP` - Defined on GCC > 4.7. We must use the fallback atomic implementation.
* `_LIBCPP_HAS_NO_ATOMIC_HEADER` - Defined when it is not safe to include `<atomic>`.

`_LIBCPP_HAS_C_ATOMIC_IMP` and `_LIBCPP_HAS_GCC_ATOMIC_IMP` are mutually exclusive, only one should be defined. If neither is defined then `<atomic>` is not implemented and including `<atomic>` will issue an error.

Reviewers: chandlerc, jroelofs, mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D11555

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
3b1fb53a657cd42a132094ef2d90bab949b1814b 18-Aug-2015 Eric Fiselier <eric@efcs.ca> Move atomic_support.h and config_elast.h into src/include

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
c6e466911f803e85548887c3acb50d6fa5c4b071 07-Jul-2015 Eric Fiselier <eric@efcs.ca> [libcxx] Add atomic_support.h header to src that handles needed atomic operations.

Summary:
In some places in libc++ we need to use the `__atomic_*` builtins. This patch adds a header that provides access to those builtins in a uniform way from within the dylib source.

If the compiler building the dylib does not support these builtins then a warning is issued.

Only relaxed loads are needed within the headers. A singe function to do these relaxed loads has been added to `<memory>`.

This patch applies the new atomic builtins to `__shared_count` and `call_once`.

Reviewers: mclow.lists

Subscribers: majnemer, jroelofs, cfe-commits

Differential Revision: http://reviews.llvm.org/D10406

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@241532 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
01f6a1410c6d468a461339a015e2f9419287fed1 12-Dec-2014 Eric Fiselier <eric@efcs.ca> Fix building and running tests when LIBCXX_ENABLE_EXCEPTIONS or LIBCXX_ENABLE_RTTI are turned off.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224095 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
baed05dd373652596db041a469ed655c5ee49e50 05-Sep-2014 Jonathan Roelofs <jonathan@codesourcery.com> Address some post-commit review comments on r217261

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217276 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
8d86b2e6867297fb2109824c67c50de67f3a31f2 05-Sep-2014 Jonathan Roelofs <jonathan@codesourcery.com> Allow libc++ to be built on systems without POSIX threads

If you're crazy enough to want this sort of thing, then add
-D_LIBCPP_HAS_NO_THREADS to your CXXFLAGS and
--param=additiona_features=libcpp-has-no-threads to your lit commnad line.

http://reviews.llvm.org/D3969


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
4c6acb5ecd7fab26583353261fd52a9f7ba2f1e0 04-Jan-2014 Joerg Sonnenberger <joerg@bec.de> Switch to using C++ style casts.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198505 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
e33c2d1926f49221c9d72a353d797d135a810d77 16-Mar-2013 Howard Hinnant <hhinnant@apple.com> This should be nothing but a load-time optimization. I'm trying to reduce load time initializers and this is a big one. No visible functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177212 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
9c0df1416f2cec1cc6cce797d18ddc5e50b64797 30-Oct-2012 Howard Hinnant <hhinnant@apple.com> Rename uses of _ and __ because these are getting stepped on by macros from other system code.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
96c60b482ef2614185e3fa0c606f87c3efcf1e85 19-Aug-2012 Howard Hinnant <hhinnant@apple.com> Patch contributed by Dev Dude for mingw64 port.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
65f059b842cc5b7990933781e119a5f14abc3504 30-Jul-2012 Howard Hinnant <hhinnant@apple.com> Despite my pathological distrust of spin locks, the number just don't lie. I've put a small spin in __sp_mut::lock() on std::mutex::try_lock(), which is testing quite well. In my experience, putting in a yield for every failed iteration is also a major performance booster. This change makes one of the performance tests I was using (a highly contended one) run about 20 times faster.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
5fec82dc0db3623546038e4a86baa44f749e554f 30-Jul-2012 Howard Hinnant <hhinnant@apple.com> Implement [util.smartptr.shared.atomic]. This is the last unimplemented
section in libc++. This requires a recompiled dylib. Failure to rebuild
the dylib will result in a link-time error if and only if the functions from
[util.smartptr.shared.atomic] are used.

The implementation is not lock free. After considerable thought, I know of no
way to make the implementation lock free. Ideas welcome along that front. But
changing the ABI of shared_ptr is not on the table at this point.

The mutex used to lock these function is encapsulated by std::__sp_mut. The
only thing the client knows about std::__sp_mut is that it has a void* data
member, can't be constructed, and has lock and unlock members. Within the
binary __sp_mut is currently implemented as a pointer to a std::mutex. That can
change in the future without disturbing the ABI (as long as sizeof(__sp_mut)
remains constant.

I specifically did not make __sp_mut a spin lock as I have a pathological
distrust of spin locks. Testing on OS X reveals that the use of std::mutex in
this role is not a large performance penalty as long as the contention for the
mutex is low (more likely to get the lock than to have to wait). In the future
we can still make __sp_mut a spin lock if that is what is desired (without ABI
damage).

The dylib contains 16 __sp_mut's to be chosen based on the hash of the address
of the shared_ptr. The constant 16 is a ball-park reasonable space/time
tradeoff.

std::hash<T*> was changed to call __murmur2_or_cityhash, instead of the identity
function. I had thought we had already done this, but I was mistaken.

All of this is under #if __has_feature(cxx_atomic) even though the
implementation is not lock free, because the signatures require access to
std::memory_order, which is currently available only under
__has_feature(cxx_atomic).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
46e9493c687004357f757d08335c3ec411a361fd 07-Jul-2012 Howard Hinnant <hhinnant@apple.com> Appy constexpr to <memory>. Picked up a few missing noexcepts as well.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159902 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
5586c020c9b9819062306522b76b09561d91d50e 27-Dec-2011 Howard Hinnant <hhinnant@apple.com> Fix memory leak in converting weak_ptr to shared_ptr

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@147298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
ec3773c2dadbeadfc5def927116c2ee9d9c53066 01-Dec-2011 Howard Hinnant <hhinnant@apple.com> Quash a whole bunch of warnings

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145624 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
1694d23e23d41c4037111d96324c0c16c744c09d 28-May-2011 Howard Hinnant <hhinnant@apple.com> noexcept for <memory>. I've added a few extension noexcept to: allocator_traits<A>::deallocate, allocaate<T>::deallocate, return_temporary_buffer, and default_delete<T>::operator()(T*) const. My rationale was: If a std-dicated noexcept function needs to call another std-defined function, that called function must be noexcept. We're all a little new to noexcept, so things like this are to be expected. Also included fix for broken __is_swappable trait pointed out by Marc Glisse, thanks Marc|. And fixed a test case for is_nothrow_destructible. Destructors are now noexcept by default|

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132261 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
b64f8b07c104c6cc986570ac8ee0ed16a9f23976 16-Nov-2010 Howard Hinnant <hhinnant@apple.com> license change

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
28dbbe0596878c12e13507aad6b40d33e5a8fa20 16-Nov-2010 Howard Hinnant <hhinnant@apple.com> Dave Zarzycki showed how the efficiency of shared_ptr could be significantly
increased. The following program is running 49% faster:

#include <iostream>
#include <memory>
#include <chrono>
#include <vector>
#include "chrono_io"

int main()
{
typedef std::chrono::high_resolution_clock Clock;
Clock::time_point t0 = Clock::now();
{
std::shared_ptr<int> p(new int (1));
std::vector<std::shared_ptr<int> > v(1000000, p);
v.insert(v.begin(), p);
v.insert(v.begin(), p);
v.insert(v.begin(), p);
v.insert(v.begin(), p);
}
Clock::time_point t1 = Clock::now();
std::cout << (t1-t0) << '\n';
}


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
16e6e1d72fd6a10fc165eba4ca4ed2fa7c45df78 22-Aug-2010 Howard Hinnant <hhinnant@apple.com> Fixing whitespace problems

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
d444470d6cd1cad554139c4ba7f3c4f3fe921a5d 11-Aug-2010 Howard Hinnant <hhinnant@apple.com> now works with -fno-exceptions and -fno-rtti

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@110828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
adff4895b2746f30b271bc219713e7ded5ae9677 24-May-2010 Howard Hinnant <hhinnant@apple.com> patch by Jeffrey Yasskin for porting to Ubuntu Hardy. Everything was accepted except there were some bug fixes needed in <locale> for the __nolocale_* series. For the apple branch I ended up using templates instead of the var_args solution because it seemed both safer and more efficient.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@104516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
f5256e16dfc425c1d466f6308d4026d529ce9e0b 11-May-2010 Howard Hinnant <hhinnant@apple.com> Wiped out some non-ascii characters that snuck into the copyright.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp
bc8d3f97eb5c958007f2713238472e0c1c8fe02c 11-May-2010 Howard Hinnant <hhinnant@apple.com> libcxx initial import

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/libcxx/src/memory.cpp