mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Replace malloc force_reg by atomic_forced_read.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2013-12-09 Ondřej Bílka <neleai@seznam.cz>
|
||||||
|
|
||||||
|
* malloc/malloc.c: (force_reg): Remove.
|
||||||
|
(__malloc_assert, __libc_malloc, __libc_free, __libc_realloc,
|
||||||
|
_mid_memalign, __libc_calloc, sysmalloc, systrim): Replace
|
||||||
|
force_reg by atomic_forced_read.
|
||||||
|
* malloc/arena.c (ptmalloc_init): Likewise.
|
||||||
|
* malloc/hooks.c (top_check): Likewise.
|
||||||
|
|
||||||
2013-12-09 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
2013-12-09 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
||||||
|
|
||||||
* sysdeps/powerpc/fpu/libm-test-ulps: Update.
|
* sysdeps/powerpc/fpu/libm-test-ulps: Update.
|
||||||
|
@ -457,7 +457,7 @@ ptmalloc_init (void)
|
|||||||
if (check_action != 0)
|
if (check_action != 0)
|
||||||
__malloc_check_init();
|
__malloc_check_init();
|
||||||
}
|
}
|
||||||
void (*hook) (void) = force_reg (__malloc_initialize_hook);
|
void (*hook) (void) = atomic_forced_read (__malloc_initialize_hook);
|
||||||
if (hook != NULL)
|
if (hook != NULL)
|
||||||
(*hook)();
|
(*hook)();
|
||||||
__malloc_initialized = 1;
|
__malloc_initialized = 1;
|
||||||
|
@ -236,7 +236,7 @@ top_check(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Call the `morecore' hook if necessary. */
|
/* Call the `morecore' hook if necessary. */
|
||||||
void (*hook) (void) = force_reg (__after_morecore_hook);
|
void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
|
||||||
if (hook)
|
if (hook)
|
||||||
(*hook) ();
|
(*hook) ();
|
||||||
main_arena.system_mem = (new_brk - mp_.sbrk_base) + sbrk_size;
|
main_arena.system_mem = (new_brk - mp_.sbrk_base) + sbrk_size;
|
||||||
|
@ -406,13 +406,6 @@ void *(*__morecore)(ptrdiff_t) = __default_morecore;
|
|||||||
|
|
||||||
#include <string.h>
|
#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
|
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)) {
|
if (brk != (char*)(MORECORE_FAILURE)) {
|
||||||
/* Call the `morecore' hook if necessary. */
|
/* 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))
|
if (__builtin_expect (hook != NULL, 0))
|
||||||
(*hook) ();
|
(*hook) ();
|
||||||
} else {
|
} else {
|
||||||
@ -2586,7 +2579,7 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
|
|||||||
snd_brk = (char*)(MORECORE(0));
|
snd_brk = (char*)(MORECORE(0));
|
||||||
} else {
|
} else {
|
||||||
/* Call the `morecore' hook if necessary. */
|
/* 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))
|
if (__builtin_expect (hook != NULL, 0))
|
||||||
(*hook) ();
|
(*hook) ();
|
||||||
}
|
}
|
||||||
@ -2740,7 +2733,7 @@ static int systrim(size_t pad, mstate av)
|
|||||||
|
|
||||||
MORECORE(-extra);
|
MORECORE(-extra);
|
||||||
/* Call the `morecore' hook if necessary. */
|
/* 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))
|
if (__builtin_expect (hook != NULL, 0))
|
||||||
(*hook) ();
|
(*hook) ();
|
||||||
new_brk = (char*)(MORECORE(0));
|
new_brk = (char*)(MORECORE(0));
|
||||||
@ -2844,7 +2837,7 @@ __libc_malloc(size_t bytes)
|
|||||||
void *victim;
|
void *victim;
|
||||||
|
|
||||||
void *(*hook) (size_t, const void *)
|
void *(*hook) (size_t, const void *)
|
||||||
= force_reg (__malloc_hook);
|
= atomic_forced_read (__malloc_hook);
|
||||||
if (__builtin_expect (hook != NULL, 0))
|
if (__builtin_expect (hook != NULL, 0))
|
||||||
return (*hook)(bytes, RETURN_ADDRESS (0));
|
return (*hook)(bytes, RETURN_ADDRESS (0));
|
||||||
|
|
||||||
@ -2876,7 +2869,7 @@ __libc_free(void* mem)
|
|||||||
mchunkptr p; /* chunk corresponding to mem */
|
mchunkptr p; /* chunk corresponding to mem */
|
||||||
|
|
||||||
void (*hook) (void *, const void *)
|
void (*hook) (void *, const void *)
|
||||||
= force_reg (__free_hook);
|
= atomic_forced_read (__free_hook);
|
||||||
if (__builtin_expect (hook != NULL, 0)) {
|
if (__builtin_expect (hook != NULL, 0)) {
|
||||||
(*hook)(mem, RETURN_ADDRESS (0));
|
(*hook)(mem, RETURN_ADDRESS (0));
|
||||||
return;
|
return;
|
||||||
@ -2917,7 +2910,7 @@ __libc_realloc(void* oldmem, size_t bytes)
|
|||||||
void* newp; /* chunk to return */
|
void* newp; /* chunk to return */
|
||||||
|
|
||||||
void *(*hook) (void *, size_t, const void *) =
|
void *(*hook) (void *, size_t, const void *) =
|
||||||
force_reg (__realloc_hook);
|
atomic_forced_read (__realloc_hook);
|
||||||
if (__builtin_expect (hook != NULL, 0))
|
if (__builtin_expect (hook != NULL, 0))
|
||||||
return (*hook)(oldmem, bytes, RETURN_ADDRESS (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 *p;
|
||||||
|
|
||||||
void *(*hook) (size_t, size_t, const void *) =
|
void *(*hook) (size_t, size_t, const void *) =
|
||||||
force_reg (__memalign_hook);
|
atomic_forced_read (__memalign_hook);
|
||||||
if (__builtin_expect (hook != NULL, 0))
|
if (__builtin_expect (hook != NULL, 0))
|
||||||
return (*hook)(alignment, bytes, address);
|
return (*hook)(alignment, bytes, address);
|
||||||
|
|
||||||
@ -3128,7 +3121,7 @@ __libc_calloc(size_t n, size_t elem_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *(*hook) (size_t, const void *) =
|
void *(*hook) (size_t, const void *) =
|
||||||
force_reg (__malloc_hook);
|
atomic_forced_read (__malloc_hook);
|
||||||
if (__builtin_expect (hook != NULL, 0)) {
|
if (__builtin_expect (hook != NULL, 0)) {
|
||||||
sz = bytes;
|
sz = bytes;
|
||||||
mem = (*hook)(sz, RETURN_ADDRESS (0));
|
mem = (*hook)(sz, RETURN_ADDRESS (0));
|
||||||
|
Reference in New Issue
Block a user