aboutsummaryrefslogtreecommitdiff
path: root/include/jemalloc/internal/prof.h
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2014-09-11 16:20:44 -0700
committerJason Evans <jasone@canonware.com>2014-09-11 17:01:58 -0700
commit9c640bfdd4e2f25180a32ed3704ce8e4c4cc21f1 (patch)
treece8b8deb1f978bff03556ffc3c7912677c72e30a /include/jemalloc/internal/prof.h
parent91566fc079cfaeaf2b424b7f40d6b9d8669d0470 (diff)
downloadjemalloc-9c640bfdd4e2f25180a32ed3704ce8e4c4cc21f1.tar.gz
Apply likely()/unlikely() to allocation/deallocation fast paths.
Diffstat (limited to 'include/jemalloc/internal/prof.h')
-rw-r--r--include/jemalloc/internal/prof.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/jemalloc/internal/prof.h b/include/jemalloc/internal/prof.h
index 920ec63..a1e7ac5 100644
--- a/include/jemalloc/internal/prof.h
+++ b/include/jemalloc/internal/prof.h
@@ -400,7 +400,8 @@ prof_alloc_prep(size_t usize, bool update)
assert(usize == s2u(usize));
- if (!opt_prof_active || prof_sample_accum_update(usize, update, &tdata))
+ if (!opt_prof_active || likely(prof_sample_accum_update(usize, update,
+ &tdata)))
ret = (prof_tctx_t *)(uintptr_t)1U;
else {
bt_init(&bt, tdata->vec);
@@ -419,7 +420,7 @@ prof_malloc(const void *ptr, size_t usize, prof_tctx_t *tctx)
assert(ptr != NULL);
assert(usize == isalloc(ptr, true));
- if ((uintptr_t)tctx > (uintptr_t)1U)
+ if (unlikely((uintptr_t)tctx > (uintptr_t)1U))
prof_malloc_sample_object(ptr, usize, tctx);
else
prof_tctx_set(ptr, (prof_tctx_t *)(uintptr_t)1U);
@@ -447,9 +448,9 @@ prof_realloc(const void *ptr, size_t usize, prof_tctx_t *tctx, bool updated,
}
}
- if ((uintptr_t)old_tctx > (uintptr_t)1U)
+ if (unlikely((uintptr_t)old_tctx > (uintptr_t)1U))
prof_free_sampled_object(old_usize, old_tctx);
- if ((uintptr_t)tctx > (uintptr_t)1U)
+ if (unlikely((uintptr_t)tctx > (uintptr_t)1U))
prof_malloc_sample_object(ptr, usize, tctx);
else
prof_tctx_set(ptr, (prof_tctx_t *)(uintptr_t)1U);
@@ -463,7 +464,7 @@ prof_free(const void *ptr, size_t usize)
cassert(config_prof);
assert(usize == isalloc(ptr, true));
- if ((uintptr_t)tctx > (uintptr_t)1U)
+ if (unlikely((uintptr_t)tctx > (uintptr_t)1U))
prof_free_sampled_object(usize, tctx);
}
#endif