[libc-commits] [libc] [libc] default NUM_TABLE_ENTRIES to a fixed value of 3 (PR #221807)
Schrodinger ZHU Yifan via libc-commits
libc-commits at lists.llvm.org
Mon Sep 7 12:31:06 PDT 2026
https://github.com/SchrodingerZhu created https://github.com/llvm/llvm-project/pull/221807
6 (192 entries) is too large for 32-bit devices and can cause shift overflow. This PR sets the limit to 3 words.
>From 0d98376720a55c28e35f6da20327d2e51030f377 Mon Sep 17 00:00:00 2001
From: Schrodinger ZHU Yifan <yifanzhu at rochester.edu>
Date: Mon, 7 Sep 2026 12:30:30 -0700
Subject: [PATCH] [libc] default NUM_TABLE_ENTRIES to a fixed value of 3
6 (192 entries) is too large for 32-bit devices and can cause shift overflow.
---
libc/src/__support/tlsf_table.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
};
More information about the libc-commits
mailing list