[libc-commits] [libc] [libc] default NUM_TABLE_ENTRIES to a fixed value of 3 (PR #221807)

via libc-commits libc-commits at lists.llvm.org
Mon Sep 7 12:31:41 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Schrodinger ZHU Yifan (SchrodingerZhu)

<details>
<summary>Changes</summary>

6 (192 entries) is too large for 32-bit devices and can cause shift overflow. This PR sets the limit to 3 words.

---
Full diff: https://github.com/llvm/llvm-project/pull/221807.diff


1 Files Affected:

- (modified) libc/src/__support/tlsf_table.h (+1-1) 


``````````diff
diff --git a/libc/src/__support/tlsf_table.h b/libc/src/__support/tlsf_table.h
index a302fba15f11c..e75f1074ca4b3 100644
--- a/libc/src/__support/tlsf_table.h
+++ b/libc/src/__support/tlsf_table.h
@@ -32,7 +32,7 @@ struct DefaultFreeStoreConfig {
   static constexpr size_t UNIT_SIZE = BlockRef::MIN_ALIGN;
   static constexpr size_t STEP_SIZE_BITS = 3;
   static constexpr size_t NUM_STEP_BITS = 2;
-  static constexpr size_t NUM_TABLE_ENTRIES = sizeof(uintptr_t) == 8 ? 3 : 6;
+  static constexpr size_t NUM_TABLE_ENTRIES = 3;
   static constexpr bool USE_TRIE_FOR_OVERFLOW_BIN = true;
   static constexpr size_t LINEAR_SCAN_LIMIT = 16;
 };

``````````

</details>


https://github.com/llvm/llvm-project/pull/221807


More information about the libc-commits mailing list