Deprecate OSSpinLock.
This commit is contained in:
parent
13c237c7ef
commit
43f3b1ad0c
20
configure.ac
20
configure.ac
@ -1845,7 +1845,7 @@ fi
|
|||||||
dnl ============================================================================
|
dnl ============================================================================
|
||||||
dnl Check for atomic(3) operations as provided on Darwin.
|
dnl Check for atomic(3) operations as provided on Darwin.
|
||||||
dnl We need this not for the atomic operations (which are provided above), but
|
dnl We need this not for the atomic operations (which are provided above), but
|
||||||
dnl rather for the OSSpinLock type it exposes.
|
dnl rather for the OS_unfair_lock type it exposes.
|
||||||
|
|
||||||
JE_COMPILABLE([Darwin OSAtomic*()], [
|
JE_COMPILABLE([Darwin OSAtomic*()], [
|
||||||
#include <libkern/OSAtomic.h>
|
#include <libkern/OSAtomic.h>
|
||||||
@ -2011,21 +2011,6 @@ if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
|
|||||||
AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ])
|
AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl ============================================================================
|
|
||||||
dnl Check for spinlock(3) operations as provided on Darwin.
|
|
||||||
|
|
||||||
JE_COMPILABLE([Darwin OSSpin*()], [
|
|
||||||
#include <libkern/OSAtomic.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
], [
|
|
||||||
OSSpinLock lock = 0;
|
|
||||||
OSSpinLockLock(&lock);
|
|
||||||
OSSpinLockUnlock(&lock);
|
|
||||||
], [je_cv_osspin])
|
|
||||||
if test "x${je_cv_osspin}" = "xyes" ; then
|
|
||||||
AC_DEFINE([JEMALLOC_OSSPIN], [ ])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl ============================================================================
|
dnl ============================================================================
|
||||||
dnl Darwin-related configuration.
|
dnl Darwin-related configuration.
|
||||||
|
|
||||||
@ -2079,8 +2064,7 @@ dnl ============================================================================
|
|||||||
dnl Enable background threads if possible.
|
dnl Enable background threads if possible.
|
||||||
|
|
||||||
if test "x${have_pthread}" = "x1" -a "x${have_dlsym}" = "x1" \
|
if test "x${have_pthread}" = "x1" -a "x${have_dlsym}" = "x1" \
|
||||||
-a "x${je_cv_os_unfair_lock}" != "xyes" \
|
-a "x${je_cv_os_unfair_lock}" != "xyes" ; then
|
||||||
-a "x${je_cv_osspin}" != "xyes" ; then
|
|
||||||
AC_DEFINE([JEMALLOC_BACKGROUND_THREAD])
|
AC_DEFINE([JEMALLOC_BACKGROUND_THREAD])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -78,12 +78,6 @@
|
|||||||
*/
|
*/
|
||||||
#undef JEMALLOC_OS_UNFAIR_LOCK
|
#undef JEMALLOC_OS_UNFAIR_LOCK
|
||||||
|
|
||||||
/*
|
|
||||||
* Defined if OSSpin*() functions are available, as provided by Darwin, and
|
|
||||||
* documented in the spinlock(3) manual page.
|
|
||||||
*/
|
|
||||||
#undef JEMALLOC_OSSPIN
|
|
||||||
|
|
||||||
/* Defined if syscall(2) is usable. */
|
/* Defined if syscall(2) is usable. */
|
||||||
#undef JEMALLOC_USE_SYSCALL
|
#undef JEMALLOC_USE_SYSCALL
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
# include "../jemalloc@install_suffix@.h"
|
# include "../jemalloc@install_suffix@.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(JEMALLOC_OSATOMIC) || defined(JEMALLOC_OSSPIN))
|
#if defined(JEMALLOC_OSATOMIC)
|
||||||
#include <libkern/OSAtomic.h>
|
#include <libkern/OSAtomic.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -37,8 +37,6 @@ struct malloc_mutex_s {
|
|||||||
# endif
|
# endif
|
||||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||||
os_unfair_lock lock;
|
os_unfair_lock lock;
|
||||||
#elif (defined(JEMALLOC_OSSPIN))
|
|
||||||
OSSpinLock lock;
|
|
||||||
#elif (defined(JEMALLOC_MUTEX_INIT_CB))
|
#elif (defined(JEMALLOC_MUTEX_INIT_CB))
|
||||||
pthread_mutex_t lock;
|
pthread_mutex_t lock;
|
||||||
malloc_mutex_t *postponed_next;
|
malloc_mutex_t *postponed_next;
|
||||||
@ -84,10 +82,6 @@ struct malloc_mutex_s {
|
|||||||
# define MALLOC_MUTEX_LOCK(m) os_unfair_lock_lock(&(m)->lock)
|
# define MALLOC_MUTEX_LOCK(m) os_unfair_lock_lock(&(m)->lock)
|
||||||
# define MALLOC_MUTEX_UNLOCK(m) os_unfair_lock_unlock(&(m)->lock)
|
# define MALLOC_MUTEX_UNLOCK(m) os_unfair_lock_unlock(&(m)->lock)
|
||||||
# define MALLOC_MUTEX_TRYLOCK(m) (!os_unfair_lock_trylock(&(m)->lock))
|
# define MALLOC_MUTEX_TRYLOCK(m) (!os_unfair_lock_trylock(&(m)->lock))
|
||||||
#elif (defined(JEMALLOC_OSSPIN))
|
|
||||||
# define MALLOC_MUTEX_LOCK(m) OSSpinLockLock(&(m)->lock)
|
|
||||||
# define MALLOC_MUTEX_UNLOCK(m) OSSpinLockUnlock(&(m)->lock)
|
|
||||||
# define MALLOC_MUTEX_TRYLOCK(m) (!OSSpinLockTry(&(m)->lock))
|
|
||||||
#else
|
#else
|
||||||
# define MALLOC_MUTEX_LOCK(m) pthread_mutex_lock(&(m)->lock)
|
# define MALLOC_MUTEX_LOCK(m) pthread_mutex_lock(&(m)->lock)
|
||||||
# define MALLOC_MUTEX_UNLOCK(m) pthread_mutex_unlock(&(m)->lock)
|
# define MALLOC_MUTEX_UNLOCK(m) pthread_mutex_unlock(&(m)->lock)
|
||||||
@ -110,10 +104,6 @@ struct malloc_mutex_s {
|
|||||||
{{{LOCK_PROF_DATA_INITIALIZER, OS_UNFAIR_LOCK_INIT}}, \
|
{{{LOCK_PROF_DATA_INITIALIZER, OS_UNFAIR_LOCK_INIT}}, \
|
||||||
WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
|
WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
|
||||||
# endif
|
# endif
|
||||||
#elif (defined(JEMALLOC_OSSPIN))
|
|
||||||
# define MALLOC_MUTEX_INITIALIZER \
|
|
||||||
{{{LOCK_PROF_DATA_INITIALIZER, 0}}, \
|
|
||||||
WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
|
|
||||||
#elif (defined(JEMALLOC_MUTEX_INIT_CB))
|
#elif (defined(JEMALLOC_MUTEX_INIT_CB))
|
||||||
# if (defined(JEMALLOC_DEBUG))
|
# if (defined(JEMALLOC_DEBUG))
|
||||||
# define MALLOC_MUTEX_INITIALIZER \
|
# define MALLOC_MUTEX_INITIALIZER \
|
||||||
|
@ -145,8 +145,6 @@ malloc_mutex_init(malloc_mutex_t *mutex, const char *name,
|
|||||||
# endif
|
# endif
|
||||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||||
mutex->lock = OS_UNFAIR_LOCK_INIT;
|
mutex->lock = OS_UNFAIR_LOCK_INIT;
|
||||||
#elif (defined(JEMALLOC_OSSPIN))
|
|
||||||
mutex->lock = 0;
|
|
||||||
#elif (defined(JEMALLOC_MUTEX_INIT_CB))
|
#elif (defined(JEMALLOC_MUTEX_INIT_CB))
|
||||||
if (postpone_init) {
|
if (postpone_init) {
|
||||||
mutex->postponed_next = postponed_mutexes;
|
mutex->postponed_next = postponed_mutexes;
|
||||||
|
@ -25,7 +25,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include "test/jemalloc_test_defs.h"
|
#include "test/jemalloc_test_defs.h"
|
||||||
|
|
||||||
#ifdef JEMALLOC_OSSPIN
|
#if defined(JEMALLOC_OSATOMIC)
|
||||||
# include <libkern/OSAtomic.h>
|
# include <libkern/OSAtomic.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@ typedef struct {
|
|||||||
CRITICAL_SECTION lock;
|
CRITICAL_SECTION lock;
|
||||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||||
os_unfair_lock lock;
|
os_unfair_lock lock;
|
||||||
#elif (defined(JEMALLOC_OSSPIN))
|
|
||||||
OSSpinLock lock;
|
|
||||||
#else
|
#else
|
||||||
pthread_mutex_t lock;
|
pthread_mutex_t lock;
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,8 +13,6 @@ mtx_init(mtx_t *mtx) {
|
|||||||
}
|
}
|
||||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||||
mtx->lock = OS_UNFAIR_LOCK_INIT;
|
mtx->lock = OS_UNFAIR_LOCK_INIT;
|
||||||
#elif (defined(JEMALLOC_OSSPIN))
|
|
||||||
mtx->lock = 0;
|
|
||||||
#else
|
#else
|
||||||
pthread_mutexattr_t attr;
|
pthread_mutexattr_t attr;
|
||||||
|
|
||||||
@ -35,7 +33,6 @@ void
|
|||||||
mtx_fini(mtx_t *mtx) {
|
mtx_fini(mtx_t *mtx) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||||
#elif (defined(JEMALLOC_OSSPIN))
|
|
||||||
#else
|
#else
|
||||||
pthread_mutex_destroy(&mtx->lock);
|
pthread_mutex_destroy(&mtx->lock);
|
||||||
#endif
|
#endif
|
||||||
@ -47,8 +44,6 @@ mtx_lock(mtx_t *mtx) {
|
|||||||
EnterCriticalSection(&mtx->lock);
|
EnterCriticalSection(&mtx->lock);
|
||||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||||
os_unfair_lock_lock(&mtx->lock);
|
os_unfair_lock_lock(&mtx->lock);
|
||||||
#elif (defined(JEMALLOC_OSSPIN))
|
|
||||||
OSSpinLockLock(&mtx->lock);
|
|
||||||
#else
|
#else
|
||||||
pthread_mutex_lock(&mtx->lock);
|
pthread_mutex_lock(&mtx->lock);
|
||||||
#endif
|
#endif
|
||||||
@ -60,8 +55,6 @@ mtx_unlock(mtx_t *mtx) {
|
|||||||
LeaveCriticalSection(&mtx->lock);
|
LeaveCriticalSection(&mtx->lock);
|
||||||
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
|
||||||
os_unfair_lock_unlock(&mtx->lock);
|
os_unfair_lock_unlock(&mtx->lock);
|
||||||
#elif (defined(JEMALLOC_OSSPIN))
|
|
||||||
OSSpinLockUnlock(&mtx->lock);
|
|
||||||
#else
|
#else
|
||||||
pthread_mutex_unlock(&mtx->lock);
|
pthread_mutex_unlock(&mtx->lock);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user