summaryrefslogtreecommitdiff
path: root/libc/src/__support/freelist.cpp
AgeCommit message (Collapse)Author
2024-11-22[libc][NFC] Remove template arguments from Block (#117386)Daniel Thornburgh
2024-11-21Reapply "[libc] Use best-fit binary trie to make malloc logarithmic (#117065)"Daniel Thornburgh
This reverts commit 93b83642ee34d0092b94776728dad0117c2b72a1. - Correct riscv32 assumption about alignment (bit of a hack). - Fix test case where the largest_small and smallest sizes are the same.
2024-11-21Revert "[libc] Use best-fit binary trie to make malloc logarithmic (#117065)"Daniel Thornburgh
This reverts commit b05600d96f46697e21f6b1b7ad901391326243a8. riscv32 unit test still broken
2024-11-21Reapply "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)Daniel Thornburgh
- Fix assertion expressions. - Fix incorrect small size in freestore_test. - There may only be one small size for high alignment and small pointers (riscv32). - Don't rely on stack alignment in FreeList test.
2024-11-20Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)Daniel Thornburgh
Reverts llvm/llvm-project#106259 Unit tests break on AArch64.
2024-11-20[libc] Use best-fit binary trie to make malloc logarithmic (#106259)Daniel Thornburgh
This reworks the free store implementation in libc's malloc to use a dlmalloc-style binary trie of circularly linked FIFO free lists. This data structure can be maintained in logarithmic time, but it still permits a relatively small implementation compared to other logarithmic-time ordered maps. The implementation doesn't do the various bitwise tricks or optimizations used in actual dlmalloc; it instead optimizes for (relative) readability and minimum code size. Specific optimization can be added as necessary given future profiling.