Author: florian
Date: Sun Sep 15 09:18:03 2013
New Revision: 13546
Log:
Move a function and its prototype VG_(malloc_effective_client_redzone_size)
to a conceptually better place.
Modified:
trunk/coregrind/m_mallocfree.c
trunk/coregrind/m_replacemalloc/replacemalloc_core.c
trunk/coregrind/pub_core_mallocfree.h
trunk/include/pub_tool_mallocfree.h
trunk/include/pub_tool_replacemalloc.h
Modified: trunk/coregrind/m_mallocfree.c
==============================================================================
--- trunk/coregrind/m_mallocfree.c (original)
+++ trunk/coregrind/m_mallocfree.c Sun Sep 15 09:18:03 2013
@@ -511,16 +511,6 @@
return arena;
}
-SizeT VG_(malloc_effective_client_redzone_size)(void)
-{
- vg_assert(VG_(needs).malloc_replacement);
- ensure_mm_init (VG_AR_CLIENT);
- /* ensure_mm_init will call arena_init if not yet done.
- This then ensures that the arena redzone size is properly
- initialised. */
- return arenaId_to_ArenaP(VG_AR_CLIENT)->rz_szB;
-}
-
// Initialise an arena. rz_szB is the (default) minimum redzone size;
// It might be overriden by VG_(clo_redzone_size) or VG_(clo_core_redzone_size).
// it might be made bigger to ensure that VG_MIN_MALLOC_SZB is observed.
@@ -2186,6 +2176,14 @@
mi->keepcost = 0; // may want some value in here
}
+SizeT VG_(arena_redzone_size) ( ArenaId aid )
+{
+ ensure_mm_init (VG_AR_CLIENT);
+ /* ensure_mm_init will call arena_init if not yet done.
+ This then ensures that the arena redzone size is properly
+ initialised. */
+ return arenaId_to_ArenaP(aid)->rz_szB;
+}
/*------------------------------------------------------------*/
/*--- Services layered on top of malloc/free. ---*/
Modified: trunk/coregrind/m_replacemalloc/replacemalloc_core.c
==============================================================================
--- trunk/coregrind/m_replacemalloc/replacemalloc_core.c (original)
+++ trunk/coregrind/m_replacemalloc/replacemalloc_core.c Sun Sep 15 09:18:03 2013
@@ -31,6 +31,8 @@
#include "pub_core_basics.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcprint.h"
+#include "pub_core_libcassert.h"
+#include "pub_core_tooliface.h" // VG_(needs)
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
#include "pub_core_replacemalloc.h"
@@ -71,6 +73,13 @@
return True;
}
+SizeT VG_(malloc_effective_client_redzone_size)(void)
+{
+ vg_assert(VG_(needs).malloc_replacement);
+
+ return VG_(arena_redzone_size)(VG_AR_CLIENT);
+}
+
/*------------------------------------------------------------*/
/*--- Useful functions ---*/
/*------------------------------------------------------------*/
Modified: trunk/coregrind/pub_core_mallocfree.h
==============================================================================
--- trunk/coregrind/pub_core_mallocfree.h (original)
+++ trunk/coregrind/pub_core_mallocfree.h Sun Sep 15 09:18:03 2013
@@ -117,6 +117,8 @@
extern SizeT VG_(arena_malloc_usable_size) ( ArenaId aid, void* payload );
+extern SizeT VG_(arena_redzone_size) ( ArenaId aid );
+
extern void VG_(mallinfo) ( ThreadId tid, struct vg_mallinfo* mi );
// VG_(arena_perm_malloc) is for permanent allocation of small blocks.
Modified: trunk/include/pub_tool_mallocfree.h
==============================================================================
--- trunk/include/pub_tool_mallocfree.h (original)
+++ trunk/include/pub_tool_mallocfree.h Sun Sep 15 09:18:03 2013
@@ -47,15 +47,6 @@
// possibly some more due to rounding up.
extern SizeT VG_(malloc_usable_size)( void* p );
-
-// If tool is replacing malloc for the client, the below returns
-// the effective client redzone as derived from the default
-// provided by the tool, VG_(clo_redzone_size) and the minimum
-// redzone required by m_mallocfree.c.
-// It is an error to call this before VG_(needs_malloc_replacement) has
-// been called.
-extern SizeT VG_(malloc_effective_client_redzone_size)(void);
-
// TODO: move somewhere else
// Call here to bomb the system when out of memory (mmap anon fails)
__attribute__((noreturn))
Modified: trunk/include/pub_tool_replacemalloc.h
==============================================================================
--- trunk/include/pub_tool_replacemalloc.h (original)
+++ trunk/include/pub_tool_replacemalloc.h Sun Sep 15 09:18:03 2013
@@ -65,6 +65,14 @@
extern Bool VG_(replacement_malloc_process_cmd_line_option) ( const HChar* arg );
+// If tool is replacing malloc for the client, the below returns
+// the effective client redzone as derived from the default
+// provided by the tool, VG_(clo_redzone_size) and the minimum
+// redzone required by m_mallocfree.c.
+// It is an error to call this before VG_(needs_malloc_replacement) has
+// been called.
+extern SizeT VG_(malloc_effective_client_redzone_size)(void);
+
#endif // __PUB_TOOL_REPLACEMALLOC_H
/*--------------------------------------------------------------------*/
|