diff --git a/include/jemalloc/internal/base.h b/include/jemalloc/internal/base.h index f71a874c..5200e4ff 100644 --- a/include/jemalloc/internal/base.h +++ b/include/jemalloc/internal/base.h @@ -106,7 +106,6 @@ base_t *base_new(tsdn_t *tsdn, unsigned ind, const extent_hooks_t *extent_hooks, bool metadata_use_hooks); void base_delete(tsdn_t *tsdn, base_t *base); ehooks_t *base_ehooks_get(base_t *base); -ehooks_t *base_ehooks_get_for_metadata(base_t *base); extent_hooks_t *base_extent_hooks_set( base_t *base, extent_hooks_t *extent_hooks); void *base_alloc(tsdn_t *tsdn, base_t *base, size_t size, size_t alignment); diff --git a/include/jemalloc/internal/bin.h b/include/jemalloc/internal/bin.h index 90fc3d31..a4fb1402 100644 --- a/include/jemalloc/internal/bin.h +++ b/include/jemalloc/internal/bin.h @@ -69,23 +69,13 @@ void bin_postfork_parent(tsdn_t *tsdn, bin_t *bin); void bin_postfork_child(tsdn_t *tsdn, bin_t *bin); /* Slab region allocation. */ -void *bin_slab_reg_alloc(edata_t *slab, const bin_info_t *bin_info); void bin_slab_reg_alloc_batch( edata_t *slab, const bin_info_t *bin_info, unsigned cnt, void **ptrs); /* Slab list management. */ -void bin_slabs_nonfull_insert(bin_t *bin, edata_t *slab); -void bin_slabs_nonfull_remove(bin_t *bin, edata_t *slab); -edata_t *bin_slabs_nonfull_tryget(bin_t *bin); -void bin_slabs_full_insert(bool is_auto, bin_t *bin, edata_t *slab); void bin_slabs_full_remove(bool is_auto, bin_t *bin, edata_t *slab); -/* Slab association / demotion. */ -void bin_dissociate_slab(bool is_auto, edata_t *slab, bin_t *bin); -void bin_lower_slab(tsdn_t *tsdn, bool is_auto, edata_t *slab, bin_t *bin); - /* Deallocation helpers (called under bin lock). */ -void bin_dalloc_slab_prepare(tsdn_t *tsdn, edata_t *slab, bin_t *bin); void bin_dalloc_locked_handle_newly_empty( tsdn_t *tsdn, bool is_auto, edata_t *slab, bin_t *bin); void bin_dalloc_locked_handle_newly_nonempty( diff --git a/include/jemalloc/internal/bitmap.h b/include/jemalloc/internal/bitmap.h index 18c96f41..2b83f077 100644 --- a/include/jemalloc/internal/bitmap.h +++ b/include/jemalloc/internal/bitmap.h @@ -176,9 +176,7 @@ typedef struct bitmap_info_s { #endif /* BITMAP_USE_TREE */ } bitmap_info_t; -void bitmap_info_init(bitmap_info_t *binfo, size_t nbits); void bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo, bool fill); -size_t bitmap_size(const bitmap_info_t *binfo); static inline bool bitmap_full(const bitmap_t *bitmap, const bitmap_info_t *binfo) { diff --git a/include/jemalloc/internal/buf_writer.h b/include/jemalloc/internal/buf_writer.h index 5ee9af4e..ec0be7a9 100644 --- a/include/jemalloc/internal/buf_writer.h +++ b/include/jemalloc/internal/buf_writer.h @@ -25,7 +25,6 @@ typedef struct { bool buf_writer_init(tsdn_t *tsdn, buf_writer_t *buf_writer, write_cb_t *write_cb, void *cbopaque, char *buf, size_t buf_len); -void buf_writer_flush(buf_writer_t *buf_writer); write_cb_t buf_writer_cb; void buf_writer_terminate(tsdn_t *tsdn, buf_writer_t *buf_writer); diff --git a/include/jemalloc/internal/ckh.h b/include/jemalloc/internal/ckh.h index 01b27e8f..14ef244e 100644 --- a/include/jemalloc/internal/ckh.h +++ b/include/jemalloc/internal/ckh.h @@ -93,10 +93,4 @@ bool ckh_remove( tsd_t *tsd, ckh_t *ckh, const void *searchkey, void **key, void **data); bool ckh_search(ckh_t *ckh, const void *searchkey, void **key, void **data); -/* Some useful hash and comparison functions for strings and pointers. */ -void ckh_string_hash(const void *key, size_t r_hash[2]); -bool ckh_string_keycomp(const void *k1, const void *k2); -void ckh_pointer_hash(const void *key, size_t r_hash[2]); -bool ckh_pointer_keycomp(const void *k1, const void *k2); - #endif /* JEMALLOC_INTERNAL_CKH_H */ diff --git a/include/jemalloc/internal/hpa.h b/include/jemalloc/internal/hpa.h index c5fcf47b..b7d685d9 100644 --- a/include/jemalloc/internal/hpa.h +++ b/include/jemalloc/internal/hpa.h @@ -190,7 +190,6 @@ struct hpa_shard_s { nstime_t last_time_work_attempted; }; -bool hpa_hugepage_size_exceeds_limit(void); /* * Whether or not the HPA can be used given the current configuration. This * is not necessarily a guarantee that it backs its allocations by hugepages, diff --git a/include/jemalloc/internal/hpdata.h b/include/jemalloc/internal/hpdata.h index b99810cf..a13aa106 100644 --- a/include/jemalloc/internal/hpdata.h +++ b/include/jemalloc/internal/hpdata.h @@ -425,11 +425,6 @@ hpdata_full(const hpdata_t *hpdata) { void hpdata_init(hpdata_t *hpdata, void *addr, uint64_t age, bool is_huge); -/* - * Given an hpdata which can serve an allocation request, pick and reserve an - * offset within that allocation. - */ -void *hpdata_reserve_alloc(hpdata_t *hpdata, size_t sz); void hpdata_unreserve(hpdata_t *hpdata, void *addr, size_t sz); /* diff --git a/include/jemalloc/internal/nstime.h b/include/jemalloc/internal/nstime.h index 5cfe65eb..b7342210 100644 --- a/include/jemalloc/internal/nstime.h +++ b/include/jemalloc/internal/nstime.h @@ -28,7 +28,6 @@ static const nstime_t nstime_zero = NSTIME_ZERO_INITIALIZER; void nstime_init(nstime_t *time, uint64_t ns); void nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec); uint64_t nstime_ns(const nstime_t *time); -uint64_t nstime_ms(const nstime_t *time); uint64_t nstime_sec(const nstime_t *time); uint64_t nstime_nsec(const nstime_t *time); void nstime_copy(nstime_t *time, const nstime_t *source); @@ -36,7 +35,6 @@ int nstime_compare(const nstime_t *a, const nstime_t *b); void nstime_add(nstime_t *time, const nstime_t *addend); void nstime_iadd(nstime_t *time, uint64_t addend); void nstime_subtract(nstime_t *time, const nstime_t *subtrahend); -void nstime_isubtract(nstime_t *time, uint64_t subtrahend); void nstime_imultiply(nstime_t *time, uint64_t multiplier); void nstime_idivide(nstime_t *time, uint64_t divisor); uint64_t nstime_divide(const nstime_t *time, const nstime_t *divisor); diff --git a/include/jemalloc/internal/prof.h b/include/jemalloc/internal/prof.h index b0757886..e04836ce 100644 --- a/include/jemalloc/internal/prof.h +++ b/include/jemalloc/internal/prof.h @@ -419,7 +419,6 @@ void prof_prefork1(tsdn_t *tsdn); void prof_postfork_parent(tsdn_t *tsdn); void prof_postfork_child(tsdn_t *tsdn); -uint64_t prof_sample_new_event_wait(tsd_t *tsd); uint64_t tsd_prof_sample_event_wait_get(tsd_t *tsd); extern te_base_cb_t prof_sample_te_handler; diff --git a/include/jemalloc/internal/prof_data.h b/include/jemalloc/internal/prof_data.h index 0af5835c..1c3f9897 100644 --- a/include/jemalloc/internal/prof_data.h +++ b/include/jemalloc/internal/prof_data.h @@ -29,9 +29,4 @@ void prof_tdata_detach(tsd_t *tsd, prof_tdata_t *tdata); void prof_reset(tsd_t *tsd, size_t lg_sample); void prof_tctx_try_destroy(tsd_t *tsd, prof_tctx_t *tctx); -/* Used in unit tests. */ -size_t prof_tdata_count(void); -size_t prof_bt_count(void); -void prof_cnt_all(prof_cnt_t *cnt_all); - #endif /* JEMALLOC_INTERNAL_PROF_DATA_H */ diff --git a/include/jemalloc/internal/prof_log.h b/include/jemalloc/internal/prof_log.h index d9b97dc8..3a38e886 100644 --- a/include/jemalloc/internal/prof_log.h +++ b/include/jemalloc/internal/prof_log.h @@ -9,14 +9,6 @@ extern malloc_mutex_t log_mtx; void prof_try_log(tsd_t *tsd, size_t usize, prof_info_t *prof_info); bool prof_log_init(tsd_t *tsdn); -/* Used in unit tests. */ -size_t prof_log_bt_count(void); -size_t prof_log_alloc_count(void); -size_t prof_log_thr_count(void); -bool prof_log_is_logging(void); -bool prof_log_rep_check(void); -void prof_log_dummy_set(bool new_value); - bool prof_log_start(tsdn_t *tsdn, const char *filename); bool prof_log_stop(tsdn_t *tsdn); diff --git a/include/jemalloc/internal/prof_recent.h b/include/jemalloc/internal/prof_recent.h index 33649e6d..2627f43b 100644 --- a/include/jemalloc/internal/prof_recent.h +++ b/include/jemalloc/internal/prof_recent.h @@ -17,8 +17,6 @@ void edata_prof_recent_alloc_init(edata_t *edata); /* Used in unit tests. */ typedef ql_head(prof_recent_t) prof_recent_list_t; extern prof_recent_list_t prof_recent_alloc_list; -edata_t *prof_recent_alloc_edata_get_no_lock_test(const prof_recent_t *node); -prof_recent_t *edata_prof_recent_alloc_get_no_lock_test(const edata_t *edata); ssize_t prof_recent_alloc_max_ctl_read(void); ssize_t prof_recent_alloc_max_ctl_write(tsd_t *tsd, ssize_t max); diff --git a/include/jemalloc/internal/sc.h b/include/jemalloc/internal/sc.h index 7d2ff271..1fd077e2 100644 --- a/include/jemalloc/internal/sc.h +++ b/include/jemalloc/internal/sc.h @@ -368,7 +368,6 @@ struct sc_data_s { sc_t sc[SC_NSIZES]; }; -size_t reg_size_compute(int lg_base, int lg_delta, int ndelta); void sc_data_init(sc_data_t *data); /* * Updates slab sizes in [begin, end] to be pgs pages in length, if possible. diff --git a/src/base.c b/src/base.c index 0ac658b7..3a76050f 100644 --- a/src/base.c +++ b/src/base.c @@ -8,6 +8,8 @@ #include "jemalloc/internal/mutex.h" #include "jemalloc/internal/sz.h" +JET_EXTERN ehooks_t *base_ehooks_get_for_metadata(base_t *base); + /* * In auto mode, arenas switch to huge pages for the base allocator on the * second base block. a0 switches to thp on the 5th block (after 20 megabytes @@ -545,7 +547,7 @@ base_ehooks_get(base_t *base) { return &base->ehooks; } -ehooks_t * +JET_EXTERN ehooks_t * base_ehooks_get_for_metadata(base_t *base) { return &base->ehooks_base; } diff --git a/src/bin.c b/src/bin.c index 694579b9..830483a2 100644 --- a/src/bin.c +++ b/src/bin.c @@ -69,7 +69,7 @@ bin_postfork_child(tsdn_t *tsdn, bin_t *bin) { malloc_mutex_postfork_child(tsdn, &bin->lock); } -void * +JET_EXTERN void * bin_slab_reg_alloc(edata_t *slab, const bin_info_t *bin_info) { void *ret; slab_data_t *slab_data = edata_slab_data_get(slab); @@ -134,7 +134,7 @@ bin_slab_reg_alloc_batch( edata_nfree_sub(slab, cnt); } -void +JET_EXTERN void bin_slabs_nonfull_insert(bin_t *bin, edata_t *slab) { assert(edata_nfree_get(slab) > 0); edata_heap_insert(&bin->slabs_nonfull, slab); @@ -143,7 +143,7 @@ bin_slabs_nonfull_insert(bin_t *bin, edata_t *slab) { } } -void +JET_EXTERN void bin_slabs_nonfull_remove(bin_t *bin, edata_t *slab) { edata_heap_remove(&bin->slabs_nonfull, slab); if (config_stats) { @@ -151,7 +151,7 @@ bin_slabs_nonfull_remove(bin_t *bin, edata_t *slab) { } } -edata_t * +JET_EXTERN edata_t * bin_slabs_nonfull_tryget(bin_t *bin) { edata_t *slab = edata_heap_remove_first(&bin->slabs_nonfull); if (slab == NULL) { @@ -164,7 +164,7 @@ bin_slabs_nonfull_tryget(bin_t *bin) { return slab; } -void +JET_EXTERN void bin_slabs_full_insert(bool is_auto, bin_t *bin, edata_t *slab) { assert(edata_nfree_get(slab) == 0); /* @@ -186,7 +186,7 @@ bin_slabs_full_remove(bool is_auto, bin_t *bin, edata_t *slab) { edata_list_active_remove(&bin->slabs_full, slab); } -void +JET_EXTERN void bin_dissociate_slab(bool is_auto, edata_t *slab, bin_t *bin) { /* Dissociate slab from bin. */ if (slab == bin->slabcur) { @@ -208,7 +208,7 @@ bin_dissociate_slab(bool is_auto, edata_t *slab, bin_t *bin) { } } -void +JET_EXTERN void bin_lower_slab(tsdn_t *tsdn, bool is_auto, edata_t *slab, bin_t *bin) { assert(edata_nfree_get(slab) > 0); @@ -234,7 +234,7 @@ bin_lower_slab(tsdn_t *tsdn, bool is_auto, edata_t *slab, bin_t *bin) { } } -void +JET_EXTERN void bin_dalloc_slab_prepare(tsdn_t *tsdn, edata_t *slab, bin_t *bin) { malloc_mutex_assert_owner(tsdn, &bin->lock); diff --git a/src/bitmap.c b/src/bitmap.c index c399a05c..2f113ad7 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -5,8 +5,11 @@ /******************************************************************************/ +JET_EXTERN size_t bitmap_size(const bitmap_info_t *binfo); + #ifdef BITMAP_USE_TREE +#ifdef JEMALLOC_JET void bitmap_info_init(bitmap_info_t *binfo, size_t nbits) { unsigned i; @@ -34,6 +37,7 @@ bitmap_info_init(bitmap_info_t *binfo, size_t nbits) { binfo->nlevels = i; binfo->nbits = nbits; } +#endif static size_t bitmap_info_ngroups(const bitmap_info_t *binfo) { @@ -82,6 +86,7 @@ bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo, bool fill) { #else /* BITMAP_USE_TREE */ +#ifdef JEMALLOC_JET void bitmap_info_init(bitmap_info_t *binfo, size_t nbits) { assert(nbits > 0); @@ -90,6 +95,7 @@ bitmap_info_init(bitmap_info_t *binfo, size_t nbits) { binfo->ngroups = BITMAP_BITS2GROUPS(nbits); binfo->nbits = nbits; } +#endif static size_t bitmap_info_ngroups(const bitmap_info_t *binfo) { @@ -115,7 +121,7 @@ bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo, bool fill) { #endif /* BITMAP_USE_TREE */ -size_t +JET_EXTERN size_t bitmap_size(const bitmap_info_t *binfo) { return (bitmap_info_ngroups(binfo) << LG_SIZEOF_BITMAP); } diff --git a/src/buf_writer.c b/src/buf_writer.c index 48b94100..ede9f53e 100644 --- a/src/buf_writer.c +++ b/src/buf_writer.c @@ -68,7 +68,7 @@ buf_writer_init(tsdn_t *tsdn, buf_writer_t *buf_writer, write_cb_t *write_cb, return buf_writer->buf == NULL; } -void +JET_EXTERN void buf_writer_flush(buf_writer_t *buf_writer) { buf_writer_assert(buf_writer); if (buf_writer->buf == NULL) { diff --git a/src/ckh.c b/src/ckh.c index 4c61c060..29d71218 100644 --- a/src/ckh.c +++ b/src/ckh.c @@ -541,6 +541,7 @@ ckh_search(ckh_t *ckh, const void *searchkey, void **key, void **data) { return true; } +#ifdef JEMALLOC_JET void ckh_string_hash(const void *key, size_t r_hash[2]) { hash(key, strlen((const char *)key), 0x94122f33U, r_hash); @@ -570,3 +571,4 @@ bool ckh_pointer_keycomp(const void *k1, const void *k2) { return (k1 == k2); } +#endif diff --git a/src/hpa.c b/src/hpa.c index c7fb0c31..5140a701 100644 --- a/src/hpa.c +++ b/src/hpa.c @@ -14,7 +14,7 @@ const char *const hpa_hugify_style_names[] = {"auto", "none", "eager", "lazy"}; bool opt_experimental_hpa_start_huge_if_thp_always = true; bool opt_experimental_hpa_enforce_hugify = false; -bool +JET_EXTERN bool hpa_hugepage_size_exceeds_limit(void) { return HUGEPAGE > HUGEPAGE_MAX_EXPECTED_SIZE; } diff --git a/src/hpdata.c b/src/hpdata.c index 1da4ffa0..0360c52a 100644 --- a/src/hpdata.c +++ b/src/hpdata.c @@ -46,6 +46,7 @@ ph_gen(, hpdata_age_heap, hpdata_t, age_link, hpdata_age_comp) hpdata_assert_consistent(hpdata); } +#ifdef JEMALLOC_JET void * hpdata_reserve_alloc(hpdata_t *hpdata, size_t sz) { hpdata_assert_consistent(hpdata); @@ -138,6 +139,7 @@ hpdata_reserve_alloc(hpdata_t *hpdata, size_t sz) { return ( void *)((byte_t *)hpdata_addr_get(hpdata) + (result << LG_PAGE)); } +#endif void hpdata_unreserve(hpdata_t *hpdata, void *addr, size_t sz) { diff --git a/src/nstime.c b/src/nstime.c index 3b4810db..585cbfaa 100644 --- a/src/nstime.c +++ b/src/nstime.c @@ -60,11 +60,13 @@ nstime_ns(const nstime_t *time) { return time->ns; } +#ifdef JEMALLOC_JET uint64_t nstime_ms(const nstime_t *time) { nstime_assert_initialized(time); return time->ns / MILLION; } +#endif uint64_t nstime_sec(const nstime_t *time) { @@ -119,6 +121,7 @@ nstime_subtract(nstime_t *time, const nstime_t *subtrahend) { time->ns -= subtrahend->ns; } +#ifdef JEMALLOC_JET void nstime_isubtract(nstime_t *time, uint64_t subtrahend) { nstime_assert_initialized(time); @@ -127,6 +130,7 @@ nstime_isubtract(nstime_t *time, uint64_t subtrahend) { /* No initialize operand -- subtraction must be initialized. */ time->ns -= subtrahend; } +#endif void nstime_imultiply(nstime_t *time, uint64_t multiplier) { diff --git a/src/prof.c b/src/prof.c index 0768c0ba..b1e69fd3 100644 --- a/src/prof.c +++ b/src/prof.c @@ -249,7 +249,7 @@ prof_tctx_create(tsd_t *tsd) { * (e.g. * -mno-sse) in order for the workaround to be complete. */ -uint64_t +JET_EXTERN uint64_t prof_sample_new_event_wait(tsd_t *tsd) { #ifdef JEMALLOC_PROF if (lg_prof_sample == 0) { diff --git a/src/prof_data.c b/src/prof_data.c index d517081c..ab122085 100644 --- a/src/prof_data.c +++ b/src/prof_data.c @@ -404,6 +404,7 @@ prof_lookup(tsd_t *tsd, prof_bt_t *bt) { return ret.p; } +#ifdef JEMALLOC_JET /* Used in unit tests. */ static prof_tdata_t * prof_tdata_count_iter( @@ -449,6 +450,7 @@ prof_bt_count(void) { return bt_count; } +#endif static void prof_thread_name_write_tdata(prof_tdata_t *tdata, const char *thread_name) { @@ -1105,6 +1107,7 @@ prof_dump_impl(tsd_t *tsd, write_cb_t *prof_dump_write, void *cbopaque, } } +#ifdef JEMALLOC_JET /* Used in unit tests. */ void prof_cnt_all(prof_cnt_t *cnt_all) { @@ -1119,6 +1122,7 @@ prof_cnt_all(prof_cnt_t *cnt_all) { prof_gctx_finish(tsd, &gctxs); } } +#endif void prof_bt_hash(const void *key, size_t r_hash[2]) { diff --git a/src/prof_log.c b/src/prof_log.c index 642e87d7..d0f58da3 100644 --- a/src/prof_log.c +++ b/src/prof_log.c @@ -309,6 +309,7 @@ prof_thr_node_keycomp(const void *k1, const void *k2) { return thr_node1->thr_uid == thr_node2->thr_uid; } +#ifdef JEMALLOC_JET /* Used in unit tests. */ size_t prof_log_bt_count(void) { @@ -413,6 +414,7 @@ prof_log_dummy_set(bool new_value) { cassert(config_prof); prof_log_dummy = new_value; } +#endif /* Used as an atexit function to stop logging on exit. */ static void diff --git a/src/prof_recent.c b/src/prof_recent.c index 1b15852c..cddd9794 100644 --- a/src/prof_recent.c +++ b/src/prof_recent.c @@ -108,11 +108,13 @@ prof_recent_alloc_edata_get_no_lock(const prof_recent_t *n) { return (edata_t *)atomic_load_p(&n->alloc_edata, ATOMIC_ACQUIRE); } +#ifdef JEMALLOC_JET edata_t * prof_recent_alloc_edata_get_no_lock_test(const prof_recent_t *n) { cassert(config_prof); return prof_recent_alloc_edata_get_no_lock(n); } +#endif static inline edata_t * prof_recent_alloc_edata_get(tsd_t *tsd, const prof_recent_t *n) { @@ -138,11 +140,13 @@ edata_prof_recent_alloc_get_no_lock(const edata_t *edata) { return edata_prof_recent_alloc_get_dont_call_directly(edata); } +#ifdef JEMALLOC_JET prof_recent_t * edata_prof_recent_alloc_get_no_lock_test(const edata_t *edata) { cassert(config_prof); return edata_prof_recent_alloc_get_no_lock(edata); } +#endif static inline prof_recent_t * edata_prof_recent_alloc_get(tsd_t *tsd, const edata_t *edata) { diff --git a/src/sc.c b/src/sc.c index 014ab95d..0c4d445e 100644 --- a/src/sc.c +++ b/src/sc.c @@ -13,7 +13,7 @@ * at least the damage is compartmentalized to this file. */ -size_t +JET_EXTERN size_t reg_size_compute(int lg_base, int lg_delta, int ndelta) { return (ZU(1) << lg_base) + (ZU(ndelta) << lg_delta); } diff --git a/test/analyze/rand.c b/test/analyze/rand.c index 4c7e18c7..202c25e1 100644 --- a/test/analyze/rand.c +++ b/test/analyze/rand.c @@ -1,5 +1,7 @@ #include "test/jemalloc_test.h" +extern uint64_t prof_sample_new_event_wait(tsd_t *tsd); + /******************************************************************************/ /* diff --git a/test/include/test/hpa.h b/test/include/test/hpa.h new file mode 100644 index 00000000..01cd7237 --- /dev/null +++ b/test/include/test/hpa.h @@ -0,0 +1,10 @@ +#ifndef TEST_HPA_H +#define TEST_HPA_H + +/* + * Static in production builds (JET_EXTERN); exported only for the unit tests + * that share it (hpa_central, psset). + */ +extern bool hpa_hugepage_size_exceeds_limit(void); + +#endif /* TEST_HPA_H */ diff --git a/test/include/test/hpdata.h b/test/include/test/hpdata.h new file mode 100644 index 00000000..1f13b82e --- /dev/null +++ b/test/include/test/hpdata.h @@ -0,0 +1,10 @@ +#ifndef TEST_HPDATA_H +#define TEST_HPDATA_H + +/* + * Static in production builds (JET_EXTERN); exported only for the unit tests + * that share it (hpdata, psset). + */ +extern void *hpdata_reserve_alloc(hpdata_t *hpdata, size_t sz); + +#endif /* TEST_HPDATA_H */ diff --git a/test/include/test/prof_data.h b/test/include/test/prof_data.h new file mode 100644 index 00000000..f913ed71 --- /dev/null +++ b/test/include/test/prof_data.h @@ -0,0 +1,12 @@ +#ifndef TEST_PROF_DATA_H +#define TEST_PROF_DATA_H + +/* + * Static in production builds (#ifdef JEMALLOC_JET); exported only for the unit + * tests that share them (prof_reset, prof_accum, prof_active, prof_tctx). + */ +extern size_t prof_tdata_count(void); +extern size_t prof_bt_count(void); +extern void prof_cnt_all(prof_cnt_t *cnt_all); + +#endif /* TEST_PROF_DATA_H */ diff --git a/test/unit/base.c b/test/unit/base.c index e6e82435..de5090d3 100644 --- a/test/unit/base.c +++ b/test/unit/base.c @@ -2,6 +2,8 @@ #include "test/extent_hooks.h" +extern ehooks_t *base_ehooks_get_for_metadata(base_t *base); + static extent_hooks_t hooks_null = { extent_alloc_hook, NULL, /* dalloc */ NULL, /* destroy */ diff --git a/test/unit/bin.c b/test/unit/bin.c index a7091544..e2db1dfb 100644 --- a/test/unit/bin.c +++ b/test/unit/bin.c @@ -2,6 +2,15 @@ extern void bin_dalloc_locked_begin( bin_dalloc_locked_info_t *info, szind_t binind); +extern void *bin_slab_reg_alloc(edata_t *slab, const bin_info_t *bin_info); +extern void bin_slabs_nonfull_insert(bin_t *bin, edata_t *slab); +extern void bin_slabs_nonfull_remove(bin_t *bin, edata_t *slab); +extern edata_t *bin_slabs_nonfull_tryget(bin_t *bin); +extern void bin_slabs_full_insert(bool is_auto, bin_t *bin, edata_t *slab); +extern void bin_dissociate_slab(bool is_auto, edata_t *slab, bin_t *bin); +extern void bin_lower_slab( + tsdn_t *tsdn, bool is_auto, edata_t *slab, bin_t *bin); +extern void bin_dalloc_slab_prepare(tsdn_t *tsdn, edata_t *slab, bin_t *bin); #define INVALID_ARENA_IND ((1U << MALLOCX_ARENA_BITS) - 1) diff --git a/test/unit/bitmap.c b/test/unit/bitmap.c index b3048cf3..7e26ee5e 100644 --- a/test/unit/bitmap.c +++ b/test/unit/bitmap.c @@ -2,6 +2,9 @@ #include "test/nbits.h" +extern void bitmap_info_init(bitmap_info_t *binfo, size_t nbits); +extern size_t bitmap_size(const bitmap_info_t *binfo); + static void test_bitmap_initializer_body(const bitmap_info_t *binfo, size_t nbits) { bitmap_info_t binfo_dyn; diff --git a/test/unit/buf_writer.c b/test/unit/buf_writer.c index 643e430c..8667919b 100644 --- a/test/unit/buf_writer.c +++ b/test/unit/buf_writer.c @@ -2,6 +2,8 @@ #include "jemalloc/internal/buf_writer.h" +extern void buf_writer_flush(buf_writer_t *buf_writer); + #define TEST_BUF_SIZE 16 #define UNIT_MAX (TEST_BUF_SIZE * 3) diff --git a/test/unit/ckh.c b/test/unit/ckh.c index f07892ac..63c8edf0 100644 --- a/test/unit/ckh.c +++ b/test/unit/ckh.c @@ -1,5 +1,10 @@ #include "test/jemalloc_test.h" +extern void ckh_string_hash(const void *key, size_t r_hash[2]); +extern bool ckh_string_keycomp(const void *k1, const void *k2); +extern void ckh_pointer_hash(const void *key, size_t r_hash[2]); +extern bool ckh_pointer_keycomp(const void *k1, const void *k2); + TEST_BEGIN(test_new_delete) { tsd_t *tsd; ckh_t ckh; diff --git a/test/unit/hpa_central.c b/test/unit/hpa_central.c index e50bb1df..7bdd2bd8 100644 --- a/test/unit/hpa_central.c +++ b/test/unit/hpa_central.c @@ -1,5 +1,7 @@ #include "test/jemalloc_test.h" +#include "test/hpa.h" + #include "jemalloc/internal/hpa.h" #include "jemalloc/internal/hpa_central.h" diff --git a/test/unit/hpdata.c b/test/unit/hpdata.c index ac45d697..407f991e 100644 --- a/test/unit/hpdata.c +++ b/test/unit/hpdata.c @@ -1,5 +1,7 @@ #include "test/jemalloc_test.h" +#include "test/hpdata.h" + #define HPDATA_ADDR ((void *)(10 * HUGEPAGE)) #define HPDATA_AGE 123 diff --git a/test/unit/nstime.c b/test/unit/nstime.c index 8c095d09..efd27ac5 100644 --- a/test/unit/nstime.c +++ b/test/unit/nstime.c @@ -1,5 +1,8 @@ #include "test/jemalloc_test.h" +extern uint64_t nstime_ms(const nstime_t *time); +extern void nstime_isubtract(nstime_t *time, uint64_t subtrahend); + #define BILLION UINT64_C(1000000000) TEST_BEGIN(test_nstime_init) { diff --git a/test/unit/prof_accum.c b/test/unit/prof_accum.c index 940468b9..3bdee44d 100644 --- a/test/unit/prof_accum.c +++ b/test/unit/prof_accum.c @@ -1,5 +1,6 @@ #include "test/jemalloc_test.h" +#include "test/prof_data.h" #include "jemalloc/internal/prof_data.h" #include "jemalloc/internal/prof_sys.h" diff --git a/test/unit/prof_active.c b/test/unit/prof_active.c index fc8b150b..ee78454f 100644 --- a/test/unit/prof_active.c +++ b/test/unit/prof_active.c @@ -1,5 +1,6 @@ #include "test/jemalloc_test.h" +#include "test/prof_data.h" #include "jemalloc/internal/prof_data.h" static void diff --git a/test/unit/prof_log.c b/test/unit/prof_log.c index 8cfc19ff..148e71ea 100644 --- a/test/unit/prof_log.c +++ b/test/unit/prof_log.c @@ -1,6 +1,13 @@ #include "test/jemalloc_test.h" #include "jemalloc/internal/prof_log.h" +extern size_t prof_log_bt_count(void); +extern size_t prof_log_alloc_count(void); +extern size_t prof_log_thr_count(void); +extern bool prof_log_is_logging(void); +extern bool prof_log_rep_check(void); +extern void prof_log_dummy_set(bool new_value); + #define N_PARAM 100 #define N_THREADS 10 diff --git a/test/unit/prof_recent.c b/test/unit/prof_recent.c index b8fd0ca8..a0a10f74 100644 --- a/test/unit/prof_recent.c +++ b/test/unit/prof_recent.c @@ -2,6 +2,11 @@ #include "jemalloc/internal/prof_recent.h" +extern edata_t *prof_recent_alloc_edata_get_no_lock_test( + const prof_recent_t *node); +extern prof_recent_t *edata_prof_recent_alloc_get_no_lock_test( + const edata_t *edata); + /* As specified in the shell script */ #define OPT_ALLOC_MAX 3 diff --git a/test/unit/prof_reset.c b/test/unit/prof_reset.c index 0e64279e..25582752 100644 --- a/test/unit/prof_reset.c +++ b/test/unit/prof_reset.c @@ -1,5 +1,6 @@ #include "test/jemalloc_test.h" +#include "test/prof_data.h" #include "jemalloc/internal/prof_data.h" #include "jemalloc/internal/prof_sys.h" diff --git a/test/unit/prof_tctx.c b/test/unit/prof_tctx.c index 7fde7230..b47d1b27 100644 --- a/test/unit/prof_tctx.c +++ b/test/unit/prof_tctx.c @@ -1,5 +1,6 @@ #include "test/jemalloc_test.h" +#include "test/prof_data.h" #include "jemalloc/internal/prof_data.h" TEST_BEGIN(test_prof_realloc) { diff --git a/test/unit/psset.c b/test/unit/psset.c index 6ad653f5..091ddf4f 100644 --- a/test/unit/psset.c +++ b/test/unit/psset.c @@ -1,5 +1,8 @@ #include "test/jemalloc_test.h" +#include "test/hpa.h" +#include "test/hpdata.h" + #include "jemalloc/internal/psset.h" #define PAGESLAB_ADDR ((void *)(1234 * HUGEPAGE)) diff --git a/test/unit/sz.c b/test/unit/sz.c index fa2b8dc0..87b5d417 100644 --- a/test/unit/sz.c +++ b/test/unit/sz.c @@ -1,5 +1,7 @@ #include "test/jemalloc_test.h" +extern size_t reg_size_compute(int lg_base, int lg_delta, int ndelta); + TEST_BEGIN(test_sz_psz2ind) { /* * Testing page size classes which reside prior to the regular group