From db2e1298fb26636d8b08d710b4df10ba080ca60e Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 15 Mar 2017 08:43:04 -0600 Subject: [PATCH] OSx: remove built-in atomics support It was decided to remove support for os-x builtin atomics Fixes #2668 Signed-off-by: Howard Pritchard --- config/opal_config_asm.m4 | 8 -- opal/include/opal/sys/Makefile.am | 1 - opal/include/opal/sys/architecture.h | 1 - opal/include/opal/sys/atomic.h | 2 - opal/include/opal/sys/osx/Makefile.am | 24 ---- opal/include/opal/sys/osx/atomic.h | 169 -------------------------- 6 files changed, 205 deletions(-) delete mode 100644 opal/include/opal/sys/osx/Makefile.am delete mode 100644 opal/include/opal/sys/osx/atomic.h diff --git a/config/opal_config_asm.m4 b/config/opal_config_asm.m4 index a406c816cc..4182664af6 100644 --- a/config/opal_config_asm.m4 +++ b/config/opal_config_asm.m4 @@ -970,10 +970,6 @@ AC_DEFUN([OPAL_CONFIG_ASM],[ [AC_HELP_STRING([--enable-builtin-atomics], [Enable use of __sync builtin atomics (default: enabled)])], [], [enable_builtin_atomics="yes"]) - AC_ARG_ENABLE([osx-builtin-atomics], - [AC_HELP_STRING([--enable-osx-builtin-atomics], - [Enable use of OSX builtin atomics (default: enabled)])], - [], [enable_osx_builtin_atomics="yes"]) opal_cv_asm_builtin="BUILTIN_NO" if test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes" ; then @@ -982,10 +978,6 @@ AC_DEFUN([OPAL_CONFIG_ASM],[ if test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes" ; then OPAL_CHECK_SYNC_BUILTINS([opal_cv_asm_builtin="BUILTIN_SYNC"], []) fi - if test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_osx_builtin_atomics" = "yes" ; then - AC_CHECK_HEADER([libkern/OSAtomic.h], - [opal_cv_asm_builtin="BUILTIN_OSX"]) - fi OPAL_CHECK_ASM_PROC OPAL_CHECK_ASM_TEXT diff --git a/opal/include/opal/sys/Makefile.am b/opal/include/opal/sys/Makefile.am index 230abe81e7..e8353f4555 100644 --- a/opal/include/opal/sys/Makefile.am +++ b/opal/include/opal/sys/Makefile.am @@ -37,7 +37,6 @@ include opal/sys/arm64/Makefile.am include opal/sys/ia32/Makefile.am include opal/sys/ia64/Makefile.am include opal/sys/mips/Makefile.am -include opal/sys/osx/Makefile.am include opal/sys/powerpc/Makefile.am include opal/sys/sparcv9/Makefile.am include opal/sys/sync_builtin/Makefile.am diff --git a/opal/include/opal/sys/architecture.h b/opal/include/opal/sys/architecture.h index 6341fc354f..efb38945b7 100644 --- a/opal/include/opal/sys/architecture.h +++ b/opal/include/opal/sys/architecture.h @@ -43,7 +43,6 @@ #define OPAL_ARM 0100 #define OPAL_ARM64 0101 #define OPAL_BUILTIN_SYNC 0200 -#define OPAL_BUILTIN_OSX 0201 #define OPAL_BUILTIN_GCC 0202 #define OPAL_BUILTIN_NO 0203 diff --git a/opal/include/opal/sys/atomic.h b/opal/include/opal/sys/atomic.h index 1622d4f830..c1f26b272d 100644 --- a/opal/include/opal/sys/atomic.h +++ b/opal/include/opal/sys/atomic.h @@ -153,8 +153,6 @@ enum { #include "opal/sys/sync_builtin/atomic.h" #elif OPAL_ASSEMBLY_BUILTIN == OPAL_BUILTIN_GCC #include "opal/sys/gcc_builtin/atomic.h" -#elif OPAL_ASSEMBLY_BUILTIN == OPAL_BUILTIN_OSX -#include "opal/sys/osx/atomic.h" #elif OPAL_ASSEMBLY_ARCH == OPAL_X86_64 #include "opal/sys/x86_64/atomic.h" #elif OPAL_ASSEMBLY_ARCH == OPAL_ARM diff --git a/opal/include/opal/sys/osx/Makefile.am b/opal/include/opal/sys/osx/Makefile.am deleted file mode 100644 index 012ada4029..0000000000 --- a/opal/include/opal/sys/osx/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2013 Los Alamos National Security, LLC. All rights -# reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This makefile.am does not stand on its own - it is included from opal/include/Makefile.am - -headers += \ - opal/sys/osx/atomic.h diff --git a/opal/include/opal/sys/osx/atomic.h b/opal/include/opal/sys/osx/atomic.h deleted file mode 100644 index f73efc59f0..0000000000 --- a/opal/include/opal/sys/osx/atomic.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2010 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd. - * Copyright (c) 2013 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef OPAL_SYS_ARCH_ATOMIC_H -#define OPAL_SYS_ARCH_ATOMIC_H 1 - -#include - - -#define MB() OSMemoryBarrier - - -/********************************************************************** - * - * Define constants for OSX/iOS - * - *********************************************************************/ -#define OPAL_HAVE_ATOMIC_MEM_BARRIER 1 -#define OPAL_HAVE_ATOMIC_CMPSET_32 1 -#define OPAL_HAVE_ATOMIC_CMPSET_64 1 -#define OPAL_HAVE_ATOMIC_MATH_32 1 -#define OPAL_HAVE_ATOMIC_MATH_64 1 -#define OPAL_HAVE_ATOMIC_ADD_32 1 -#define OPAL_HAVE_ATOMIC_ADD_64 1 -#define OPAL_HAVE_ATOMIC_SUB_32 1 -#define OPAL_HAVE_ATOMIC_SUB_64 1 -#define OPAL_HAVE_ATOMIC_SPINLOCKS 1 - -/********************************************************************** - * - * Memory Barriers - * - *********************************************************************/ -static inline void opal_atomic_mb(void) -{ - MB(); -} - - -static inline void opal_atomic_rmb(void) -{ - MB(); -} - - -static inline void opal_atomic_wmb(void) -{ - MB(); -} - -static inline void opal_atomic_isync(void) -{ -} - -/********************************************************************** - * - * Atomic math operations - * - *********************************************************************/ -static inline int opal_atomic_cmpset_32( volatile int32_t *addr, - int32_t oldval, int32_t newval) -{ - return OSAtomicCompareAndSwap32 (oldval, newval, addr); -} - -#define opal_atomic_cmpset_acq_32 opal_atomic_cmpset_32 -#define opal_atomic_cmpset_rel_32 opal_atomic_cmpset_32 - - -static inline int opal_atomic_cmpset_64( volatile int64_t *addr, - int64_t oldval, int64_t newval) -{ - return OSAtomicCompareAndSwap64 (oldval, newval, addr); -} - -#define opal_atomic_cmpset_acq_64 opal_atomic_cmpset_64 -#define opal_atomic_cmpset_rel_64 opal_atomic_cmpset_64 - -/** - * atomic_add - add integer to atomic variable - * @i: integer value to add - * @v: pointer of type int - * - * Atomically adds @i to @v. - */ -static inline int32_t opal_atomic_add_32(volatile int32_t* v, int i) -{ - return OSAtomicAdd32 (i, v); -} - -/** - * atomic_add - add integer to atomic variable - * @i: integer value to add - * @v: pointer of type int - * - * Atomically adds @i to @v. - */ -static inline int64_t opal_atomic_add_64(volatile int64_t* v, int64_t i) -{ - return OSAtomicAdd64 (i, v); -} - -/** - * atomic_sub - subtract the atomic variable - * @i: integer value to subtract - * @v: pointer of type int - * - * Atomically subtracts @i from @v. - */ -static inline int32_t opal_atomic_sub_32(volatile int32_t* v, int i) -{ - return OSAtomicAdd32 (-i, v); -} - -/** - * atomic_sub - subtract the atomic variable - * @i: integer value to subtract - * @v: pointer of type int - * - * Atomically subtracts @i from @v. - */ -static inline int64_t opal_atomic_sub_64(volatile int64_t* v, int64_t i) -{ - return OSAtomicAdd64 (-i, v); -} - -static inline void opal_atomic_init(opal_atomic_lock_t* lock, int32_t value) -{ - lock->u.lock = OS_SPINLOCK_INIT; - if (value) { - OSSpinLockLock (&lock->u.lock); - } -} - -static inline int opal_atomic_trylock(opal_atomic_lock_t *lock) -{ - return !OSSpinLockTry (&lock->u.lock); -} - -static inline void opal_atomic_lock(opal_atomic_lock_t *lock) -{ - OSSpinLockLock (&lock->u.lock); -} - -static inline void opal_atomic_unlock(opal_atomic_lock_t *lock) -{ - OSSpinLockUnlock (&lock->u.lock); -} - -#endif /* ! OPAL_SYS_ARCH_ATOMIC_H */