aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-04-17 16:16:11 -0700
committerJason Evans <jasone@canonware.com>2016-10-04 16:29:19 -0700
commit1abb49f09d98e265ad92a831a056ccdfb4cf6041 (patch)
tree8a63c667a262c49b240dc1a7a23dacd88be3012f /src
parentbcd5424b1c5361534b3c535326d0b87f223a42e1 (diff)
downloadjemalloc-1abb49f09d98e265ad92a831a056ccdfb4cf6041.tar.gz
Implement pz2ind(), pind2sz(), and psz2u().
These compute size classes and indices similarly to size2index(), index2size() and s2u(), respectively, but using the subset of size classes that are multiples of the page size. Note that pszind_t and szind_t are not interchangeable.
Diffstat (limited to 'src')
-rw-r--r--src/arena.c4
-rw-r--r--src/jemalloc.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/arena.c b/src/arena.c
index ce62590..a28c077 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -3711,7 +3711,7 @@ bin_info_init(void)
bin_info_run_size_calc(bin_info); \
bitmap_info_init(&bin_info->bitmap_info, bin_info->nregs);
#define BIN_INFO_INIT_bin_no(index, size)
-#define SC(index, lg_grp, lg_delta, ndelta, bin, lg_delta_lookup) \
+#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup) \
BIN_INFO_INIT_bin_##bin(index, (ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta))
SIZE_CLASSES
#undef BIN_INFO_INIT_bin_yes
@@ -3735,7 +3735,7 @@ small_run_size_init(void)
small_run_tab[bin_info->run_size >> LG_PAGE] = true; \
}
#define TAB_INIT_bin_no(index, size)
-#define SC(index, lg_grp, lg_delta, ndelta, bin, lg_delta_lookup) \
+#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup) \
TAB_INIT_bin_##bin(index, (ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta))
SIZE_CLASSES
#undef TAB_INIT_bin_yes
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 0d776b6..4645783 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -88,7 +88,7 @@ static uint8_t malloc_slow_flags;
/* Last entry for overflow detection only. */
JEMALLOC_ALIGNED(CACHELINE)
const size_t index2size_tab[NSIZES+1] = {
-#define SC(index, lg_grp, lg_delta, ndelta, bin, lg_delta_lookup) \
+#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup) \
((ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta)),
SIZE_CLASSES
#undef SC
@@ -161,7 +161,7 @@ const uint8_t size2index_tab[] = {
#define S2B_11(i) S2B_10(i) S2B_10(i)
#endif
#define S2B_no(i)
-#define SC(index, lg_grp, lg_delta, ndelta, bin, lg_delta_lookup) \
+#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup) \
S2B_##lg_delta_lookup(index)
SIZE_CLASSES
#undef S2B_3