mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-05-04 19:09:57 +03:00
Reformat the codebase with the clang-format 18.
This commit is contained in:
parent
a952a3b8b0
commit
6200e8987f
346 changed files with 18286 additions and 17770 deletions
|
|
@ -8,8 +8,7 @@
|
|||
const uintptr_t disabled_bin = JUNK_ADDR;
|
||||
|
||||
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);
|
||||
size_t stack_size = (size_t)ncached_max * sizeof(void *);
|
||||
assert(stack_size < ((size_t)1 << (sizeof(cache_bin_sz_t) * 8)));
|
||||
|
|
@ -51,27 +50,26 @@ cache_bin_info_compute_alloc(const cache_bin_info_t *infos, szind_t ninfos,
|
|||
}
|
||||
|
||||
void
|
||||
cache_bin_preincrement(const cache_bin_info_t *infos, szind_t ninfos, void *alloc,
|
||||
size_t *cur_offset) {
|
||||
cache_bin_preincrement(const cache_bin_info_t *infos, szind_t ninfos,
|
||||
void *alloc, size_t *cur_offset) {
|
||||
if (config_debug) {
|
||||
size_t computed_size;
|
||||
size_t computed_alignment;
|
||||
|
||||
/* Pointer should be as aligned as we asked for. */
|
||||
cache_bin_info_compute_alloc(infos, ninfos, &computed_size,
|
||||
&computed_alignment);
|
||||
cache_bin_info_compute_alloc(
|
||||
infos, ninfos, &computed_size, &computed_alignment);
|
||||
assert(((uintptr_t)alloc & (computed_alignment - 1)) == 0);
|
||||
}
|
||||
|
||||
*(uintptr_t *)((byte_t *)alloc + *cur_offset) =
|
||||
cache_bin_preceding_junk;
|
||||
*(uintptr_t *)((byte_t *)alloc
|
||||
+ *cur_offset) = cache_bin_preceding_junk;
|
||||
*cur_offset += sizeof(void *);
|
||||
}
|
||||
|
||||
void
|
||||
cache_bin_postincrement(void *alloc, size_t *cur_offset) {
|
||||
*(uintptr_t *)((byte_t *)alloc + *cur_offset) =
|
||||
cache_bin_trailing_junk;
|
||||
*(uintptr_t *)((byte_t *)alloc + *cur_offset) = cache_bin_trailing_junk;
|
||||
*cur_offset += sizeof(void *);
|
||||
}
|
||||
|
||||
|
|
@ -83,8 +81,8 @@ cache_bin_init(cache_bin_t *bin, const cache_bin_info_t *info, void *alloc,
|
|||
* will access the slots toward higher addresses (for the benefit of
|
||||
* adjacent prefetch).
|
||||
*/
|
||||
void *stack_cur = (void *)((byte_t *)alloc + *cur_offset);
|
||||
void *full_position = stack_cur;
|
||||
void *stack_cur = (void *)((byte_t *)alloc + *cur_offset);
|
||||
void *full_position = stack_cur;
|
||||
cache_bin_sz_t bin_stack_size = info->ncached_max * sizeof(void *);
|
||||
|
||||
*cur_offset += bin_stack_size;
|
||||
|
|
@ -96,8 +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_empty = (cache_bin_sz_t)(uintptr_t)empty_position;
|
||||
cache_bin_info_init(&bin->bin_info, info->ncached_max);
|
||||
cache_bin_sz_t free_spots = cache_bin_diff(bin,
|
||||
bin->low_bits_full, (cache_bin_sz_t)(uintptr_t)bin->stack_head);
|
||||
cache_bin_sz_t free_spots = cache_bin_diff(bin, bin->low_bits_full,
|
||||
(cache_bin_sz_t)(uintptr_t)bin->stack_head);
|
||||
assert(free_spots == bin_stack_size);
|
||||
if (!cache_bin_disabled(bin)) {
|
||||
assert(cache_bin_ncached_get_local(bin) == 0);
|
||||
|
|
@ -109,8 +107,8 @@ cache_bin_init(cache_bin_t *bin, const cache_bin_info_t *info, void *alloc,
|
|||
|
||||
void
|
||||
cache_bin_init_disabled(cache_bin_t *bin, cache_bin_sz_t ncached_max) {
|
||||
const void *fake_stack = cache_bin_disabled_bin_stack();
|
||||
size_t fake_offset = 0;
|
||||
const void *fake_stack = cache_bin_disabled_bin_stack();
|
||||
size_t fake_offset = 0;
|
||||
cache_bin_info_t fake_info;
|
||||
cache_bin_info_init(&fake_info, 0);
|
||||
cache_bin_init(bin, &fake_info, (void *)fake_stack, &fake_offset);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue