Phase 3d-B: TLS Cache Merge - Unified g_tls_sll[] structure (+12-18% expected)
Merge separate g_tls_sll_head[] and g_tls_sll_count[] arrays into unified TinyTLSSLL struct to improve L1D cache locality. Expected performance gain: +12-18% from reducing cache line splits (2 loads → 1 load per operation). Changes: - core/hakmem_tiny.h: Add TinyTLSSLL type (16B aligned, head+count+pad) - core/hakmem_tiny.c: Replace separate arrays with g_tls_sll[8] - core/box/tls_sll_box.h: Update Box API (13 sites) for unified access - Updated 32+ files: All g_tls_sll_head[i] → g_tls_sll[i].head - Updated 32+ files: All g_tls_sll_count[i] → g_tls_sll[i].count - core/hakmem_tiny_integrity.h: Unified canary guards - core/box/integrity_box.c: Simplified canary validation - Makefile: Added core/box/tiny_sizeclass_hist_box.o to link Build: ✅ PASS (10K ops sanity test) Warnings: Only pre-existing LTO type mismatches (unrelated) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -34,8 +34,7 @@ extern uint16_t g_fast_cap[TINY_NUM_CLASSES];
|
||||
extern __thread TinyFastCache g_fast_cache[TINY_NUM_CLASSES];
|
||||
|
||||
extern int g_tls_sll_enable;
|
||||
extern __thread void* g_tls_sll_head[TINY_NUM_CLASSES];
|
||||
extern __thread uint32_t g_tls_sll_count[TINY_NUM_CLASSES];
|
||||
extern __thread TinyTLSSLL g_tls_sll[TINY_NUM_CLASSES];
|
||||
|
||||
extern _Atomic uint32_t g_frontend_fill_target[TINY_NUM_CLASSES];
|
||||
|
||||
@ -209,7 +208,7 @@ static inline int bulk_mag_to_sll_if_room(int class_idx, TinyTLSMag* mag, int n)
|
||||
if (!g_tls_sll_enable || n <= 0) return 0;
|
||||
|
||||
uint32_t cap = sll_cap_for_class(class_idx, (uint32_t)mag->cap);
|
||||
uint32_t have = g_tls_sll_count[class_idx];
|
||||
uint32_t have = g_tls_sll[class_idx].count;
|
||||
if (have >= cap) return 0;
|
||||
|
||||
int room = (int)(cap - have);
|
||||
@ -312,7 +311,7 @@ int sll_refill_small_from_ss(int class_idx, int max_take)
|
||||
}
|
||||
|
||||
const uint32_t cap = sll_cap_for_class(class_idx, (uint32_t)TINY_TLS_MAG_CAP);
|
||||
const uint32_t cur = g_tls_sll_count[class_idx];
|
||||
const uint32_t cur = g_tls_sll[class_idx].count;
|
||||
if (cur >= cap) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user