components/python/cffi/patches/barrier.patch
branchs11u3-sru
changeset 7085 cad8ee01213d
equal deleted inserted replaced
7076:332c44bd55bf 7085:cad8ee01213d
       
     1 In-house (for now) patch to allow cffi 1.5.2 to compile with both
       
     2 Studio and on SPARC.
       
     3 
       
     4 --- cffi-1.5.2/c/call_python.c.~1~	2016-02-13 07:33:29.000000000 -0800
       
     5 +++ cffi-1.5.2/c/call_python.c	2016-05-18 10:10:49.505449785 -0700
       
     6 @@ -150,7 +150,8 @@ static int _update_cache_to_call_python(
       
     7  #if (defined(WITH_THREAD) && !defined(_MSC_VER) &&   \
       
     8       !defined(__amd64__) && !defined(__x86_64__) &&   \
       
     9       !defined(__i386__) && !defined(__i386))
       
    10 -# define read_barrier()  __sync_synchronize()
       
    11 +# include <mbarrier.h>
       
    12 +# define read_barrier()  __compiler_barrier()
       
    13  #else
       
    14  # define read_barrier()  (void)0
       
    15  #endif
       
    16 --- cffi-1.5.2/cffi/_embedding.h.~1~	2016-02-13 07:33:29.000000000 -0800
       
    17 +++ cffi-1.5.2/cffi/_embedding.h	2016-05-18 10:15:53.285798295 -0700
       
    18 @@ -32,12 +32,14 @@ static _cffi_call_python_fnptr _cffi_cal
       
    19  
       
    20  
       
    21  #ifndef _MSC_VER
       
    22 -   /* --- Assuming a GCC not infinitely old --- */
       
    23 -# define cffi_compare_and_swap(l,o,n)  __sync_bool_compare_and_swap(l,o,n)
       
    24 -# define cffi_write_barrier()          __sync_synchronize()
       
    25 +# include <atomic.h>
       
    26 +# include <mbarrier.h>
       
    27 +# define cffi_compare_and_swap(l,o,n) \
       
    28 +                               (atomic_cas_ptr((l), (o), (n)), *(l) == (n))
       
    29 +# define cffi_write_barrier()          __compiler_barrier()
       
    30  # if !defined(__amd64__) && !defined(__x86_64__) &&   \
       
    31       !defined(__i386__) && !defined(__i386)
       
    32 -#   define cffi_read_barrier()         __sync_synchronize()
       
    33 +#   define cffi_read_barrier()         __compiler_barrier()
       
    34  # else
       
    35  #   define cffi_read_barrier()         (void)0
       
    36  # endif