From aa1d71fb7ab34ce96743753f08a761747b5449c8 Mon Sep 17 00:00:00 2001 From: Yinan Zhang Date: Thu, 5 Dec 2019 15:35:12 -0800 Subject: [PATCH] Rename prof_tctx to alloc_tctx in prof_info_t --- include/jemalloc/internal/arena_inlines_b.h | 2 +- include/jemalloc/internal/extent.h | 2 +- include/jemalloc/internal/prof_inlines_b.h | 6 +++--- include/jemalloc/internal/prof_structs.h | 2 +- src/prof.c | 2 +- src/prof_log.c | 2 +- test/unit/prof_tctx.c | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/jemalloc/internal/arena_inlines_b.h b/include/jemalloc/internal/arena_inlines_b.h index fb25c8f8..930daba0 100644 --- a/include/jemalloc/internal/arena_inlines_b.h +++ b/include/jemalloc/internal/arena_inlines_b.h @@ -63,7 +63,7 @@ arena_prof_info_get(tsd_t *tsd, const void *ptr, alloc_ctx_t *alloc_ctx, large_prof_info_get(extent, prof_info); } else { memset(prof_info, 0, sizeof(prof_info_t)); - prof_info->prof_tctx = (prof_tctx_t *)(uintptr_t)1U; + prof_info->alloc_tctx = (prof_tctx_t *)(uintptr_t)1U; } } diff --git a/include/jemalloc/internal/extent.h b/include/jemalloc/internal/extent.h index c47beafd..3a20540d 100644 --- a/include/jemalloc/internal/extent.h +++ b/include/jemalloc/internal/extent.h @@ -336,7 +336,7 @@ extent_slab_data_get_const(const extent_t *extent) { static inline void extent_prof_info_get(const extent_t *extent, prof_info_t *prof_info) { assert(prof_info != NULL); - prof_info->prof_tctx = (prof_tctx_t *)atomic_load_p( + prof_info->alloc_tctx = (prof_tctx_t *)atomic_load_p( &extent->e_prof_tctx, ATOMIC_ACQUIRE); prof_info->alloc_time = extent->e_alloc_time; } diff --git a/include/jemalloc/internal/prof_inlines_b.h b/include/jemalloc/internal/prof_inlines_b.h index 06689c8a..3c0594ef 100644 --- a/include/jemalloc/internal/prof_inlines_b.h +++ b/include/jemalloc/internal/prof_inlines_b.h @@ -168,7 +168,7 @@ prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx, } sampled = ((uintptr_t)tctx > (uintptr_t)1U); - old_sampled = ((uintptr_t)old_prof_info->prof_tctx > (uintptr_t)1U); + old_sampled = ((uintptr_t)old_prof_info->alloc_tctx > (uintptr_t)1U); moved = (ptr != old_ptr); if (unlikely(sampled)) { @@ -186,7 +186,7 @@ prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx, } else { prof_info_t prof_info; prof_info_get(tsd, ptr, NULL, &prof_info); - assert((uintptr_t)prof_info.prof_tctx == (uintptr_t)1U); + assert((uintptr_t)prof_info.alloc_tctx == (uintptr_t)1U); } /* @@ -209,7 +209,7 @@ prof_free(tsd_t *tsd, const void *ptr, size_t usize, alloc_ctx_t *alloc_ctx) { cassert(config_prof); assert(usize == isalloc(tsd_tsdn(tsd), ptr)); - if (unlikely((uintptr_t)prof_info.prof_tctx > (uintptr_t)1U)) { + if (unlikely((uintptr_t)prof_info.alloc_tctx > (uintptr_t)1U)) { prof_free_sampled_object(tsd, usize, &prof_info); } } diff --git a/include/jemalloc/internal/prof_structs.h b/include/jemalloc/internal/prof_structs.h index 17a56508..6223adc8 100644 --- a/include/jemalloc/internal/prof_structs.h +++ b/include/jemalloc/internal/prof_structs.h @@ -98,7 +98,7 @@ typedef rb_tree(prof_tctx_t) prof_tctx_tree_t; struct prof_info_s { /* Points to the prof_tctx_t corresponding to the allocation. */ - prof_tctx_t *prof_tctx; + prof_tctx_t *alloc_tctx; /* Time when the allocation was made. */ nstime_t alloc_time; }; diff --git a/src/prof.c b/src/prof.c index d0c06a8a..3be461bc 100644 --- a/src/prof.c +++ b/src/prof.c @@ -204,7 +204,7 @@ prof_malloc_sample_object(tsd_t *tsd, const void *ptr, size_t usize, void prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_info_t *prof_info) { assert(prof_info != NULL); - prof_tctx_t *tctx = prof_info->prof_tctx; + prof_tctx_t *tctx = prof_info->alloc_tctx; assert((uintptr_t)tctx > (uintptr_t)1U); malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock); diff --git a/src/prof_log.c b/src/prof_log.c index 5747c8db..b5879348 100644 --- a/src/prof_log.c +++ b/src/prof_log.c @@ -200,7 +200,7 @@ prof_log_thr_index(tsd_t *tsd, uint64_t thr_uid, const char *name) { void prof_try_log(tsd_t *tsd, size_t usize, prof_info_t *prof_info) { - prof_tctx_t *tctx = prof_info->prof_tctx; + prof_tctx_t *tctx = prof_info->alloc_tctx; malloc_mutex_assert_owner(tsd_tsdn(tsd), tctx->tdata->lock); prof_tdata_t *cons_tdata = prof_tdata_get(tsd, false); diff --git a/test/unit/prof_tctx.c b/test/unit/prof_tctx.c index 4e775452..4dde0ab2 100644 --- a/test/unit/prof_tctx.c +++ b/test/unit/prof_tctx.c @@ -16,7 +16,7 @@ TEST_BEGIN(test_prof_realloc) { p = mallocx(1024, flags); assert_ptr_not_null(p, "Unexpected mallocx() failure"); prof_info_get(tsd, p, NULL, &prof_info_p); - assert_ptr_ne(prof_info_p.prof_tctx, (prof_tctx_t *)(uintptr_t)1U, + assert_ptr_ne(prof_info_p.alloc_tctx, (prof_tctx_t *)(uintptr_t)1U, "Expected valid tctx"); prof_cnt_all(&curobjs_1, NULL, NULL, NULL); assert_u64_eq(curobjs_0 + 1, curobjs_1, @@ -26,7 +26,7 @@ TEST_BEGIN(test_prof_realloc) { assert_ptr_ne(p, q, "Expected move"); assert_ptr_not_null(p, "Unexpected rmallocx() failure"); prof_info_get(tsd, q, NULL, &prof_info_q); - assert_ptr_ne(prof_info_q.prof_tctx, (prof_tctx_t *)(uintptr_t)1U, + assert_ptr_ne(prof_info_q.alloc_tctx, (prof_tctx_t *)(uintptr_t)1U, "Expected valid tctx"); prof_cnt_all(&curobjs_2, NULL, NULL, NULL); assert_u64_eq(curobjs_1, curobjs_2,