barrier.patch revision 6408
6408N/AIn-house (for now) patch to allow cffi 1.5.2 to compile with both
6408N/AStudio and on SPARC.
6408N/A
6408N/A--- cffi-1.5.2/c/call_python.c.~1~ 2016-02-13 07:33:29.000000000 -0800
6408N/A+++ cffi-1.5.2/c/call_python.c 2016-05-18 10:10:49.505449785 -0700
6408N/A@@ -150,7 +150,8 @@ static int _update_cache_to_call_python(
6408N/A #if (defined(WITH_THREAD) && !defined(_MSC_VER) && \
6408N/A !defined(__amd64__) && !defined(__x86_64__) && \
6408N/A !defined(__i386__) && !defined(__i386))
6408N/A-# define read_barrier() __sync_synchronize()
6408N/A+# include <mbarrier.h>
6408N/A+# define read_barrier() __compiler_barrier()
6408N/A #else
6408N/A # define read_barrier() (void)0
6408N/A #endif
6408N/A--- cffi-1.5.2/cffi/_embedding.h.~1~ 2016-02-13 07:33:29.000000000 -0800
6408N/A+++ cffi-1.5.2/cffi/_embedding.h 2016-05-18 10:15:53.285798295 -0700
6408N/A@@ -32,12 +32,14 @@ static _cffi_call_python_fnptr _cffi_cal
6408N/A
6408N/A
6408N/A #ifndef _MSC_VER
6408N/A- /* --- Assuming a GCC not infinitely old --- */
6408N/A-# define cffi_compare_and_swap(l,o,n) __sync_bool_compare_and_swap(l,o,n)
6408N/A-# define cffi_write_barrier() __sync_synchronize()
6408N/A+# include <atomic.h>
6408N/A+# include <mbarrier.h>
6408N/A+# define cffi_compare_and_swap(l,o,n) \
6408N/A+ (atomic_cas_ptr((l), (o), (n)), *(l) == (n))
6408N/A+# define cffi_write_barrier() __compiler_barrier()
6408N/A # if !defined(__amd64__) && !defined(__x86_64__) && \
6408N/A !defined(__i386__) && !defined(__i386)
6408N/A-# define cffi_read_barrier() __sync_synchronize()
6408N/A+# define cffi_read_barrier() __compiler_barrier()
6408N/A # else
6408N/A # define cffi_read_barrier() (void)0
6408N/A # endif