mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 13:53:11 +00:00
Remove cache bin dead stores
This commit is contained in:
@@ -523,14 +523,13 @@ cache_bin_stash(cache_bin_t *bin, void *ptr) {
|
|||||||
/* Get the number of stashed pointers. */
|
/* Get the number of stashed pointers. */
|
||||||
JEMALLOC_ALWAYS_INLINE cache_bin_sz_t
|
JEMALLOC_ALWAYS_INLINE cache_bin_sz_t
|
||||||
cache_bin_nstashed_get_internal(cache_bin_t *bin) {
|
cache_bin_nstashed_get_internal(cache_bin_t *bin) {
|
||||||
cache_bin_sz_t ncached_max = cache_bin_ncached_max_get(bin);
|
|
||||||
cache_bin_sz_t low_bits_low_bound = cache_bin_low_bits_low_bound_get(
|
cache_bin_sz_t low_bits_low_bound = cache_bin_low_bits_low_bound_get(
|
||||||
bin);
|
bin);
|
||||||
|
|
||||||
cache_bin_sz_t n = cache_bin_diff(
|
cache_bin_sz_t n = cache_bin_diff(
|
||||||
bin, low_bits_low_bound, bin->low_bits_full)
|
bin, low_bits_low_bound, bin->low_bits_full)
|
||||||
/ sizeof(void *);
|
/ sizeof(void *);
|
||||||
assert(n <= ncached_max);
|
assert(n <= cache_bin_ncached_max_get(bin));
|
||||||
if (config_debug && n != 0) {
|
if (config_debug && n != 0) {
|
||||||
/* Below are for assertions only. */
|
/* Below are for assertions only. */
|
||||||
void **low_bound = cache_bin_low_bound_get(bin);
|
void **low_bound = cache_bin_low_bound_get(bin);
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ const uintptr_t disabled_bin = JUNK_ADDR;
|
|||||||
void
|
void
|
||||||
cache_bin_info_init(cache_bin_info_t *info, cache_bin_sz_t ncached_max) {
|
cache_bin_info_init(cache_bin_info_t *info, cache_bin_sz_t ncached_max) {
|
||||||
assert(ncached_max <= CACHE_BIN_NCACHED_MAX);
|
assert(ncached_max <= CACHE_BIN_NCACHED_MAX);
|
||||||
size_t stack_size = (size_t)ncached_max * sizeof(void *);
|
assert((size_t)ncached_max * sizeof(void *)
|
||||||
assert(stack_size < ((size_t)1 << (sizeof(cache_bin_sz_t) * 8)));
|
< ((size_t)1 << (sizeof(cache_bin_sz_t) * 8)));
|
||||||
info->ncached_max = (cache_bin_sz_t)ncached_max;
|
info->ncached_max = (cache_bin_sz_t)ncached_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,9 +94,8 @@ cache_bin_init(cache_bin_t *bin, const cache_bin_info_t *info, void *alloc,
|
|||||||
bin->low_bits_full = (cache_bin_sz_t)(uintptr_t)full_position;
|
bin->low_bits_full = (cache_bin_sz_t)(uintptr_t)full_position;
|
||||||
bin->low_bits_empty = (cache_bin_sz_t)(uintptr_t)empty_position;
|
bin->low_bits_empty = (cache_bin_sz_t)(uintptr_t)empty_position;
|
||||||
cache_bin_info_init(&bin->bin_info, info->ncached_max);
|
cache_bin_info_init(&bin->bin_info, info->ncached_max);
|
||||||
cache_bin_sz_t free_spots = cache_bin_diff(bin, bin->low_bits_full,
|
assert(cache_bin_diff(bin, bin->low_bits_full,
|
||||||
(cache_bin_sz_t)(uintptr_t)bin->stack_head);
|
(cache_bin_sz_t)(uintptr_t)bin->stack_head) == bin_stack_size);
|
||||||
assert(free_spots == bin_stack_size);
|
|
||||||
if (!cache_bin_disabled(bin)) {
|
if (!cache_bin_disabled(bin)) {
|
||||||
assert(cache_bin_ncached_get_local(bin) == 0);
|
assert(cache_bin_ncached_get_local(bin) == 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user