mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-25 08:33:38 +03:00
Refactor prng to not use 64-bit atomics on 32-bit platforms.
This resolves #495.
This commit is contained in:
parent
a4e83e8593
commit
5d6cb6eb66
7 changed files with 365 additions and 33 deletions
|
|
@ -1199,7 +1199,7 @@ arena_decay_deadline_init(arena_t *arena)
|
|||
if (arena->decay.time > 0) {
|
||||
nstime_t jitter;
|
||||
|
||||
nstime_init(&jitter, prng_range(&arena->decay.jitter_state,
|
||||
nstime_init(&jitter, prng_range_u64(&arena->decay.jitter_state,
|
||||
nstime_ns(&arena->decay.interval)));
|
||||
nstime_add(&arena->decay.deadline, &jitter);
|
||||
}
|
||||
|
|
@ -2565,7 +2565,8 @@ arena_malloc_large(tsdn_t *tsdn, arena_t *arena, szind_t binind, bool zero)
|
|||
* that is a multiple of the cacheline size, e.g. [0 .. 63) * 64
|
||||
* for 4 KiB pages and 64-byte cachelines.
|
||||
*/
|
||||
r = prng_lg_range(&arena->offset_state, LG_PAGE - LG_CACHELINE);
|
||||
r = prng_lg_range_zu(&arena->offset_state, LG_PAGE -
|
||||
LG_CACHELINE, false);
|
||||
random_offset = ((uintptr_t)r) << LG_CACHELINE;
|
||||
} else
|
||||
random_offset = 0;
|
||||
|
|
@ -3503,7 +3504,7 @@ arena_new(tsdn_t *tsdn, unsigned ind)
|
|||
* deterministic seed.
|
||||
*/
|
||||
arena->offset_state = config_debug ? ind :
|
||||
(uint64_t)(uintptr_t)arena;
|
||||
(size_t)(uintptr_t)arena;
|
||||
}
|
||||
|
||||
arena->dss_prec = chunk_dss_prec_get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue