From a94ca51dce72eb64627b51403983f1160069bfda Mon Sep 17 00:00:00 2001 From: Tomasz Gromadzki Date: Tue, 19 Mar 2024 09:28:59 +0100 Subject: [PATCH] common: disable compilation of unneded code Signed-off-by: Tomasz Gromadzki --- src/libpmemobj/heap.c | 2 ++ src/libpmemobj/heap.h | 4 +++- src/libpmemobj/obj.c | 2 +- src/libpmemobj/palloc.c | 2 ++ src/libpmemobj/palloc.h | 4 +++- utils/call_stacks_analysis/make_extra.py | 2 +- 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/libpmemobj/heap.c b/src/libpmemobj/heap.c index d0b02f6fa18..64cc19f42d7 100644 --- a/src/libpmemobj/heap.c +++ b/src/libpmemobj/heap.c @@ -1240,6 +1240,7 @@ heap_get_bestfit_block(struct palloc_heap *heap, struct bucket *b, return 0; } +#if VG_MEMCHECK_ENABLED /* * heap_end -- returns first address after heap */ @@ -1252,6 +1253,7 @@ heap_end(struct palloc_heap *h) return &last_zone->chunks[last_zone->header.size_idx]; } +#endif /* VG_MEMCHECK_ENABLED */ /* * heap_arena_create -- create a new arena, push it to the vector diff --git a/src/libpmemobj/heap.h b/src/libpmemobj/heap.h index 455669aef9b..09278bad69e 100644 --- a/src/libpmemobj/heap.h +++ b/src/libpmemobj/heap.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright 2015-2022, Intel Corporation */ +/* Copyright 2015-2024, Intel Corporation */ /* * heap.h -- internal definitions for heap @@ -83,7 +83,9 @@ void heap_foreach_object(struct palloc_heap *heap, object_callback cb, struct alloc_class_collection *heap_alloc_classes(struct palloc_heap *heap); +#if VG_MEMCHECK_ENABLED void *heap_end(struct palloc_heap *heap); +#endif /* VG_MEMCHECK_ENABLED */ unsigned heap_get_narenas_total(struct palloc_heap *heap); diff --git a/src/libpmemobj/obj.c b/src/libpmemobj/obj.c index 90b69825c76..886e3f16cee 100644 --- a/src/libpmemobj/obj.c +++ b/src/libpmemobj/obj.c @@ -956,7 +956,7 @@ obj_runtime_init(PMEMobjpool *pop, int rdonly, int boot, unsigned nlanes) VALGRIND_DO_MAKE_MEM_NOACCESS(end, (char *)pop + pop->set->poolsize - (char *)end); } -#endif +#endif /* VG_MEMCHECK_ENABLED */ obj_pool_init(); diff --git a/src/libpmemobj/palloc.c b/src/libpmemobj/palloc.c index 6d58d2753cd..93d3a7e672f 100644 --- a/src/libpmemobj/palloc.c +++ b/src/libpmemobj/palloc.c @@ -1279,6 +1279,7 @@ palloc_init(void *heap_start, uint64_t heap_size, uint64_t *sizep, return heap_init(heap_start, heap_size, sizep, p_ops); } +#if VG_MEMCHECK_ENABLED /* * palloc_heap_end -- returns first address after heap */ @@ -1287,6 +1288,7 @@ palloc_heap_end(struct palloc_heap *h) { return heap_end(h); } +#endif /* VG_MEMCHECK_ENABLED */ /* * palloc_heap_check -- verifies heap state diff --git a/src/libpmemobj/palloc.h b/src/libpmemobj/palloc.h index 52a1f533d3f..31ddecd5595 100644 --- a/src/libpmemobj/palloc.h +++ b/src/libpmemobj/palloc.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright 2015-2022, Intel Corporation */ +/* Copyright 2015-2024, Intel Corporation */ /* * palloc.h -- internal definitions for persistent allocator @@ -89,7 +89,9 @@ int palloc_buckets_init(struct palloc_heap *heap); int palloc_init(void *heap_start, uint64_t heap_size, uint64_t *sizep, struct pmem_ops *p_ops); +#if VG_MEMCHECK_ENABLED void *palloc_heap_end(struct palloc_heap *h); +#endif /* VG_MEMCHECK_ENABLED */ int palloc_heap_check(void *heap_start, uint64_t heap_size); void palloc_heap_cleanup(struct palloc_heap *heap); size_t palloc_heap(void *heap_start); diff --git a/utils/call_stacks_analysis/make_extra.py b/utils/call_stacks_analysis/make_extra.py index 1177e69450a..d6352201716 100755 --- a/utils/call_stacks_analysis/make_extra.py +++ b/utils/call_stacks_analysis/make_extra.py @@ -22,7 +22,7 @@ def dict_extend(dict_, key, values): def inlines(calls: Calls) -> Calls: # common calls['core_init'] = ['util_init', 'core_log_init', 'out_init'] - calls['core_fini'] = ['out_fini'] + calls['core_fini'] = ['out_fini', 'core_log_fini'] calls['common_init'] = ['core_init', 'util_mmap_init'] calls['common_fini'] = ['util_mmap_fini', 'core_fini'] calls['Last_errormsg_key_alloc'] = ['_Last_errormsg_key_alloc']