GNU C Library master sources branch master updated. glibc-2.24-293-gabff18c
carlos@sourceware.org
carlos@sourceware.org
Wed Oct 26 04:04:00 GMT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via abff18c0c6055ca5d1cd46923fd1205c057139a5 (commit)
from cd74aa4d5ccae1ae9d815ae7088f06d6fc4aaffc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=abff18c0c6055ca5d1cd46923fd1205c057139a5
commit abff18c0c6055ca5d1cd46923fd1205c057139a5
Author: Carlos O'Donell <carlos@systemhalted.org>
Date: Wed Oct 26 00:00:13 2016 -0400
Fix atomic_fetch_xor_release.
No code uses atomic_fetch_xor_release except for the upcoming
conditional variable rewrite. Therefore there is no user
visible bug here. The use of atomic_compare_and_exchange_bool_rel
is removed (since it doesn't exist anymore), and is replaced
by atomic_compare_exchange_weak_release.
We use weak_release because it provides better performance in
the loop (the weak semantic) and because the xor is release MO
(the release semantic). We don't reload expected in the loop
because atomic_compare_and_exchange_weak_release does this for
us as part of the CAS failure.
It is otherwise a fairly plain conversion that fixes building
the new condvar for 32-bit x86. Passes all regression tests
for x86.
diff --git a/ChangeLog b/ChangeLog
index 6b8763f..9c4d06f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-26 Carlos O'Donell <carlos@redhat.com>
+
+ * include/atomic.h
+ [USE_COMPILER_ATOMIC_BUILTINS && !atomic_fetch_xor_release]
+ (atomic_fetch_xor_release): Use atomic_compare_exchange_weak_release.
+
2016-10-25 Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com>
* stdlib/Makefile (tests): Add tst-strfrom and tst-strfrom-locale.
diff --git a/include/atomic.h b/include/atomic.h
index 5a8e7e7..c8b4664 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -777,18 +777,21 @@ void __atomic_link_error (void);
# endif
# ifndef atomic_fetch_xor_release
+/* Failing the atomic_compare_exchange_weak_release reloads the value in
+ __atg104_expected, so we need only do the XOR again and retry. */
# define atomic_fetch_xor_release(mem, operand) \
- ({ __typeof (*(mem)) __atg104_old; \
- __typeof (mem) __atg104_memp = (mem); \
+ ({ __typeof (mem) __atg104_memp = (mem); \
+ __typeof (*(mem)) __atg104_expected = (*__atg104_memp); \
+ __typeof (*(mem)) __atg104_desired; \
__typeof (*(mem)) __atg104_op = (operand); \
\
do \
- __atg104_old = (*__atg104_memp); \
- while (__builtin_expect \
- (atomic_compare_and_exchange_bool_rel ( \
- __atg104_memp, __atg104_old ^ __atg104_op, __atg104_old), 0));\
- \
- __atg104_old; })
+ __atg104_desired = __atg104_expected ^ __atg104_op; \
+ while (__glibc_unlikely \
+ (atomic_compare_exchange_weak_release ( \
+ __atg104_memp, &__atg104_expected, __atg104_desired) \
+ == 0)); \
+ __atg104_expected; })
#endif
#endif /* !USE_ATOMIC_COMPILER_BUILTINS */
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 ++++++
include/atomic.h | 19 +++++++++++--------
2 files changed, 17 insertions(+), 8 deletions(-)
hooks/post-receive
--
GNU C Library master sources
More information about the Glibc-cvs
mailing list