Push down iealloc() calls.

Call iealloc() as deep into call chains as possible without causing
redundant calls.
This commit is contained in:
Jason Evans
2017-03-20 11:00:07 -07:00
parent 51a2ec92a1
commit 5e67fbc367
9 changed files with 176 additions and 227 deletions

View File

@@ -4,7 +4,6 @@ TEST_BEGIN(test_prof_realloc) {
tsdn_t *tsdn;
int flags;
void *p, *q;
extent_t *extent_p, *extent_q;
prof_tctx_t *tctx_p, *tctx_q;
uint64_t curobjs_0, curobjs_1, curobjs_2, curobjs_3;
@@ -16,9 +15,7 @@ TEST_BEGIN(test_prof_realloc) {
prof_cnt_all(&curobjs_0, NULL, NULL, NULL);
p = mallocx(1024, flags);
assert_ptr_not_null(p, "Unexpected mallocx() failure");
extent_p = iealloc(tsdn, p);
assert_ptr_not_null(extent_p, "Unexpected iealloc() failure");
tctx_p = prof_tctx_get(tsdn, extent_p, p);
tctx_p = prof_tctx_get(tsdn, p);
assert_ptr_ne(tctx_p, (prof_tctx_t *)(uintptr_t)1U,
"Expected valid tctx");
prof_cnt_all(&curobjs_1, NULL, NULL, NULL);
@@ -28,9 +25,7 @@ TEST_BEGIN(test_prof_realloc) {
q = rallocx(p, 2048, flags);
assert_ptr_ne(p, q, "Expected move");
assert_ptr_not_null(p, "Unexpected rmallocx() failure");
extent_q = iealloc(tsdn, q);
assert_ptr_not_null(extent_q, "Unexpected iealloc() failure");
tctx_q = prof_tctx_get(tsdn, extent_q, q);
tctx_q = prof_tctx_get(tsdn, q);
assert_ptr_ne(tctx_q, (prof_tctx_t *)(uintptr_t)1U,
"Expected valid tctx");
prof_cnt_all(&curobjs_2, NULL, NULL, NULL);