mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-08-24 16:13:38 +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
|
|
@ -110,14 +110,14 @@ util_prefetch_write(void *ptr) {
|
|||
JEMALLOC_ALWAYS_INLINE void
|
||||
util_prefetch_read_range(void *ptr, size_t sz) {
|
||||
for (size_t i = 0; i < sz; i += CACHELINE) {
|
||||
util_prefetch_read((void *)((uintptr_t)ptr + i));
|
||||
util_prefetch_read((void *)((byte_t *)ptr + i));
|
||||
}
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
util_prefetch_write_range(void *ptr, size_t sz) {
|
||||
for (size_t i = 0; i < sz; i += CACHELINE) {
|
||||
util_prefetch_write((void *)((uintptr_t)ptr + i));
|
||||
util_prefetch_write((void *)((byte_t *)ptr + i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue