mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Fix all optimization-inhibiting integer-to-pointer casts
Following from PR #2481, we replace all integer-to-pointer casts [which hide pointer provenance information (and thus inhibit optimizations)](https://clang.llvm.org/extra/clang-tidy/checks/performance/no-int-to-ptr.html) with equivalent operations that preserve this information. I have enabled the corresponding clang-tidy check in our static analysis CI so that we do not get bitten by this again in the future.
This commit is contained in:
committed by
Qi Wang
parent
4827bb17bd
commit
3e82f357bb
@@ -768,9 +768,9 @@ tcache_create_explicit(tsd_t *tsd) {
|
||||
if (mem == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
tcache_t *tcache = (void *)((uintptr_t)mem + tcache_bin_alloc_size);
|
||||
tcache_t *tcache = (void *)((byte_t *)mem + tcache_bin_alloc_size);
|
||||
tcache_slow_t *tcache_slow =
|
||||
(void *)((uintptr_t)mem + tcache_bin_alloc_size + sizeof(tcache_t));
|
||||
(void *)((byte_t *)mem + tcache_bin_alloc_size + sizeof(tcache_t));
|
||||
tcache_init(tsd, tcache_slow, tcache, mem);
|
||||
|
||||
tcache_arena_associate(tsd_tsdn(tsd), tcache_slow, tcache,
|
||||
|
||||
Reference in New Issue
Block a user