From: Ivan Maidanski Date: Fri, 23 Aug 2013 19:42:26 +0000 (+0400) Subject: Replace GC_DBG_RA with GC_DBG_EXTRAS macro X-Git-Tag: gc7_2d-freebsd~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d16f57acfeece01ae316be5c4b9f29e0ae35c3a0;p=gc Replace GC_DBG_RA with GC_DBG_EXTRAS macro * dbg_mlc.c (GC_debug_malloc_replacement, GC_debug_realloc_replacement): Use GC_DBG_EXTRAS (instead of "GC_DBG_RA NULL, 0"). * malloc.c (GC_debug_malloc_replacement): Likewise. * mallocx.c (GC_debug_realloc_replacement): Likewise. * include/private/gc_priv.h (GC_DBG_EXTRAS): New macro (similar to GC_EXTRAS but pass NULL/0 instead of __FILE__and __LINE__); pass "unknown" instead of NULL unless GC_ADD_CALLER. * include/private/gc_priv.h (GC_DBG_RA): Remove. --- diff --git a/dbg_mlc.c b/dbg_mlc.c index c643a02b..4c0de73c 100644 --- a/dbg_mlc.c +++ b/dbg_mlc.c @@ -1198,10 +1198,10 @@ GC_API void GC_CALL GC_debug_register_finalizer_ignore_self GC_API void * GC_CALL GC_debug_malloc_replacement(size_t lb) { - return GC_debug_malloc(lb, GC_DBG_RA NULL, 0); + return GC_debug_malloc(lb, GC_DBG_EXTRAS); } GC_API void * GC_CALL GC_debug_realloc_replacement(void *p, size_t lb) { - return GC_debug_realloc(p, lb, GC_DBG_RA NULL, 0); + return GC_debug_realloc(p, lb, GC_DBG_EXTRAS); } diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 49e68d21..575a319a 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -1715,13 +1715,16 @@ GC_INNER ptr_t GC_allocobj(size_t sz, int kind); /* head. Sz is in granules. */ #ifdef GC_ADD_CALLER + /* GC_DBG_EXTRAS is used by GC debug API functions (unlike GC_EXTRAS */ + /* used by GC debug API macros) thus GC_RETURN_ADDR_PARENT (pointing */ + /* to client caller) should be used if possible. */ # ifdef GC_RETURN_ADDR_PARENT -# define GC_DBG_RA GC_RETURN_ADDR_PARENT, +# define GC_DBG_EXTRAS GC_RETURN_ADDR_PARENT, NULL, 0 # else -# define GC_DBG_RA GC_RETURN_ADDR, +# define GC_DBG_EXTRAS GC_RETURN_ADDR, NULL, 0 # endif #else -# define GC_DBG_RA /* empty */ +# define GC_DBG_EXTRAS "unknown", 0 #endif /* We make the GC_clear_stack() call a tail one, hoping to get more of */ diff --git a/malloc.c b/malloc.c index b62193a9..80123471 100644 --- a/malloc.c +++ b/malloc.c @@ -329,8 +329,7 @@ GC_API void * GC_CALL GC_malloc_uncollectable(size_t lb) /* malloc replacements. Otherwise we end up saving a */ /* meaningless return address in the object. It also speeds things up, */ /* but it is admittedly quite ugly. */ -# define GC_debug_malloc_replacement(lb) \ - GC_debug_malloc(lb, GC_DBG_RA NULL, 0) +# define GC_debug_malloc_replacement(lb) GC_debug_malloc(lb, GC_DBG_EXTRAS) void * malloc(size_t lb) { diff --git a/mallocx.c b/mallocx.c index ee99d0fd..bfc71169 100644 --- a/mallocx.c +++ b/mallocx.c @@ -154,7 +154,7 @@ GC_API void * GC_CALL GC_realloc(void * p, size_t lb) /* As with malloc, avoid two levels of extra calls here. */ # define GC_debug_realloc_replacement(p, lb) \ - GC_debug_realloc(p, lb, GC_DBG_RA NULL, 0) + GC_debug_realloc(p, lb, GC_DBG_EXTRAS) void * realloc(void * p, size_t lb) {