diff options
author | Rickard Green <[email protected]> | 2010-06-01 13:51:34 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-06-01 13:51:34 +0000 |
commit | c68f1802ce375c3425795671c74c6b3fd9c3a8ef (patch) | |
tree | b2fbb14797c866cc1470f85dbc6382cf586150d4 /erts/include/internal/ethread.h | |
parent | b53f8a67649a371a38dc6d97b0dfe52111236a3e (diff) | |
download | otp-c68f1802ce375c3425795671c74c6b3fd9c3a8ef.tar.gz otp-c68f1802ce375c3425795671c74c6b3fd9c3a8ef.tar.bz2 otp-c68f1802ce375c3425795671c74c6b3fd9c3a8ef.zip |
OTP-8659 Add ethread support for gcc atomics
Support for using gcc's built-in functions for atomic memory access has
been added. This functionallity will be used if available and no other
native atomic implementation in ERTS is available.
Diffstat (limited to 'erts/include/internal/ethread.h')
-rw-r--r-- | erts/include/internal/ethread.h | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 564f8f057c..9921247a06 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -694,25 +694,33 @@ ETHR_INLINE_FUNC_NAME_(ethr_write_lock)(ethr_rwlock_t *lock) #endif /* For CPU-optimised atomics, spinlocks, and rwlocks. */ -#if !defined(ETHR_DISABLE_NATIVE_IMPLS) && defined(__GNUC__) -# if ETHR_SIZEOF_PTR == 4 -# if defined(__i386__) -# include "i386/ethread.h" -# elif (defined(__powerpc__) || defined(__ppc__)) && !defined(__powerpc64__) -# include "ppc32/ethread.h" -# elif defined(__sparc__) -# include "sparc32/ethread.h" -# elif defined(__tile__) -# include "tile/ethread.h" +#if !defined(ETHR_DISABLE_NATIVE_IMPLS) +# if defined(__GNUC__) +# if defined(ETHR_PREFER_GCC_NATIVE_IMPLS) +# include "gcc/ethread.h" # endif -# elif ETHR_SIZEOF_PTR == 8 -# if defined(__x86_64__) -# include "x86_64/ethread.h" -# elif defined(__sparc__) && defined(__arch64__) -# include "sparc64/ethread.h" +# ifndef ETHR_HAVE_NATIVE_ATOMICS +# if ETHR_SIZEOF_PTR == 4 +# if defined(__i386__) +# include "i386/ethread.h" +# elif (defined(__powerpc__)||defined(__ppc__))&&!defined(__powerpc64__) +# include "ppc32/ethread.h" +# elif defined(__sparc__) +# include "sparc32/ethread.h" +# elif defined(__tile__) +# include "tile/ethread.h" +# endif +# elif ETHR_SIZEOF_PTR == 8 +# if defined(__x86_64__) +# include "x86_64/ethread.h" +# elif defined(__sparc__) && defined(__arch64__) +# include "sparc64/ethread.h" +# endif +# endif +# include "gcc/ethread.h" # endif # endif -#endif /* !defined(ETHR_DISABLE_NATIVE_IMPLS) && defined(__GNUC__) */ +#endif /* !defined(ETHR_DISABLE_NATIVE_IMPLS) */ #ifdef ETHR_HAVE_OPTIMIZED_ATOMIC_OPS # undef ETHR_HAVE_NATIVE_ATOMICS |