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>
44 lines
1.6 KiB
C
44 lines
1.6 KiB
C
// Box: Legacy Backend (Phase 12)
|
|
// Purpose: Per-class SuperSlabHead backend (legacy implementation)
|
|
//
|
|
// Responsibilities:
|
|
// - Maintain per-class SuperSlabHead (g_superslab_heads)
|
|
// - Initialize SuperSlabHead for a class
|
|
// - Expand SuperSlabHead by allocating new chunks
|
|
// - Find chunk for a pointer (chunk walk)
|
|
// - Legacy hint box (per-thread, per-class bump allocation)
|
|
//
|
|
// Dependencies:
|
|
// - ss_allocation_box (superslab_allocate, superslab_free, superslab_init_slab)
|
|
// - hakmem_tiny_config (g_tiny_class_sizes)
|
|
//
|
|
// API:
|
|
// - init_superslab_head() - initialize SuperSlabHead for a class
|
|
// - expand_superslab_head() - expand SuperSlabHead by allocating new chunk
|
|
// - find_chunk_for_ptr() - find chunk for a pointer
|
|
// - hak_tiny_alloc_superslab_backend_legacy() - per-class backend
|
|
// - hak_tiny_alloc_superslab_backend_hint() - hint optimization
|
|
// - hak_tiny_ss_hint_record() - hint recording
|
|
|
|
#ifndef SS_LEGACY_BACKEND_BOX_H
|
|
#define SS_LEGACY_BACKEND_BOX_H
|
|
|
|
#include "hakmem_tiny_superslab.h"
|
|
|
|
// Global per-class SuperSlabHeads
|
|
extern SuperSlabHead* g_superslab_heads[TINY_NUM_CLASSES_SS];
|
|
|
|
// SuperSlabHead management
|
|
SuperSlabHead* init_superslab_head(int class_idx);
|
|
int expand_superslab_head(SuperSlabHead* head);
|
|
SuperSlab* find_chunk_for_ptr(void* ptr, int class_idx);
|
|
|
|
// Legacy backend API
|
|
void* hak_tiny_alloc_superslab_backend_legacy(int class_idx);
|
|
|
|
// Hint box (optional optimization)
|
|
void* hak_tiny_alloc_superslab_backend_hint(int class_idx);
|
|
void hak_tiny_ss_hint_record(int class_idx, SuperSlab* ss, int slab_idx);
|
|
|
|
#endif // SS_LEGACY_BACKEND_BOX_H
|