summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-04-17 23:16:11 (GMT)
committerJason Evans <jasone@canonware.com>2016-05-13 17:31:54 (GMT)
commit226c446979ba88b5d5f05e6442c024d95c5656b0 (patch)
tree989c628d7a8256acbe6ef633b65938f7f78543aa /src
parent627372b459479bf8908470ba25e832c4a9a420db (diff)
downloadjemalloc-226c446979ba88b5d5f05e6442c024d95c5656b0.zip
jemalloc-226c446979ba88b5d5f05e6442c024d95c5656b0.tar.gz
jemalloc-226c446979ba88b5d5f05e6442c024d95c5656b0.tar.bz2
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.c5
-rw-r--r--src/jemalloc.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/arena.c b/src/arena.c
index 7b9f313..ff119ba 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -19,7 +19,8 @@ const arena_bin_info_t arena_bin_info[NBINS] = {
#define BIN_INFO_bin_yes(reg_size, run_size, nregs) \
{reg_size, run_size, nregs, BITMAP_INFO_INITIALIZER(nregs)},
#define BIN_INFO_bin_no(reg_size, run_size, nregs)
-#define SC(index, lg_grp, lg_delta, ndelta, bin, pgs, lg_delta_lookup) \
+#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, \
+ lg_delta_lookup) \
BIN_INFO_bin_##bin((1U<<lg_grp) + (ndelta<<lg_delta), \
(pgs << LG_PAGE), (pgs << LG_PAGE) / ((1U<<lg_grp) + \
(ndelta<<lg_delta)))
@@ -3511,7 +3512,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, run_size, \
+#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, run_size, \
lg_delta_lookup) \
TAB_INIT_bin_##bin(index, (ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta))
SIZE_CLASSES
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 4eec09b..b907d9e 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -81,7 +81,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, pgs, lg_delta_lookup) \
+#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup) \
((ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta)),
SIZE_CLASSES
#undef SC
@@ -154,7 +154,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, pgs, lg_delta_lookup) \
+#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, pgs, lg_delta_lookup) \
S2B_##lg_delta_lookup(index)
SIZE_CLASSES
#undef S2B_3