mirror of
https://github.com/fluencelabs/redis
synced 2025-04-01 23:31:03 +00:00
Merge pull request #1838 from mattsta/powerpc-fixes
PowerPC compile-time improvements
This commit is contained in:
commit
f86798ba6b
@ -185,7 +185,7 @@ void setproctitle(const char *fmt, ...);
|
|||||||
#error "Undefined or invalid BYTE_ORDER"
|
#error "Undefined or invalid BYTE_ORDER"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (__i386 || __amd64) && __GNUC__
|
#if (__i386 || __amd64 || __powerpc__) && __GNUC__
|
||||||
#define GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
#define GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||||
#if (GNUC_VERSION >= 40100) || defined(__clang__)
|
#if (GNUC_VERSION >= 40100) || defined(__clang__)
|
||||||
#define HAVE_ATOMIC
|
#define HAVE_ATOMIC
|
||||||
|
@ -67,7 +67,10 @@ void zlibc_free(void *ptr) {
|
|||||||
#define free(ptr) je_free(ptr)
|
#define free(ptr) je_free(ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ATOMIC
|
#if defined(__ATOMIC_RELAXED)
|
||||||
|
#define update_zmalloc_stat_add(__n) __atomic_add_fetch(&used_memory, (__n), __ATOMIC_RELAXED)
|
||||||
|
#define update_zmalloc_stat_sub(__n) __atomic_sub_fetch(&used_memory, (__n), __ATOMIC_RELAXED)
|
||||||
|
#elif defined(HAVE_ATOMIC)
|
||||||
#define update_zmalloc_stat_add(__n) __sync_add_and_fetch(&used_memory, (__n))
|
#define update_zmalloc_stat_add(__n) __sync_add_and_fetch(&used_memory, (__n))
|
||||||
#define update_zmalloc_stat_sub(__n) __sync_sub_and_fetch(&used_memory, (__n))
|
#define update_zmalloc_stat_sub(__n) __sync_sub_and_fetch(&used_memory, (__n))
|
||||||
#else
|
#else
|
||||||
@ -219,8 +222,8 @@ size_t zmalloc_used_memory(void) {
|
|||||||
size_t um;
|
size_t um;
|
||||||
|
|
||||||
if (zmalloc_thread_safe) {
|
if (zmalloc_thread_safe) {
|
||||||
#ifdef HAVE_ATOMIC
|
#if defined(__ATOMIC_RELAXED) || defined(HAVE_ATOMIC)
|
||||||
um = __sync_add_and_fetch(&used_memory, 0);
|
um = update_zmalloc_stat_add(0);
|
||||||
#else
|
#else
|
||||||
pthread_mutex_lock(&used_memory_mutex);
|
pthread_mutex_lock(&used_memory_mutex);
|
||||||
um = used_memory;
|
um = used_memory;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user