[atomic] Remove Solaris intrinsics
This commit is contained in:
parent
7099a6dca1
commit
c2fc2aa44c
|
@ -406,23 +406,6 @@ if (HB_HAVE_GOBJECT)
|
|||
)
|
||||
endif ()
|
||||
|
||||
## Atomic ops availability detection
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/try_compile_solaris_atomic_ops.c"
|
||||
" #include <atomic.h>
|
||||
/* This requires Solaris Studio 12.2 or newer: */
|
||||
#include <mbarrier.h>
|
||||
void memory_barrier (void) { __machine_rw_barrier (); }
|
||||
int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
|
||||
void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
|
||||
int main () { return 0; }
|
||||
")
|
||||
try_compile(HB_HAVE_SOLARIS_ATOMIC_OPS
|
||||
${PROJECT_BINARY_DIR}/try_compile_solaris_atomic_ops
|
||||
${PROJECT_BINARY_DIR}/try_compile_solaris_atomic_ops.c)
|
||||
if (HB_HAVE_SOLARIS_ATOMIC_OPS)
|
||||
add_definitions(-DHAVE_SOLARIS_ATOMIC_OPS)
|
||||
endif ()
|
||||
|
||||
|
||||
## Define harfbuzz library
|
||||
add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_headers})
|
||||
|
|
18
configure.ac
18
configure.ac
|
@ -417,24 +417,6 @@ AM_CONDITIONAL(HAVE_CORETEXT, $have_coretext)
|
|||
|
||||
dnl ===========================================================================
|
||||
|
||||
AC_CACHE_CHECK([for Solaris atomic operations], hb_cv_have_solaris_atomic_ops, [
|
||||
hb_cv_have_solaris_atomic_ops=false
|
||||
AC_TRY_LINK([
|
||||
#include <atomic.h>
|
||||
/* This requires Solaris Studio 12.2 or newer: */
|
||||
#include <mbarrier.h>
|
||||
void memory_barrier (void) { __machine_rw_barrier (); }
|
||||
int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
|
||||
void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
|
||||
], [], hb_cv_have_solaris_atomic_ops=true
|
||||
)
|
||||
])
|
||||
if $hb_cv_have_solaris_atomic_ops; then
|
||||
AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
|
||||
fi
|
||||
|
||||
dnl ===========================================================================
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
src/Makefile
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#include <atomic.h>
|
||||
/* This requires Solaris Studio 12.2 or newer: */
|
||||
#include <mbarrier.h>
|
||||
void memory_barrier (void) { __machine_rw_barrier (); }
|
||||
int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
|
||||
void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
|
||||
|
||||
int main(void) { return 0; }
|
|
@ -334,10 +334,6 @@ foreach check : check_funcs
|
|||
endif
|
||||
endforeach
|
||||
|
||||
if cpp.links(files('meson-cc-tests/solaris-atomic-operations.c'), name: 'Solaris atomic ops')
|
||||
conf.set('HAVE_SOLARIS_ATOMIC_OPS', 1)
|
||||
endif
|
||||
|
||||
subdir('src')
|
||||
subdir('util')
|
||||
|
||||
|
|
|
@ -123,35 +123,6 @@ static_assert ((sizeof (LONG) == sizeof (int)), "");
|
|||
#define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((P), (N), (O)) == (O))
|
||||
|
||||
|
||||
#elif !defined(HB_NO_MT) && defined(HAVE_SOLARIS_ATOMIC_OPS)
|
||||
|
||||
#include <atomic.h>
|
||||
#include <mbarrier.h>
|
||||
|
||||
#define _hb_memory_r_barrier() __machine_r_barrier ()
|
||||
#define _hb_memory_w_barrier() __machine_w_barrier ()
|
||||
#define _hb_memory_barrier() __machine_rw_barrier ()
|
||||
|
||||
static inline int _hb_fetch_and_add (int *AI, int V)
|
||||
{
|
||||
_hb_memory_w_barrier ();
|
||||
int result = atomic_add_int_nv ((uint_t *) AI, V) - V;
|
||||
_hb_memory_r_barrier ();
|
||||
return result;
|
||||
}
|
||||
static inline bool _hb_compare_and_swap_ptr (void **P, void *O, void *N)
|
||||
{
|
||||
_hb_memory_w_barrier ();
|
||||
bool result = atomic_cas_ptr (P, O, N) == O;
|
||||
_hb_memory_r_barrier ();
|
||||
return result;
|
||||
}
|
||||
|
||||
#define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add ((AI), (V))
|
||||
|
||||
#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swap_ptr ((P), (O), (N))
|
||||
|
||||
|
||||
#elif !defined(HB_NO_MT) && defined(__APPLE__)
|
||||
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
|
Loading…
Reference in New Issue