summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/jemalloc_internal.h.in22
-rw-r--r--include/jemalloc/internal/private_symbols.txt2
2 files changed, 21 insertions, 3 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in
index 086726d..ba8a929 100644
--- a/include/jemalloc/internal/jemalloc_internal.h.in
+++ b/include/jemalloc/internal/jemalloc_internal.h.in
@@ -516,7 +516,9 @@ void jemalloc_postfork_child(void);
#include "jemalloc/internal/large.h"
#ifndef JEMALLOC_ENABLE_INLINE
+pszind_t psz2ind_impl(size_t psz, bool clamp);
pszind_t psz2ind(size_t psz);
+pszind_t psz2ind_clamp(size_t psz);
size_t pind2sz_compute(pszind_t pind);
size_t pind2sz_lookup(pszind_t pind);
size_t pind2sz(pszind_t pind);
@@ -541,12 +543,12 @@ ticker_t *decay_ticker_get(tsd_t *tsd, unsigned ind);
#endif
#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_))
-JEMALLOC_INLINE pszind_t
-psz2ind(size_t psz)
+JEMALLOC_ALWAYS_INLINE pszind_t
+psz2ind_impl(size_t psz, bool clamp)
{
if (unlikely(psz > LARGE_MAXCLASS))
- return (NPSIZES);
+ return (clamp ? NPSIZES-1 : NPSIZES);
{
pszind_t x = lg_floor((psz<<1)-1);
pszind_t shift = (x < LG_SIZE_CLASS_GROUP + LG_PAGE) ? 0 : x -
@@ -565,6 +567,20 @@ psz2ind(size_t psz)
}
}
+JEMALLOC_INLINE pszind_t
+psz2ind(size_t psz)
+{
+
+ return (psz2ind_impl(psz, false));
+}
+
+JEMALLOC_INLINE pszind_t
+psz2ind_clamp(size_t psz)
+{
+
+ return (psz2ind_impl(psz, true));
+}
+
JEMALLOC_INLINE size_t
pind2sz_compute(pszind_t pind)
{
diff --git a/include/jemalloc/internal/private_symbols.txt b/include/jemalloc/internal/private_symbols.txt
index ae60f6c..d633272 100644
--- a/include/jemalloc/internal/private_symbols.txt
+++ b/include/jemalloc/internal/private_symbols.txt
@@ -395,6 +395,8 @@ prof_thread_active_set
prof_thread_name_get
prof_thread_name_set
psz2ind
+psz2ind_clamp
+psz2ind_impl
psz2u
purge_mode_names
register_zone