1
1

Merge pull request #3179 from hppritcha/topic/remove_osx_builtin_atomics

OSx: remove built-in atomics support
Этот коммит содержится в:
Howard Pritchard 2017-03-16 07:58:41 -06:00 коммит произвёл GitHub
родитель 60ca372d60 db2e1298fb
Коммит 65d0372e84
6 изменённых файлов: 0 добавлений и 205 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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 <libkern/OSAtomic.h>
#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 */