-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc++] Allows any types of size 4 and 8 to use native platform ulock_wait (Proof of Concept) #161086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[libc++] Allows any types of size 4 and 8 to use native platform ulock_wait (Proof of Concept) #161086
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should introduce this behind an ABI macro. I think the easiest way to do that is probably to constrain the set of types that you perform this optimization for to be just Also, we're introducing new symbols to the dylib. That means we need to handle back deployment. You'll need to add an entry to |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,10 @@ | |
|
||
#include <__atomic/support.h> | ||
#include <__config> | ||
#include <__type_traits/enable_if.h> | ||
#include <__type_traits/integral_constant.h> | ||
#include <__type_traits/is_standard_layout.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use of |
||
#include <cstddef> | ||
#include <cstdint> | ||
|
||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
|
@@ -19,10 +23,23 @@ | |
|
||
_LIBCPP_BEGIN_NAMESPACE_STD | ||
|
||
template <class _Tp, class = void> | ||
struct __is_atomic_wait_native_type : false_type {}; | ||
|
||
#if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__)) | ||
using __cxx_contention_t _LIBCPP_NODEBUG = int32_t; | ||
|
||
template <class _Tp> | ||
struct __is_atomic_wait_native_type<_Tp, __enable_if_t<is_standard_layout<_Tp>::value && sizeof(_Tp) == 4> > : true_type {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe what you mean here is just trivially copyable? What properties of the type do you use? Or do we need |
||
|
||
#else | ||
using __cxx_contention_t _LIBCPP_NODEBUG = int64_t; | ||
|
||
template <class _Tp> | ||
struct __is_atomic_wait_native_type<_Tp, | ||
__enable_if_t<is_standard_layout<_Tp>::value && (sizeof(_Tp) == 4 || sizeof(_Tp) == 8)> > | ||
: true_type {}; | ||
|
||
#endif // __linux__ || (_AIX && !__64BIT__) | ||
|
||
using __cxx_atomic_contention_t _LIBCPP_NODEBUG = __cxx_atomic_impl<__cxx_contention_t>; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why we don't simply use
::value_type
on all of these types?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
atomic_flag
does not havevalue_type