<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libapr.git/atomic/unix/builtins.c, branch master</title>
<subtitle>svn.apache.org: repos/asf/apr/apr
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/'/>
<entry>
<title>atomics: Follow up to r1909321: remaining NEED_ATOMICS_GENERIC64.</title>
<updated>2023-04-21T12:48:00+00:00</updated>
<author>
<name>ylavic</name>
<email>ylavic@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2023-04-21T12:48:00+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=23bc4e9b6bc10d514431f96cb1d43b3a8cd45b98'/>
<id>23bc4e9b6bc10d514431f96cb1d43b3a8cd45b98</id>
<content type='text'>
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1909323 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1909323 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
<entry>
<title>atomic: No raw 64bit load/store on 32bit systems or anything but x86_64 or s390x.</title>
<updated>2023-02-14T10:25:34+00:00</updated>
<author>
<name>ylavic</name>
<email>ylavic@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2023-02-14T10:25:34+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=24b1a6436f789ae16be4d7a2a7a68cb9325315e5'/>
<id>24b1a6436f789ae16be4d7a2a7a68cb9325315e5</id>
<content type='text'>
Raw 64 bit load and store need two intructions on 32bit systems (tearing) so
they are not atomic, and only x86(_64) and s390(x) have stong mempry ordering
guarantees. Always use builtin functions for the cases where raw load/store
don't work as expected.

* atomic/unix/builtins.c, atomic/unix/builtins64.c:
  Use an accept-list rather than a reject-list to define WEAK_MEMORY_ORDERING.
  Test APR_SIZEOF_VOIDP &lt; 8 to force usage of __sync builtins for _read{32,64}
  and _set{32,64} on 32bit systems when __atomic_{load,store} buitlins are not
  available.



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1907637 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Raw 64 bit load and store need two intructions on 32bit systems (tearing) so
they are not atomic, and only x86(_64) and s390(x) have stong mempry ordering
guarantees. Always use builtin functions for the cases where raw load/store
don't work as expected.

* atomic/unix/builtins.c, atomic/unix/builtins64.c:
  Use an accept-list rather than a reject-list to define WEAK_MEMORY_ORDERING.
  Test APR_SIZEOF_VOIDP &lt; 8 to force usage of __sync builtins for _read{32,64}
  and _set{32,64} on 32bit systems when __atomic_{load,store} buitlins are not
  available.



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1907637 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
<entry>
<title>Call apr__atomic_generic64_init() if needed</title>
<updated>2023-02-05T20:27:29+00:00</updated>
<author>
<name>sf</name>
<email>sf@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2023-02-05T20:27:29+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=96d871fa9797758a13f9d8a3398465643b59ddc3'/>
<id>96d871fa9797758a13f9d8a3398465643b59ddc3</id>
<content type='text'>
Otherwise we get a segfault.  Seen on Debian on powerpc with

/* Define if compiler provides 32bit atomic builtins */
#define HAVE_ATOMIC_BUILTINS 1
/* Define if compiler provides 64bit atomic builtins */
/* #undef HAVE_ATOMIC_BUILTINS64 */
/* Define if compiler provides 32bit __atomic builtins */
#define HAVE__ATOMIC_BUILTINS 1
/* Define if compiler provides 64bit __atomic builtins */
/* #undef HAVE__ATOMIC_BUILTINS64 */
/* Define if use of generic atomics is requested */
/* #undef USE_ATOMICS_GENERIC */



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1907442 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Otherwise we get a segfault.  Seen on Debian on powerpc with

/* Define if compiler provides 32bit atomic builtins */
#define HAVE_ATOMIC_BUILTINS 1
/* Define if compiler provides 64bit atomic builtins */
/* #undef HAVE_ATOMIC_BUILTINS64 */
/* Define if compiler provides 32bit __atomic builtins */
#define HAVE__ATOMIC_BUILTINS 1
/* Define if compiler provides 64bit __atomic builtins */
/* #undef HAVE__ATOMIC_BUILTINS64 */
/* Define if use of generic atomics is requested */
/* #undef USE_ATOMICS_GENERIC */



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1907442 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
<entry>
<title>atomic: Fix -Wincompatible-pointer-types-discards-qualifiers</title>
<updated>2022-06-24T13:19:46+00:00</updated>
<author>
<name>ylavic</name>
<email>ylavic@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2022-06-24T13:19:46+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=2b3f411c8e80d33ee2f4cf1f6c930bb5f1f7d43b'/>
<id>2b3f411c8e80d33ee2f4cf1f6c930bb5f1f7d43b</id>
<content type='text'>
atomic/unix/builtins.c:117:38: warning: passing 'void **' to parameter of type 'volatile void **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
    __atomic_compare_exchange_n(mem, (void **)&amp;cmp, ptr, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
                                     ^~~~~~~~~~~~~

This warning is weird, because 'volatile void **' is not a thing usually, it
happens on macos in apr-1.x, where apr_atomic_casptr() is (ill-)defined as:
  APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *ptr, const void *cmp);
but not on trunk's:
  APR_DECLARE(void*) apr_atomic_casptr(void *volatile *mem, void *ptr, const void *cmp);
The mark clearly indicates that (void **)&amp;cmp is the culprit though (compiler bug?).

Let's see if using the generic (void *) cast helps, the goal of the (void **)
cast was to remove constantness only (__atomic_compare_exchange_n will modify
the pointer on stack, but not the pointed to value), (void *) will do that too
without any volatile qualifier issue possibly.



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902233 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
atomic/unix/builtins.c:117:38: warning: passing 'void **' to parameter of type 'volatile void **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
    __atomic_compare_exchange_n(mem, (void **)&amp;cmp, ptr, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
                                     ^~~~~~~~~~~~~

This warning is weird, because 'volatile void **' is not a thing usually, it
happens on macos in apr-1.x, where apr_atomic_casptr() is (ill-)defined as:
  APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *ptr, const void *cmp);
but not on trunk's:
  APR_DECLARE(void*) apr_atomic_casptr(void *volatile *mem, void *ptr, const void *cmp);
The mark clearly indicates that (void **)&amp;cmp is the culprit though (compiler bug?).

Let's see if using the generic (void *) cast helps, the goal of the (void **)
cast was to remove constantness only (__atomic_compare_exchange_n will modify
the pointer on stack, but not the pointed to value), (void *) will do that too
without any volatile qualifier issue possibly.



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902233 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
<entry>
<title>apr_atomic: Fix load/store for weak memory ordering architectures.</title>
<updated>2021-10-29T15:54:35+00:00</updated>
<author>
<name>ylavic</name>
<email>ylavic@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2021-10-29T15:54:35+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=9e06d84591127a434694d49c2425e50695e29adc'/>
<id>9e06d84591127a434694d49c2425e50695e29adc</id>
<content type='text'>
Volatile access prevents compiler reordering of load/store but it's not enough
for weakly ordered archs like ARM32 and PowerPC[64].

While __atomic builtins provide load and store, __sync builtins don't so let's
use an atomic add of zero for the former and atomic exchange for the latter.

The assembly code for PowerPC was not correct either, fix apr_atomic_read32()
and apr_atomic_set32() and add the necessary memory barriers for the others.
PR 50586.



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894622 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Volatile access prevents compiler reordering of load/store but it's not enough
for weakly ordered archs like ARM32 and PowerPC[64].

While __atomic builtins provide load and store, __sync builtins don't so let's
use an atomic add of zero for the former and atomic exchange for the latter.

The assembly code for PowerPC was not correct either, fix apr_atomic_read32()
and apr_atomic_set32() and add the necessary memory barriers for the others.
PR 50586.



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894622 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
<entry>
<title>apr_atomic: Use __atomic builtins when available.</title>
<updated>2021-10-29T15:09:13+00:00</updated>
<author>
<name>ylavic</name>
<email>ylavic@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2021-10-29T15:09:13+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=647815118a19e2539589c71109adee93d309d2ba'/>
<id>647815118a19e2539589c71109adee93d309d2ba</id>
<content type='text'>
Unlike Intel's atomic builtins (__sync_*), the more recent __atomic builtins
provide atomic load and store for weakly ordered architectures like ARM32 or
powerpc[64], so use them when available (gcc 4.6.3+).



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894621 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Unlike Intel's atomic builtins (__sync_*), the more recent __atomic builtins
provide atomic load and store for weakly ordered architectures like ARM32 or
powerpc[64], so use them when available (gcc 4.6.3+).



git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894621 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert r1894618.</title>
<updated>2021-10-29T15:07:11+00:00</updated>
<author>
<name>ylavic</name>
<email>ylavic@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2021-10-29T15:07:11+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=fffb696f44603367ff596be88e012e7c7fb4c65c'/>
<id>fffb696f44603367ff596be88e012e7c7fb4c65c</id>
<content type='text'>
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894619 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894619 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
<entry>
<title>apr_atomic: Use __atomic builtins when available.</title>
<updated>2021-10-29T15:04:55+00:00</updated>
<author>
<name>ylavic</name>
<email>ylavic@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2021-10-29T15:04:55+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=ca229155fffd5b16e86a3e54394a86a6045462b0'/>
<id>ca229155fffd5b16e86a3e54394a86a6045462b0</id>
<content type='text'>
Unlike Intel's atomic builtins (__sync_*), the more recent __atomic builtins
provide atomic load and store for weakly ordered architectures like ARM32 or
powerpc[64], so use them when available (gcc 4.6.3+).

[Reverted by r1894619]


git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894618 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Unlike Intel's atomic builtins (__sync_*), the more recent __atomic builtins
provide atomic load and store for weakly ordered architectures like ARM32 or
powerpc[64], so use them when available (gcc 4.6.3+).

[Reverted by r1894619]


git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894618 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
<entry>
<title>atomic: fix API of atomic_{cas,xchg}ptr() for APR-2.</title>
<updated>2016-10-06T21:20:04+00:00</updated>
<author>
<name>ylavic</name>
<email>ylavic@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2016-10-06T21:20:04+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=ba308f2360eac28450022294c8b2db66b7cc49e8'/>
<id>ba308f2360eac28450022294c8b2db66b7cc49e8</id>
<content type='text'>
The pointer ought to be declared volatile, not void.



git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1763666 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The pointer ought to be declared volatile, not void.



git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1763666 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce apr_atomic_xchgptr, which atomically exchanges a pair of pointer</title>
<updated>2007-07-10T16:35:45+00:00</updated>
<author>
<name>davi</name>
<email>davi@13f79535-47bb-0310-9956-ffa450edef68</email>
</author>
<published>2007-07-10T16:35:45+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/libapr.git/commit/?id=7a5041b7a7cc8dd973f356e53d979cc8cd7c64ed'/>
<id>7a5041b7a7cc8dd973f356e53d979cc8cd7c64ed</id>
<content type='text'>
values. Missing OS/390 implementation.


git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@554995 13f79535-47bb-0310-9956-ffa450edef68
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
values. Missing OS/390 implementation.


git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@554995 13f79535-47bb-0310-9956-ffa450edef68
</pre>
</div>
</content>
</entry>
</feed>
