mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 15:09:31 +03:00
move keys field in the page struct to keep offsets in the fast path the same for different build variants
This commit is contained in:
parent
8834e128e8
commit
18cf94dff6
2 changed files with 7 additions and 6 deletions
|
@ -271,13 +271,14 @@ typedef struct mi_page_s {
|
||||||
uint8_t retire_expire:7; // expiration count for retired blocks
|
uint8_t retire_expire:7; // expiration count for retired blocks
|
||||||
|
|
||||||
mi_block_t* free; // list of available free blocks (`malloc` allocates from this list)
|
mi_block_t* free; // list of available free blocks (`malloc` allocates from this list)
|
||||||
|
uint32_t used; // number of blocks in use (including blocks in `local_free` and `thread_free`)
|
||||||
|
uint32_t xblock_size; // size available in each block (always `>0`)
|
||||||
|
mi_block_t* local_free; // list of deferred free blocks by this thread (migrates to `free`)
|
||||||
|
|
||||||
#ifdef MI_ENCODE_FREELIST
|
#ifdef MI_ENCODE_FREELIST
|
||||||
uintptr_t keys[2]; // two random keys to encode the free lists (see `_mi_block_next`)
|
uintptr_t keys[2]; // two random keys to encode the free lists (see `_mi_block_next`)
|
||||||
#endif
|
#endif
|
||||||
uint32_t used; // number of blocks in use (including blocks in `local_free` and `thread_free`)
|
|
||||||
uint32_t xblock_size; // size available in each block (always `>0`)
|
|
||||||
|
|
||||||
mi_block_t* local_free; // list of deferred free blocks by this thread (migrates to `free`)
|
|
||||||
_Atomic(mi_thread_free_t) xthread_free; // list of deferred free blocks freed by other threads
|
_Atomic(mi_thread_free_t) xthread_free; // list of deferred free blocks freed by other threads
|
||||||
_Atomic(uintptr_t) xheap;
|
_Atomic(uintptr_t) xheap;
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,12 @@ const mi_page_t _mi_page_empty = {
|
||||||
false, // is_zero
|
false, // is_zero
|
||||||
0, // retire_expire
|
0, // retire_expire
|
||||||
NULL, // free
|
NULL, // free
|
||||||
#if MI_ENCODE_FREELIST
|
|
||||||
{ 0, 0 },
|
|
||||||
#endif
|
|
||||||
0, // used
|
0, // used
|
||||||
0, // xblock_size
|
0, // xblock_size
|
||||||
NULL, // local_free
|
NULL, // local_free
|
||||||
|
#if MI_ENCODE_FREELIST
|
||||||
|
{ 0, 0 },
|
||||||
|
#endif
|
||||||
MI_ATOMIC_VAR_INIT(0), // xthread_free
|
MI_ATOMIC_VAR_INIT(0), // xthread_free
|
||||||
MI_ATOMIC_VAR_INIT(0), // xheap
|
MI_ATOMIC_VAR_INIT(0), // xheap
|
||||||
NULL, NULL
|
NULL, NULL
|
||||||
|
|
Loading…
Add table
Reference in a new issue