Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f86798ba
Commit
f86798ba
authored
Jun 26, 2014
by
Salvatore Sanfilippo
Browse files
Merge pull request #1838 from mattsta/powerpc-fixes
PowerPC compile-time improvements
parents
9be3ee82
a3e7a665
Changes
2
Show whitespace changes
Inline
Side-by-side
src/config.h
View file @
f86798ba
...
...
@@ -185,7 +185,7 @@ void setproctitle(const char *fmt, ...);
#error "Undefined or invalid BYTE_ORDER"
#endif
#if (__i386 || __amd64) && __GNUC__
#if (__i386 || __amd64
|| __powerpc__
) && __GNUC__
#define GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#if (GNUC_VERSION >= 40100) || defined(__clang__)
#define HAVE_ATOMIC
...
...
src/zmalloc.c
View file @
f86798ba
...
...
@@ -67,7 +67,10 @@ void zlibc_free(void *ptr) {
#define free(ptr) je_free(ptr)
#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_sub(__n) __sync_sub_and_fetch(&used_memory, (__n))
#else
...
...
@@ -219,8 +222,8 @@ size_t zmalloc_used_memory(void) {
size_t
um
;
if
(
zmalloc_thread_safe
)
{
#ifdef
HAVE_ATOMIC
um
=
__sync_add_and_fetch
(
&
used_memory
,
0
);
#if
def
ined(__ATOMIC_RELAXED) || defined(
HAVE_ATOMIC
)
um
=
update_zmalloc_stat_add
(
0
);
#else
pthread_mutex_lock
(
&
used_memory_mutex
);
um
=
used_memory
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment