diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-28 12:18:10 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-28 13:08:58 +0100 |
commit | f3876e3f4d2375e90112100de360da982ac2b8bb (patch) | |
tree | ed58b2c4924860c775398de794595bcb5634a5da /sal | |
parent | drop unused global rtl::OUStrings (diff) | |
download | core-f3876e3f4d2375e90112100de360da982ac2b8bb.tar.gz core-f3876e3f4d2375e90112100de360da982ac2b8bb.zip |
these VALGRIND allocator annotations never worked for me, just busted memcheck
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/source/alloc_arena.cxx | 15 | ||||
-rw-r--r-- | sal/rtl/source/alloc_cache.cxx | 37 | ||||
-rw-r--r-- | sal/rtl/source/alloc_impl.hxx | 31 |
3 files changed, 0 insertions, 83 deletions
diff --git a/sal/rtl/source/alloc_arena.cxx b/sal/rtl/source/alloc_arena.cxx index 639608ce7b3d..1223e0e3f0c1 100644 --- a/sal/rtl/source/alloc_arena.cxx +++ b/sal/rtl/source/alloc_arena.cxx @@ -922,7 +922,6 @@ try_alloc: if (result != 0) { rtl_arena_type * arena = result; - VALGRIND_CREATE_MEMPOOL(arena, 0, 0); rtl_arena_constructor (arena); if (!source_arena) @@ -945,7 +944,6 @@ try_alloc: { rtl_arena_deactivate (arena); rtl_arena_destructor (arena); - VALGRIND_DESTROY_MEMPOOL(arena); rtl_arena_free (gp_arena_arena, arena, size); } } @@ -972,7 +970,6 @@ SAL_CALL rtl_arena_destroy ( { rtl_arena_deactivate (arena); rtl_arena_destructor (arena); - VALGRIND_DESTROY_MEMPOOL(arena); rtl_arena_free (gp_arena_arena, arena, sizeof(rtl_arena_type)); } } @@ -1033,10 +1030,6 @@ SAL_CALL rtl_arena_alloc ( rtl_arena_hash_insert (arena, segment); - /* DEBUG ONLY: mark allocated, undefined */ - OSL_DEBUG_ONLY(memset((void*)(segment->m_addr), 0x77777777, segment->m_size)); - VALGRIND_MEMPOOL_ALLOC(arena, segment->m_addr, segment->m_size); - (*pSize) = segment->m_size; addr = (void*)(segment->m_addr); } @@ -1086,11 +1079,6 @@ SAL_CALL rtl_arena_free ( { rtl_arena_segment_type *next, *prev; - /* DEBUG ONLY: mark unallocated, undefined */ - VALGRIND_MEMPOOL_FREE(arena, segment->m_addr); - /* OSL_DEBUG_ONLY() */ RTL_VALGRIND_IGNORE_VAL VALGRIND_MAKE_MEM_UNDEFINED(segment->m_addr, segment->m_size); - OSL_DEBUG_ONLY(memset((void*)(segment->m_addr), 0x33333333, segment->m_size)); - /* coalesce w/ adjacent free segment(s) */ rtl_arena_segment_coalesce (arena, segment); @@ -1266,7 +1254,6 @@ rtl_arena_init() static rtl_arena_type g_machdep_arena; assert(gp_machdep_arena == 0); - VALGRIND_CREATE_MEMPOOL(&g_machdep_arena, 0, 0); rtl_arena_constructor (&g_machdep_arena); gp_machdep_arena = rtl_arena_activate ( @@ -1283,7 +1270,6 @@ rtl_arena_init() static rtl_arena_type g_default_arena; assert(gp_default_arena == 0); - VALGRIND_CREATE_MEMPOOL(&g_default_arena, 0, 0); rtl_arena_constructor (&g_default_arena); gp_default_arena = rtl_arena_activate ( @@ -1302,7 +1288,6 @@ rtl_arena_init() static rtl_arena_type g_arena_arena; assert(gp_arena_arena == 0); - VALGRIND_CREATE_MEMPOOL(&g_arena_arena, 0, 0); rtl_arena_constructor (&g_arena_arena); gp_arena_arena = rtl_arena_activate ( diff --git a/sal/rtl/source/alloc_cache.cxx b/sal/rtl/source/alloc_cache.cxx index 102f772872f4..e5352bbbcb87 100644 --- a/sal/rtl/source/alloc_cache.cxx +++ b/sal/rtl/source/alloc_cache.cxx @@ -483,11 +483,6 @@ rtl_cache_slab_alloc ( addr = (void*)rtl_cache_hash_insert (cache, bufctl); else addr = bufctl; - - /* DEBUG ONLY: mark allocated, undefined */ - /* OSL_DEBUG_ONLY() */ RTL_VALGRIND_IGNORE_VAL VALGRIND_MAKE_MEM_UNDEFINED(addr, cache->m_type_size); - OSL_DEBUG_ONLY(memset(addr, 0x77777777, cache->m_type_size)); - VALGRIND_MEMPOOL_ALLOC(cache, addr, cache->m_type_size); } RTL_MEMORY_LOCK_RELEASE(&(cache->m_slab_lock)); @@ -510,11 +505,6 @@ rtl_cache_slab_free ( RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_slab_lock)); - /* DEBUG ONLY: mark unallocated, undefined */ - VALGRIND_MEMPOOL_FREE(cache, addr); - /* OSL_DEBUG_ONLY() */ RTL_VALGRIND_IGNORE_VAL VALGRIND_MAKE_MEM_UNDEFINED(addr, cache->m_type_size); - OSL_DEBUG_ONLY(memset(addr, 0x33333333, cache->m_type_size)); - /* determine slab from addr */ if (cache->m_features & RTL_CACHE_FEATURE_HASH) { @@ -611,13 +601,8 @@ rtl_cache_magazine_clear ( void * obj = mag->m_objects[mag->m_mag_used - 1]; mag->m_objects[mag->m_mag_used - 1] = 0; - /* DEBUG ONLY: mark cached object allocated, undefined */ - VALGRIND_MEMPOOL_ALLOC(cache, obj, cache->m_type_size); if (cache->m_destructor != 0) { - /* DEBUG ONLY: keep constructed object defined */ - RTL_VALGRIND_IGNORE_VAL VALGRIND_MAKE_MEM_DEFINED(obj, cache->m_type_size); - /* destruct object */ (cache->m_destructor)(obj, cache->m_userarg); } @@ -1107,7 +1092,6 @@ try_alloc: if (result != 0) { rtl_cache_type * cache = result; - VALGRIND_CREATE_MEMPOOL(cache, 0, 0); (void) rtl_cache_constructor (cache); if (!source) @@ -1135,7 +1119,6 @@ try_alloc: /* activation failed */ rtl_cache_deactivate (cache); rtl_cache_destructor (cache); - VALGRIND_DESTROY_MEMPOOL(cache); rtl_arena_free (gp_cache_arena, cache, size); } } @@ -1161,7 +1144,6 @@ void SAL_CALL rtl_cache_destroy ( { rtl_cache_deactivate (cache); rtl_cache_destructor (cache); - VALGRIND_DESTROY_MEMPOOL(cache); rtl_arena_free (gp_cache_arena, cache, sizeof(rtl_cache_type)); } } @@ -1204,14 +1186,6 @@ SAL_CALL rtl_cache_alloc ( if ((curr != 0) && (curr->m_mag_used > 0)) { obj = curr->m_objects[--curr->m_mag_used]; -#if defined(HAVE_VALGRIND_MEMCHECK_H) - VALGRIND_MEMPOOL_ALLOC(cache, obj, cache->m_type_size); - if (cache->m_constructor != 0) - { - /* keep constructed object defined */ - RTL_VALGRIND_IGNORE_VAL VALGRIND_MAKE_MEM_DEFINED(obj, cache->m_type_size); - } -#endif /* HAVE_VALGRIND_MEMCHECK_H */ cache->m_cpu_stats.m_alloc += 1; RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock)); @@ -1289,9 +1263,6 @@ SAL_CALL rtl_cache_free ( if ((curr != 0) && (curr->m_mag_used < curr->m_mag_size)) { curr->m_objects[curr->m_mag_used++] = obj; -#if defined(HAVE_VALGRIND_MEMCHECK_H) - VALGRIND_MEMPOOL_FREE(cache, obj); -#endif /* HAVE_VALGRIND_MEMCHECK_H */ cache->m_cpu_stats.m_free += 1; RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock)); @@ -1604,7 +1575,6 @@ rtl_cache_init() static rtl_cache_type g_cache_magazine_cache; assert(gp_cache_magazine_cache == 0); - VALGRIND_CREATE_MEMPOOL(&g_cache_magazine_cache, 0, 0); (void) rtl_cache_constructor (&g_cache_magazine_cache); gp_cache_magazine_cache = rtl_cache_activate ( @@ -1629,7 +1599,6 @@ rtl_cache_init() static rtl_cache_type g_cache_slab_cache; assert(gp_cache_slab_cache == 0); - VALGRIND_CREATE_MEMPOOL(&g_cache_slab_cache, 0, 0); (void) rtl_cache_constructor (&g_cache_slab_cache); gp_cache_slab_cache = rtl_cache_activate ( @@ -1651,7 +1620,6 @@ rtl_cache_init() static rtl_cache_type g_cache_bufctl_cache; assert(gp_cache_bufctl_cache == 0); - VALGRIND_CREATE_MEMPOOL(&g_cache_bufctl_cache, 0, 0); (void) rtl_cache_constructor (&g_cache_bufctl_cache); gp_cache_bufctl_cache = rtl_cache_activate ( @@ -1689,21 +1657,18 @@ rtl_cache_fini() cache = gp_cache_bufctl_cache, gp_cache_bufctl_cache = 0; rtl_cache_deactivate (cache); rtl_cache_destructor (cache); - VALGRIND_DESTROY_MEMPOOL(cache); } if (gp_cache_slab_cache != 0) { cache = gp_cache_slab_cache, gp_cache_slab_cache = 0; rtl_cache_deactivate (cache); rtl_cache_destructor (cache); - VALGRIND_DESTROY_MEMPOOL(cache); } if (gp_cache_magazine_cache != 0) { cache = gp_cache_magazine_cache, gp_cache_magazine_cache = 0; rtl_cache_deactivate (cache); rtl_cache_destructor (cache); - VALGRIND_DESTROY_MEMPOOL(cache); } if (gp_cache_arena != 0) { @@ -1735,6 +1700,4 @@ rtl_cache_fini() // SAL_INFO("sal", "rtl_cache_fini completed"); } -/* ================================================================= */ - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/rtl/source/alloc_impl.hxx b/sal/rtl/source/alloc_impl.hxx index 4452f19e320c..4d6e27bd1fb3 100644 --- a/sal/rtl/source/alloc_impl.hxx +++ b/sal/rtl/source/alloc_impl.hxx @@ -235,37 +235,6 @@ typedef CRITICAL_SECTION rtl_memory_lock_type; #define RTL_CACHE_FLAG_NOMAGAZINE (1 << 13) /* w/o magazine layer */ #define RTL_CACHE_FLAG_QUANTUMCACHE (2 << 13) /* used as arena quantum cache */ - -/** Valgrind support macros. - */ -#if !defined(HAVE_MEMCHECK_H) || (OSL_DEBUG_LEVEL == 0) -#if !defined(NVALGRIND) -#define NVALGRIND 1 -#endif /* ! NVALGRIND */ -#endif /* ! HAVE_MEMCHECK_H || (OSL_DEBUG_LEVEL == 0) */ - -#if defined(NVALGRIND) -#define VALGRIND_MAKE_MEM_UNDEFINED(addr, size) -#define VALGRIND_MAKE_MEM_DEFINED(addr, size) -#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) -#define VALGRIND_FREELIKE_BLOCK(addr, rzB) -#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) -#define VALGRIND_DESTROY_MEMPOOL(pool) -#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) -#define VALGRIND_MEMPOOL_FREE(pool, addr) -#define RTL_VALGRIND_IGNORE_VAL -#elif defined(HAVE_MEMCHECK_H) -#include <memcheck.h> -/* valgrind macros contain unused variables... */ -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) -#if GCC_VERSION >= 40600 && !defined __clang__ -#pragma GCC diagnostic warning "-Wunused-but-set-variable" -#endif -#define RTL_VALGRIND_IGNORE_VAL (void) -#endif /* NVALGRIND || HAVE_MEMCHECK_H */ - typedef enum { AMode_CUSTOM, AMode_SYSTEM, AMode_UNSET } AllocMode; extern AllocMode alloc_mode; |