* [PATCH] libstdc++: Define macro before it is first checked
@ 2021-09-02 17:58 Jonathan Wakely
2021-09-02 18:25 ` Thomas Rodgers
2021-09-02 21:25 ` Jonathan Wakely
0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Wakely @ 2021-09-02 17:58 UTC (permalink / raw)
To: libstdc++, gcc-patches; +Cc: Thomas Rodgers
[-- Attachment #1: Type: text/plain, Size: 326 bytes --]
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/atomic_wait.h (_GLIBCXX_HAVE_PLATFORM_WAIT):
Define before first attempt to check it.
Tested x86_64-linux and powerpc64-linux, not committed yet.
I think we need this, otherwise __platform_wait_uses_type<T> is false
for all T.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2729 bytes --]
commit 9b8a78b5c923efd2f9d10eaed3bfd43dd6a91fe3
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Aug 31 15:51:09 2021
libstdc++: Define macro before it is first checked
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/atomic_wait.h (_GLIBCXX_HAVE_PLATFORM_WAIT):
Define before first attempt to check it.
diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h
index 07bb744d822..64b71e408eb 100644
--- a/libstdc++-v3/include/bits/atomic_wait.h
+++ b/libstdc++-v3/include/bits/atomic_wait.h
@@ -56,9 +56,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace __detail
{
#ifdef _GLIBCXX_HAVE_LINUX_FUTEX
+#define _GLIBCXX_HAVE_PLATFORM_WAIT 1
using __platform_wait_t = int;
static constexpr size_t __platform_wait_alignment = 4;
#else
+// define _GLIBCX_HAVE_PLATFORM_WAIT and implement __platform_wait()
+// and __platform_notify() if there is a more efficient primitive supported
+// by the platform (e.g. __ulock_wait()/__ulock_wake()) which is better than
+// a mutex/condvar based wait.
using __platform_wait_t = uint64_t;
static constexpr size_t __platform_wait_alignment
= __alignof__(__platform_wait_t);
@@ -70,7 +75,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef _GLIBCXX_HAVE_PLATFORM_WAIT
= is_scalar_v<_Tp>
&& ((sizeof(_Tp) == sizeof(__detail::__platform_wait_t))
- && (alignof(_Tp*) >= __platform_wait_alignment));
+ && (alignof(_Tp*) >= __detail::__platform_wait_alignment));
#else
= false;
#endif
@@ -78,7 +83,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace __detail
{
#ifdef _GLIBCXX_HAVE_LINUX_FUTEX
-#define _GLIBCXX_HAVE_PLATFORM_WAIT 1
enum class __futex_wait_flags : int
{
#ifdef _GLIBCXX_HAVE_LINUX_FUTEX_PRIVATE
@@ -118,11 +122,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_cast<int>(__futex_wait_flags::__wake_private),
__all ? INT_MAX : 1);
}
-#else
-// define _GLIBCX_HAVE_PLATFORM_WAIT and implement __platform_wait()
-// and __platform_notify() if there is a more efficient primitive supported
-// by the platform (e.g. __ulock_wait()/__ulock_wake()) which is better than
-// a mutex/condvar based wait
#endif
inline void
@@ -192,9 +191,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __waiter_pool_base
{
#ifdef __cpp_lib_hardware_interference_size
- static constexpr auto _S_align = hardware_destructive_interference_size;
+ static constexpr auto _S_align = hardware_destructive_interference_size;
#else
- static constexpr auto _S_align = 64;
+ static constexpr auto _S_align = 64;
#endif
alignas(_S_align) __platform_wait_t _M_wait = 0;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libstdc++: Define macro before it is first checked
2021-09-02 17:58 [PATCH] libstdc++: Define macro before it is first checked Jonathan Wakely
@ 2021-09-02 18:25 ` Thomas Rodgers
2021-09-02 21:25 ` Jonathan Wakely
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Rodgers @ 2021-09-02 18:25 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: libstdc++, gcc Patches
Agreed.
On Thu, Sep 2, 2021 at 10:58 AM Jonathan Wakely <jwakely@redhat.com> wrote:
> Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/atomic_wait.h (_GLIBCXX_HAVE_PLATFORM_WAIT):
> Define before first attempt to check it.
>
> Tested x86_64-linux and powerpc64-linux, not committed yet.
>
> I think we need this, otherwise __platform_wait_uses_type<T> is false
> for all T.
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libstdc++: Define macro before it is first checked
2021-09-02 17:58 [PATCH] libstdc++: Define macro before it is first checked Jonathan Wakely
2021-09-02 18:25 ` Thomas Rodgers
@ 2021-09-02 21:25 ` Jonathan Wakely
2021-09-28 19:31 ` [committed] " Jonathan Wakely
1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2021-09-02 21:25 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: libstdc++, gcc Patches, Thomas Rodgers
On Thu, 2 Sept 2021 at 19:00, Jonathan Wakely wrote:
>
> * include/bits/atomic_wait.h (_GLIBCXX_HAVE_PLATFORM_WAIT):
> Define before first attempt to check it.
>
> Tested x86_64-linux and powerpc64-linux, not committed yet.
Actually ignore that ... I tested the wrong patch. This one introduces
a new FAIL, which I have a fix for, but it will have to wait for next
week.
> I think we need this, otherwise __platform_wait_uses_type<T> is false
> for all T.
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [committed] libstdc++: Define macro before it is first checked
2021-09-02 21:25 ` Jonathan Wakely
@ 2021-09-28 19:31 ` Jonathan Wakely
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2021-09-28 19:31 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: libstdc++, gcc Patches, Thomas Rodgers
[-- Attachment #1: Type: text/plain, Size: 620 bytes --]
On Thu, 2 Sept 2021 at 22:25, Jonathan Wakely wrote:
>
> On Thu, 2 Sept 2021 at 19:00, Jonathan Wakely wrote:
> >
> > * include/bits/atomic_wait.h (_GLIBCXX_HAVE_PLATFORM_WAIT):
> > Define before first attempt to check it.
> >
> > Tested x86_64-linux and powerpc64-linux, not committed yet.
>
> Actually ignore that ... I tested the wrong patch. This one introduces
> a new FAIL, which I have a fix for, but it will have to wait for next
> week.
>
>
> > I think we need this, otherwise __platform_wait_uses_type<T> is false
> > for all T.
This is the fixed patch.
Tested x86_64-linux, pushed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2495 bytes --]
commit aeaea265cea3a2b2e772af7825351a4ceef29aac
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Aug 31 15:51:09 2021
libstdc++: Define macro before it is first checked
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/atomic_wait.h (_GLIBCXX_HAVE_PLATFORM_WAIT):
Define before first attempt to check it.
diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h
index 07bb744d822..35c92644146 100644
--- a/libstdc++-v3/include/bits/atomic_wait.h
+++ b/libstdc++-v3/include/bits/atomic_wait.h
@@ -56,9 +56,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace __detail
{
#ifdef _GLIBCXX_HAVE_LINUX_FUTEX
+#define _GLIBCXX_HAVE_PLATFORM_WAIT 1
using __platform_wait_t = int;
static constexpr size_t __platform_wait_alignment = 4;
#else
+// define _GLIBCX_HAVE_PLATFORM_WAIT and implement __platform_wait()
+// and __platform_notify() if there is a more efficient primitive supported
+// by the platform (e.g. __ulock_wait()/__ulock_wake()) which is better than
+// a mutex/condvar based wait.
using __platform_wait_t = uint64_t;
static constexpr size_t __platform_wait_alignment
= __alignof__(__platform_wait_t);
@@ -70,7 +75,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef _GLIBCXX_HAVE_PLATFORM_WAIT
= is_scalar_v<_Tp>
&& ((sizeof(_Tp) == sizeof(__detail::__platform_wait_t))
- && (alignof(_Tp*) >= __platform_wait_alignment));
+ && (alignof(_Tp*) >= __detail::__platform_wait_alignment));
#else
= false;
#endif
@@ -78,7 +83,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace __detail
{
#ifdef _GLIBCXX_HAVE_LINUX_FUTEX
-#define _GLIBCXX_HAVE_PLATFORM_WAIT 1
enum class __futex_wait_flags : int
{
#ifdef _GLIBCXX_HAVE_LINUX_FUTEX_PRIVATE
@@ -118,11 +122,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_cast<int>(__futex_wait_flags::__wake_private),
__all ? INT_MAX : 1);
}
-#else
-// define _GLIBCX_HAVE_PLATFORM_WAIT and implement __platform_wait()
-// and __platform_notify() if there is a more efficient primitive supported
-// by the platform (e.g. __ulock_wait()/__ulock_wake()) which is better than
-// a mutex/condvar based wait
#endif
inline void
@@ -331,7 +330,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if constexpr (__platform_wait_uses_type<_Up>)
{
- __val == __old;
+ __builtin_memcpy(&__val, &__old, sizeof(__val));
}
else
{
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-28 19:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02 17:58 [PATCH] libstdc++: Define macro before it is first checked Jonathan Wakely
2021-09-02 18:25 ` Thomas Rodgers
2021-09-02 21:25 ` Jonathan Wakely
2021-09-28 19:31 ` [committed] " Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).