[all-commits] [llvm/llvm-project] e1871d: [libc][__support] Implement exact linear binning f...
Schrodinger ZHU Yifan via All-commits
all-commits at lists.llvm.org
Fri Jul 31 13:38:07 PDT 2026
Branch: refs/heads/users/schrodingerzhu/libc-use-tlsf-freestore
Home: https://github.com/llvm/llvm-project
Commit: e1871dcedc18738f23433422410dc360cef1f8d9
https://github.com/llvm/llvm-project/commit/e1871dcedc18738f23433422410dc360cef1f8d9
Author: Yifan Zhu <yfzhu at google.com>
Date: 2026-07-31 (Fri, 31 Jul 2026)
Changed paths:
M libc/src/__support/freestore.h
M libc/test/src/__support/freelist_heap_test.cpp
M libc/test/src/__support/freestore_test.cpp
Log Message:
-----------
[libc][__support] Implement exact linear binning for TLSFFreeStoreImpl
Previously, size_to_bit_index used size >> UNIT_SIZE_LOG2 for linear bins,
which mapped size 24 to bin 1 and size 17 to bin 1, causing a mismatch
between allocation request sizes and physical block bucket sizes.
This change introduces exact mapping for linear bins:
- Introduces LINEAR_BINS to compute the exact number of linear bins needed
to reach the exponential table boundary (29 on MSVC Windows where UNIT_SIZE is 8,
31 on Linux where UNIT_SIZE is 16).
- Sizes <= MIN_INNER_SIZE map to bin 0.
- Larger linear sizes map to ((size - MIN_INNER_SIZE - 1) >> UNIT_SIZE_LOG2) + 1.
- Uses LINEAR_BINS as the base index for exponential bins in size_to_bit_index,
index_to_min_size, and find_and_remove_fit, ensuring strict monotonicity
across all indices without runtime clamping.
- Adds NegativeTestForFullHeap unit test in freelist_heap_test.cpp and updates
freestore_test.cpp.
TAG=agy
CONV=cff84e8c-ee22-4f39-af3c-344d1e6f417b
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list