Commit Graph

124 Commits

Author SHA1 Message Date
Howard Hinnant e4b2a743b8 Patch contributed by Dev Dude for mingw64 port.
llvm-svn: 162188
2012-08-19 15:13:16 +00:00
Howard Hinnant d79842c2bf Change size of reference count field in __libcpp_nmstr from 32 bits to 64 bits for 64 bit targets. This is controls the data layout of all exceptions defined in <stdexcept>. This aligns the ABI with that of gcc-4.2.
llvm-svn: 161497
2012-08-08 16:17:31 +00:00
Howard Hinnant 0cbea7fa90 Andrew Morrow: The attached patch updates the initialization of the 'struct tm' in
__time_get_storage<char> to match the initialization behavior in
__time_get_storage<wchar>. Without the initialization, valgrind
reports errors in the subsequent calls to strftime_l.

llvm-svn: 161196
2012-08-02 18:44:17 +00:00
Howard Hinnant 4df0a6adf6 Andrew Morrow: Among the various libc++ tests that currently don't pass on Linux are
localization/locale.categories/category.collate/category.ctype/locale.ctype.byname/is_1.pass.cpp
and scan_is.pass.cpp. The tests fail when the character class being
tested is compound, like ctype_base::alnum or ctype_base::graph,
because the existing series of conditionals in do_is an do_scan_is
will abort too early. For instance, if the character class being
tested is alnum, and the character is numeric, do_is will return false
because iswalpha_l will return false, 'result' becomes false, and the
'true' result from the later call to iswdigit_l ends up being ignored
. A similar problem exists in do_scan_is.

llvm-svn: 161192
2012-08-02 18:35:07 +00:00
Howard Hinnant d3673eb4e1 Andrew Morrow: The attached patch is an attempt to implement
std:🧵:hardware_concurrency for platforms that don't offer
sysctl, but do provide a POSIX sysconf and _SC_NPROCESSORS_ONLN.

llvm-svn: 161190
2012-08-02 18:17:49 +00:00
Howard Hinnant 088e37c77a 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.
llvm-svn: 160967
2012-07-30 17:13:21 +00:00
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
Howard Hinnant dce0696a36 Patch by Andrew C. Morrow: Conditionally include cxxabi.h in new.cpp and typeinfo.cpp. Both new.cpp and typeinfo.cpp have code that is conditionally compiled
based on the LIBCXXRT and _LIBCPPABI_VERSION defines, but those files
do not currently include <cxxabi.h> in the non __APPLE__ case. The
attached patch updates those files so that for non __APPLE__ builds
<cxxabi.h> is included if available or if LIBCXXRT is set. I'm
modeling this on the recent updates to exception.cpp.

llvm-svn: 160790
2012-07-26 17:42:39 +00:00
Richard Smith 535a86c3f8 libc++: switch from using _ATTRIBUTE(noreturn) (which conflicts with a
platform-provided macro on some systems) to _LIBCPP_NORETURN.

llvm-svn: 160773
2012-07-26 02:04:22 +00:00
Howard Hinnant a4820bc4d5 noexcept applied to <future>.
llvm-svn: 160607
2012-07-21 17:46:55 +00:00
Howard Hinnant 36101a5b0a noexcept applied to <thread>.
llvm-svn: 160606
2012-07-21 16:50:47 +00:00
Howard Hinnant 45c663db4e noexcept applied to <condition_variable>.
llvm-svn: 160605
2012-07-21 16:32:53 +00:00
Howard Hinnant 02e610ef34 noexcept and constexpr applied to <mutex>.
llvm-svn: 160604
2012-07-21 16:13:09 +00:00
Howard Hinnant 5d926bf1b8 noexcept and constexpr applied to <ios>.
llvm-svn: 160593
2012-07-21 01:03:40 +00:00
Howard Hinnant 00586de436 noexcept applied to <random>.
llvm-svn: 160579
2012-07-20 21:44:27 +00:00
Richard Smith ceefe51364 Teach libc++ to check for libc++abi and use its features if they're available.
llvm-svn: 160038
2012-07-11 09:35:47 +00:00
Howard Hinnant c0937e8add Appy constexpr to <memory>. Picked up a few missing noexcepts as well.
llvm-svn: 159902
2012-07-07 20:56:04 +00:00
Howard Hinnant bf33f5b292 Protect use of alignas against older versions of clang
llvm-svn: 157764
2012-05-31 19:31:14 +00:00
Richard Smith 11ffde3d7e libc++: only #include <cxxabi.h> if it exists. This allows libc++ to build
out of the box on Linux systems. If you're building against libc++abi, you
still need to make sure it can find <cxxabi.h> so it knows not to export
symbols which libc++abi provides.

llvm-svn: 155091
2012-04-19 01:36:12 +00:00
Howard Hinnant 7e5b4c9328 Put std::piecewise_construct_t back into the dylib for ABI stability. When clients are in C++11/constexpr mode this will be safely ignored because piecewise_construct is then declared with internal linkage.
llvm-svn: 153981
2012-04-03 23:45:46 +00:00
Howard Hinnant b2e9f19caf constexpr support for <utility>. Patch contributed by Jonathan Sauer.
llvm-svn: 153968
2012-04-03 21:09:48 +00:00
Howard Hinnant b4c7522790 Alter the terminal streams such that they do not get added to the atexit chain, and thus never get destructed.
llvm-svn: 152926
2012-03-16 15:13:51 +00:00
David Chisnall 1e02029f37 Undo some overzealous #ifdefs for LIBCXXRT.
llvm-svn: 152718
2012-03-14 14:11:13 +00:00
Jeffrey Yasskin 9c95b19f9e Fix moneypunct_byname algorithm to more accurately represent C locales in C++.
llvm-svn: 152501
2012-03-10 18:31:43 +00:00
Howard Hinnant 8d5df9b9d4 Change some smart_ptr == 0 to smart_ptr == nullptr. Fixes http://llvm.org/bugs/show_bug.cgi?id=12185.
llvm-svn: 152240
2012-03-07 20:37:43 +00:00
Howard Hinnant 9e849ad302 Add a warning to ctype<char>::classic_table() if not implemented.
llvm-svn: 151728
2012-02-29 16:08:57 +00:00
Howard Hinnant 27e618efb6 I'm reverting one of the changes made to exception.cpp in r151717. I'm unsure what the change was trying to do, but it didn't do the right thing for __APPLE__. So instead of trying to guess what was intended, I'm just putting it back the way it was.
llvm-svn: 151727
2012-02-29 15:37:30 +00:00
David Chisnall 06af2bbb04 Add support files required for building on Solaris.
llvm-svn: 151721
2012-02-29 13:17:28 +00:00
David Chisnall 14c25b80e9 Solaris port. Currently sees around 200 test failures, mostly related to
Solaris not providing some of the locales that the test suite uses.

Note: This depends on an xlocale (partial) implementation for Solaris and a
couple of fixed standard headers.  These will be committed to a branch later
today.

llvm-svn: 151720
2012-02-29 13:05:08 +00:00
David Chisnall e1da544e0b Some libcxxrt-compatibility cleanups (avoid defining things twice).
llvm-svn: 151717
2012-02-29 12:59:17 +00:00
Howard Hinnant 908d2bebaf At least temporarily move operator new/delete from the abi back to here. I'm having trouble reexporting it as a weak symbol.
llvm-svn: 151459
2012-02-25 21:36:01 +00:00
Howard Hinnant f87873b3b3 Silence -Wmissing-field-initializers a little higher in the source.
llvm-svn: 150964
2012-02-20 16:51:43 +00:00
Howard Hinnant 7c24d8e70b Initialize all the fields of struct tm before passing it to strftime. One of the uninitialized fields, probably the pointer field tm_zone, was causing a segfault on linux. Patch contributed by Jeffrey Yasskin.
llvm-svn: 150929
2012-02-19 14:55:32 +00:00
Howard Hinnant f95d9f0a3a Move typeinfos for exceptions in <stdexcept> to the abi
llvm-svn: 150835
2012-02-17 19:24:42 +00:00
Howard Hinnant 27c8f620ee Fix up narrowing conversions in switch statement.
llvm-svn: 150082
2012-02-08 19:15:06 +00:00
Howard Hinnant 23e4e4587f Make attributes on definition consistent with those on declaration.
llvm-svn: 149701
2012-02-03 18:31:43 +00:00
Howard Hinnant 2c9c6a579a Prepare for running on top of new libc++abi.
llvm-svn: 149634
2012-02-02 20:48:35 +00:00
Howard Hinnant be745c8cce Explicitly convert int to future_errc. Fixes http://llvm.org/bugs/show_bug.cgi?id=11428
llvm-svn: 149630
2012-02-02 20:31:36 +00:00
Howard Hinnant 45146a12cf Fix memory leak in converting weak_ptr to shared_ptr
llvm-svn: 147298
2011-12-27 22:20:51 +00:00
Howard Hinnant c206366fd7 Quash a whole bunch of warnings
llvm-svn: 145624
2011-12-01 20:21:04 +00:00
Howard Hinnant e4383379ae More windows port work by Ruben Van Boxem
llvm-svn: 142732
2011-10-22 20:59:45 +00:00
Howard Hinnant a892966218 de-tabbify
llvm-svn: 142237
2011-10-17 20:08:59 +00:00
Howard Hinnant 8909cdfff9 Windows port work by Ruben Van Boxem
llvm-svn: 140805
2011-09-29 20:33:10 +00:00
Howard Hinnant 0c06e58fae Windows patch work by Ruben Van Boxem
llvm-svn: 140781
2011-09-29 13:33:15 +00:00
Howard Hinnant 9978e3709f Attempted locale refactoring. _LIBCPP_LOCALE__L_EXTENSIONS now should be defined if one has all of the xxx_l() functions. I've defined this for apple, freebsd and win32. _LIBCPP_HAS_DEFAULTRUNELOCALE should be defined if there is a _DefaultRuneLocale. I've defined this for apple and freebsd. The block of code we're trying to migrate away from is now under #ifdef __linux__. I've tested only on OS X. I hope I haven't broken things too badly elsewhere. Please let me know.
llvm-svn: 140734
2011-09-28 23:39:33 +00:00
Howard Hinnant 3438889dec Work on Windows port by Ruben Van Boxem
llvm-svn: 140728
2011-09-28 21:39:20 +00:00
Howard Hinnant 920b56ca88 Another installment on debug mode. This addresses list. However this should be considered a temporary state. The API of the debug database and how vector and list use it, is unsatisfactory at the moment. It is both inefficient and overly verbose. I wanted to get this functionality checked in though. In the next day or so I'll refactor what is there in an attempt to streamline things.
llvm-svn: 140660
2011-09-27 23:55:03 +00:00
Howard Hinnant dbe8111948 Work on Windows port by Ruben Van Boxem
llvm-svn: 140384
2011-09-23 16:11:27 +00:00
Howard Hinnant 3c78ca07bc Partial Windows port by Ruben Van Boxem
llvm-svn: 140328
2011-09-22 19:10:18 +00:00
Howard Hinnant bae9fc983e Correct change to exception.cpp from r140245
llvm-svn: 140253
2011-09-21 15:12:26 +00:00