diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2013-12-09 17:14:12 +0100 |
---|---|---|
committer | Ondřej Bílka <neleai@seznam.cz> | 2013-12-09 17:14:12 +0100 |
commit | f3eeb3fc560ccc4ce51dc605e4703c5016b07244 (patch) | |
tree | 3473c8dfdddb007c00fa39790ac3bdb1b3c3603a /malloc/malloc.c | |
parent | caecf2a0ce760f03a7f5ffd63c9001cc1cfc2fbf (diff) | |
download | glibc-f3eeb3fc560ccc4ce51dc605e4703c5016b07244.tar.gz glibc-f3eeb3fc560ccc4ce51dc605e4703c5016b07244.tar.xz glibc-f3eeb3fc560ccc4ce51dc605e4703c5016b07244.zip |
Replace malloc force_reg by atomic_forced_read.
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r-- | malloc/malloc.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index b3353bd0a3..4821debcbf 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -406,13 +406,6 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore; #include <string.h> - -/* Force a value to be in a register and stop the compiler referring - to the source (mostly memory location) again. */ -#define force_reg(val) \ - ({ __typeof (val) _v; asm ("" : "=r" (_v) : "0" (val)); _v; }) - - /* MORECORE-related declarations. By default, rely on sbrk */ @@ -2448,7 +2441,7 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av) if (brk != (char*)(MORECORE_FAILURE)) { /* Call the `morecore' hook if necessary. */ - void (*hook) (void) = force_reg (__after_morecore_hook); + void (*hook) (void) = atomic_forced_read (__after_morecore_hook); if (__builtin_expect (hook != NULL, 0)) (*hook) (); } else { @@ -2586,7 +2579,7 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av) snd_brk = (char*)(MORECORE(0)); } else { /* Call the `morecore' hook if necessary. */ - void (*hook) (void) = force_reg (__after_morecore_hook); + void (*hook) (void) = atomic_forced_read (__after_morecore_hook); if (__builtin_expect (hook != NULL, 0)) (*hook) (); } @@ -2740,7 +2733,7 @@ static int systrim(size_t pad, mstate av) MORECORE(-extra); /* Call the `morecore' hook if necessary. */ - void (*hook) (void) = force_reg (__after_morecore_hook); + void (*hook) (void) = atomic_forced_read (__after_morecore_hook); if (__builtin_expect (hook != NULL, 0)) (*hook) (); new_brk = (char*)(MORECORE(0)); @@ -2844,7 +2837,7 @@ __libc_malloc(size_t bytes) void *victim; void *(*hook) (size_t, const void *) - = force_reg (__malloc_hook); + = atomic_forced_read (__malloc_hook); if (__builtin_expect (hook != NULL, 0)) return (*hook)(bytes, RETURN_ADDRESS (0)); @@ -2876,7 +2869,7 @@ __libc_free(void* mem) mchunkptr p; /* chunk corresponding to mem */ void (*hook) (void *, const void *) - = force_reg (__free_hook); + = atomic_forced_read (__free_hook); if (__builtin_expect (hook != NULL, 0)) { (*hook)(mem, RETURN_ADDRESS (0)); return; @@ -2917,7 +2910,7 @@ __libc_realloc(void* oldmem, size_t bytes) void* newp; /* chunk to return */ void *(*hook) (void *, size_t, const void *) = - force_reg (__realloc_hook); + atomic_forced_read (__realloc_hook); if (__builtin_expect (hook != NULL, 0)) return (*hook)(oldmem, bytes, RETURN_ADDRESS (0)); @@ -3018,7 +3011,7 @@ _mid_memalign (size_t alignment, size_t bytes, void *address) void *p; void *(*hook) (size_t, size_t, const void *) = - force_reg (__memalign_hook); + atomic_forced_read (__memalign_hook); if (__builtin_expect (hook != NULL, 0)) return (*hook)(alignment, bytes, address); @@ -3128,7 +3121,7 @@ __libc_calloc(size_t n, size_t elem_size) } void *(*hook) (size_t, const void *) = - force_reg (__malloc_hook); + atomic_forced_read (__malloc_hook); if (__builtin_expect (hook != NULL, 0)) { sz = bytes; mem = (*hook)(sz, RETURN_ADDRESS (0)); |