hanchenye-llvm-project/libcxx/test
Howard Hinnant d77851e837 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).

llvm-svn: 160940
2012-07-30 01:40:57 +00:00
..
algorithms
atomics libc++: Add some missing #includes to atomics tests. libc++ doesn't need these 2012-04-19 00:50:47 +00:00
containers constexpr applied to <array>. 2012-07-20 19:20:49 +00:00
depr Fix a few testsuite bugs involving trailing null (or lack thereof) in strstream. 2012-06-01 20:02:59 +00:00
diagnostics
input.output noexcept and constexpr applied to <ios>. 2012-07-21 01:03:40 +00:00
iterators noexcept applied to <iterator>. 2012-07-20 19:36:34 +00:00
language.support Add noexcept test for offsetof macro per [support.types]/p4. 2012-07-06 18:39:01 +00:00
localization <algorithm> no longer needs to include <cstdlib>, but can get away with just <cstddef>. This was brought to my attention by Salvatore Benedetto in his port to a bare-metal coretex-m3. This exposed two test bugs where an explicit #include <cstdlib> was needed. 2012-07-26 17:09:09 +00:00
numerics constexpr applied to <complex>. 2012-07-20 22:18:27 +00:00
re
strings
thread noexcept and constexpr applied to <mutex>. 2012-07-21 16:13:09 +00:00
utilities Implement [util.smartptr.shared.atomic]. This is the last unimplemented 2012-07-30 01:40:57 +00:00
CMakeLists.txt Allow libc++ to be built with CMake from within the LLVM tree. The libc++ part is just some renaming as the variable was already in use, conflicting with something else in the LLVM tree. Contributed by Ruben Van Boxem. 2012-03-19 15:40:23 +00:00
hexfloat.h
lit.cfg
lit.site.cfg.in
nothing_to_do.pass.cpp
platform_support.h
testit libc++: Add some missing #includes to atomics tests. libc++ doesn't need these 2012-04-19 00:50:47 +00:00