summaryrefslogtreecommitdiff
path: root/test/unit/slab.c
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2022-05-06 11:28:25 -0700
committerQi Wang <interwq@gwu.edu>2022-05-06 11:28:25 -0700
commit54eaed1d8b56b1aa528be3bdd1877e59c56fa90c (patch)
treee79620e0c00b1f8b6b698fbe74df6bae7d812ae2 /test/unit/slab.c
parentea6b3e973b477b8061e0076bb257dbd7f3faa756 (diff)
parent304c919829f9f340669b61fa64867cfe5dba8021 (diff)
downloadjemalloc-master.tar.gz
Merge branch 'dev'5.3.0master
Diffstat (limited to 'test/unit/slab.c')
-rw-r--r--test/unit/slab.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/test/unit/slab.c b/test/unit/slab.c
index c56af25f..70fc5c7d 100644
--- a/test/unit/slab.c
+++ b/test/unit/slab.c
@@ -1,27 +1,33 @@
#include "test/jemalloc_test.h"
+#define INVALID_ARENA_IND ((1U << MALLOCX_ARENA_BITS) - 1)
+
TEST_BEGIN(test_arena_slab_regind) {
szind_t binind;
for (binind = 0; binind < SC_NBINS; binind++) {
size_t regind;
- extent_t slab;
+ edata_t slab;
const bin_info_t *bin_info = &bin_infos[binind];
- extent_init(&slab, NULL, mallocx(bin_info->slab_size,
- MALLOCX_LG_ALIGN(LG_PAGE)), bin_info->slab_size, true,
- binind, 0, extent_state_active, false, true, true,
+ edata_init(&slab, INVALID_ARENA_IND,
+ mallocx(bin_info->slab_size, MALLOCX_LG_ALIGN(LG_PAGE)),
+ bin_info->slab_size, true,
+ binind, 0, extent_state_active, false, true, EXTENT_PAI_PAC,
EXTENT_NOT_HEAD);
- assert_ptr_not_null(extent_addr_get(&slab),
+ expect_ptr_not_null(edata_addr_get(&slab),
"Unexpected malloc() failure");
+ arena_dalloc_bin_locked_info_t dalloc_info;
+ arena_dalloc_bin_locked_begin(&dalloc_info, binind);
for (regind = 0; regind < bin_info->nregs; regind++) {
- void *reg = (void *)((uintptr_t)extent_addr_get(&slab) +
+ void *reg = (void *)((uintptr_t)edata_addr_get(&slab) +
(bin_info->reg_size * regind));
- assert_zu_eq(arena_slab_regind(&slab, binind, reg),
+ expect_zu_eq(arena_slab_regind(&dalloc_info, binind,
+ &slab, reg),
regind,
"Incorrect region index computed for size %zu",
bin_info->reg_size);
}
- free(extent_addr_get(&slab));
+ free(edata_addr_get(&slab));
}
}
TEST_END