mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-08 23:07:20 +03: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:
parent
4827bb17bd
commit
3e82f357bb
27 changed files with 116 additions and 66 deletions
|
|
@ -743,7 +743,7 @@ extent_grow_retained(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
|
|||
/* A successful commit should return zeroed memory. */
|
||||
if (config_debug) {
|
||||
void *addr = edata_addr_get(edata);
|
||||
size_t *p = (size_t *)(uintptr_t)addr;
|
||||
size_t *p = (size_t *)addr;
|
||||
/* Check the first page only. */
|
||||
for (size_t i = 0; i < PAGE / sizeof(size_t); i++) {
|
||||
assert(p[i] == 0);
|
||||
|
|
@ -1199,7 +1199,7 @@ extent_split_impl(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
|
|||
}
|
||||
|
||||
edata_init(trail, edata_arena_ind_get(edata),
|
||||
(void *)((uintptr_t)edata_base_get(edata) + size_a), size_b,
|
||||
(void *)((byte_t *)edata_base_get(edata) + size_a), size_b,
|
||||
/* slab */ false, SC_NSIZES, edata_sn_get(edata),
|
||||
edata_state_get(edata), edata_zeroed_get(edata),
|
||||
edata_committed_get(edata), EXTENT_PAI_PAC, EXTENT_NOT_HEAD);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue