| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't play games with sizeof(void*) to determine whether a raw load
intruction is atomic or not. Systems that fall back to the generic
implementation are not eligible for the compiler builtins or CPU
native atomic intructions already, and we don't want to reimplement
that here (e.g. alignment, ordering guarantees, ...).
* atomic/unix/mutex64.c(apr_atomic_read64):
No #ifdefery, always take the lock.
Follow up to r1907541.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1907678 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
s390x.
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 < 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(tearing).
A 64bit load on a 32 bit CPU/system uses two instructions (tearing), so ensure
atomicity with regard to other atomic functions by using the (same) lock.
test_atomics_threaded64() fails because of this on 32bit systems. PR 66457.
* atomic/unix/mutex64.c(apr_atomic_read64):
Use locking when APR_SIZEOF_VOIDP < 8
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1907541 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Otherwise we get link errors. Seen on Debian on armel and this
configure result:
/* Define if compiler provides 32bit atomic builtins */
#define HAVE_ATOMIC_BUILTINS 1
/* Define if compiler provides 64bit atomic builtins */
#define HAVE_ATOMIC_BUILTINS64 1
/* 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@1907441 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some 32bit platforms provide 32bit but not 64bit atomics, detect and
distinctly set/use HAVE_ATOMIC_BUILTINS/HAVE_ATOMIC_BUILTINS64 and
USE_ATOMICS_BUILTINS/USE_ATOMICS_BUILTINS64.
These platforms NEED_ATOMICS_GENERIC64 as 64bit implementation.
* configure.in():
Use stdint.h's uint{32,64}_t as atomic type for testing atomic builtins
when available, otherwise "unsigned int" for 32bit testing and
"unsigned long long" as 64bit.
* configure.in():
AC_TRY_RUN each 32bit and 64bit type separately, the former determining
HAVE_ATOMIC_BUILTINS and the latter HAVE_ATOMIC_BUILTINS64.
* include/arch/unix/apr_arch_atomic.h():
Define USE_ATOMICS_BUILTINS64 when HAVE_ATOMIC_BUILTINS64, otherise
define NEED_ATOMICS_GENERIC64
* include/arch/unix/apr_arch_atomic.h():
Check defined(__powerpc__) for USE_ATOMICS_PPC.
* atomic/unix/builtins64.c():
Implement for USE_ATOMICS_BUILTINS64 only.
BZ 63566.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902266 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
Both 32 and 64 bit InterlockedCompareExchangePointer() seem to have the same
API, so be it..
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902259 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* atomic/os390/atomic.c(apr_atomic_xchgptr):
Dereferencing without casting is fine/better.
* atomic/unix/mutex.c(apr_atomic_casptr, apr_atomic_xchgptr):
Dereferencing without casting is fine/better.
* atomic/win32/apr_atomic.c(apr_atomic_add32, apr_atomic_sub32,
apr_atomic_inc32, apr_atomic_dev32,
apr_atomic_set32, apr_atomic_cas32,
apr_atomic_xchg32):
Native Interlocked 32bit functions expect "long volatile *",
don't cast out volatility.
* atomic/win32/apr_atomic.c(apr_atomic_casptr):
32bit InterlockedCompareExchangePointer() expects "long volatile *",
don't cast to (void **).
* atomic/win32/apr_atomic.c(apr_atomic_xchgptr):
InterlockedExchangePointer() for both 32bit and 64bit expects
"void *volatile *", no need to cast.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902257 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 **)&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 **)&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
|
|
|
|
|
|
|
|
| |
Like for apr_atomic_read64() in r1868502, use direct memory write on x86_x64.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896811 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
Even if apr__atomic_generic64_init() is currently a noop when !APR_HAS_THREADS,
it may change later without apr_atomic_init() noticing (thanks Rüdiger).
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894719 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894619 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
(apr_atomic_read64): Use direct memory read when compiled for x86_x64, since
64-bit reads are atomic in 64-bit Windows [1].
Suggested by: Yann Ylavic
[1] https://docs.microsoft.com/en-us/windows/win32/sync/interlocked-variable-access
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1868502 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* atomic/win32/apr_atomic64.c
(apr_atomic_read64): Use InterlockedCompareExchange64() instead of direct
memory read.
* test/testatomic.c
(test_atomics_threaded_setread64): New test.
(test_func_set64): Helepr for test_atomics_threaded_setread64 test.
* CHANGES: Add changelog entry.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1868129 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1856873 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
The can't be two apr_atomic_init(), atomic/mutex64.c shouldn't implement one
since generic/mutex implementation may be used by several platforms.
So introduce private apr__atomic_generic64_init() and use it where needed.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1851541 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1841078 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
maintaining the ability to build on Visual Studio 6 with
Windows Server 2003 R2 SDK.
PR: 57191
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1675751 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
PR: 51851
Submitted by: Mattias Engdegård <mattiase acm org>
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1470348 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
PR: 54840
Submitted by: Mattias Engdegård <mattiase acm org>
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1470186 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1085462 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@925965 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
Patch to atomic/unix/solaris.c submitted by: Henry Jen <henryjen ztune.net>
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@663342 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@588081 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@587593 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Submitted by: David Jones <oscaremma gmail.com>
reviewed by: trawick
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@587057 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
| |
Submitted by: David Jones <oscaremma gmail.com>
Reviewed by: trawick
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@585935 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@584523 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@584522 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
and clobbers. The xchg instruction always asserts the lock signal.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@562765 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@562764 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@555695 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@555258 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
values. Missing OS/390 implementation.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@554995 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
Tested on: RHEL AS 4 (Nahant Update 4), IBM/S390, running under VM (64 bit mode), gcc 3.4.6
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@554095 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
PR: 42806
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@553293 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
| |
PR: 42806
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@553292 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
| |
operations,
plus apr_atomic_casptr.
PR: 42806
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@553291 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
platforms (alpha, ia32, ia64, powerpc, etc).
Tested on:
2x Pentium D, Ubuntu 7.04, gcc 4.1.2
16x Itanium II, RHEL 5, gcc 4.1.1
PR: 42806
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@553290 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
the various backends. The generic implementation is used when no specialized
implementation fits the defined criterias, or when the user forces the choice.
PR: 42806
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@553289 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
|
| |
apr_atomic_init().
Noticied by: Tim Jones
PR: 42760
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@552161 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
|
|
|
| |
* atomic/unix/apr_atomic.c
(apr_atomic_dec32): Match declaration in apr_atomic.h for Solaris 10
implementation.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@438796 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@428317 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
| |
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@428313 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
|
|
|
| |
own evil casting -- but it allows 100% of the testatomic cases to pass, when previously, it aborted if you tried to call any of the atomic functions.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@422168 13f79535-47bb-0310-9956-ffa450edef68
|