Remove dead code: UltraHot, RingCache, FrontC23, Class5 Hotpath
(cherry-picked from 225b6fcc7, conflicts resolved)
This commit is contained in:
@ -15,14 +15,6 @@ void hak_tiny_init(void) {
|
||||
// Step 1: Simple initialization (static global is already zero-initialized)
|
||||
g_tiny_initialized = 1;
|
||||
|
||||
// Hot-class toggle: class5 (256B) dedicated TLS fast path
|
||||
// Default ON; allow runtime override via HAKMEM_TINY_HOTPATH_CLASS5
|
||||
{
|
||||
const char* hp5 = getenv("HAKMEM_TINY_HOTPATH_CLASS5");
|
||||
if (hp5 && *hp5) {
|
||||
g_tiny_hotpath_class5 = (atoi(hp5) != 0) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset fast-cache defaults and apply preset (if provided)
|
||||
tiny_config_reset_defaults();
|
||||
@ -101,50 +93,6 @@ void hak_tiny_init(void) {
|
||||
tls->spill_high = tiny_tls_default_spill(base_cap);
|
||||
tiny_tls_publish_targets(i, base_cap);
|
||||
}
|
||||
// Optional: override TLS parameters for hot class 5 (256B)
|
||||
if (g_tiny_hotpath_class5) {
|
||||
TinyTLSList* tls5 = &g_tls_lists[5];
|
||||
int cap_def = 512; // thick cache for hot class
|
||||
int refill_def = 128; // refill low-water mark
|
||||
int spill_def = 0; // 0 → use cap as hard spill threshold
|
||||
const char* ecap = getenv("HAKMEM_TINY_CLASS5_TLS_CAP");
|
||||
const char* eref = getenv("HAKMEM_TINY_CLASS5_TLS_REFILL");
|
||||
const char* espl = getenv("HAKMEM_TINY_CLASS5_TLS_SPILL");
|
||||
if (ecap && *ecap) cap_def = atoi(ecap);
|
||||
if (eref && *eref) refill_def = atoi(eref);
|
||||
if (espl && *espl) spill_def = atoi(espl);
|
||||
if (cap_def < 64) cap_def = 64; if (cap_def > 4096) cap_def = 4096;
|
||||
if (refill_def < 16) refill_def = 16; if (refill_def > cap_def) refill_def = cap_def;
|
||||
if (spill_def < 0) spill_def = 0; if (spill_def > cap_def) spill_def = cap_def;
|
||||
tls5->cap = (uint32_t)cap_def;
|
||||
tls5->refill_low = (uint32_t)refill_def;
|
||||
tls5->spill_high = (uint32_t)spill_def; // 0 → use cap logic in helper
|
||||
tiny_tls_publish_targets(5, (uint32_t)cap_def);
|
||||
|
||||
// Optional: one-shot TLS prewarm for class5
|
||||
// Env: HAKMEM_TINY_CLASS5_PREWARM=<n> (default 128, 0 disables)
|
||||
int prewarm = 128;
|
||||
const char* pw = getenv("HAKMEM_TINY_CLASS5_PREWARM");
|
||||
if (pw && *pw) prewarm = atoi(pw);
|
||||
if (prewarm < 0) prewarm = 0;
|
||||
if (prewarm > (int)tls5->cap) prewarm = (int)tls5->cap;
|
||||
|
||||
if (prewarm > 0) {
|
||||
// ✅ NEW: Use Box Prewarm API (safe, simple, handles all initialization)
|
||||
// Box Prewarm guarantees:
|
||||
// - Correct initialization order (capacity system initialized first)
|
||||
// - No orphaned blocks (atomic carve-and-push)
|
||||
// - No double-free risk (all-or-nothing semantics)
|
||||
// - Clear error handling
|
||||
int taken = box_prewarm_tls(5, prewarm);
|
||||
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
// Debug logging (optional)
|
||||
fprintf(stderr, "[PREWARM] class=5 requested=%d taken=%d\n", prewarm, taken);
|
||||
#endif
|
||||
(void)taken; // Suppress unused warning in release builds
|
||||
}
|
||||
}
|
||||
if (mem_diet_enabled) {
|
||||
tiny_apply_mem_diet();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user