Store ncached_max * ptr_size in tcache_bin_info.

With the cache bin metadata switched to pointers, ncached_max is usually
accessed and timed by sizeof(ptr). Store the results in tcache_bin_info for
direct access, and add a helper function for the ncached_max value.
This commit is contained in:
Qi Wang
2019-08-14 13:08:06 -07:00
committed by Qi Wang
parent 7599c82d48
commit 937ca1db9f
5 changed files with 45 additions and 41 deletions

View File

@@ -10,7 +10,7 @@ TEST_BEGIN(test_cache_bin) {
assert_ptr_not_null(stack, "Unexpected mallocx failure");
/* Initialize to empty; bin 0. */
cache_bin_sz_t ncached_max = tcache_bin_info[0].ncached_max;
cache_bin_sz_t ncached_max = cache_bin_ncached_max_get(0);
void **empty_position = stack + ncached_max;
bin->cur_ptr.ptr = empty_position;
bin->low_water_position = bin->cur_ptr.lowbits;