diff --git a/core/hakmem_super_registry.c b/core/hakmem_super_registry.c index 35a23f13..c25240e1 100644 --- a/core/hakmem_super_registry.c +++ b/core/hakmem_super_registry.c @@ -51,9 +51,13 @@ int hak_super_register(uintptr_t base, SuperSlab* ss) { int lg = ss->lg_size; // Phase 8.3: Get lg_size from SuperSlab +#if !HAKMEM_BUILD_RELEASE // Debug logging (check ENV every time for now - performance not critical during debug) const char* dbg_env = getenv("HAKMEM_SUPER_REG_DEBUG"); int dbg = (dbg_env && *dbg_env && *dbg_env != '0') ? 1 : 0; +#else + const int dbg = 0; +#endif int h = hak_super_hash(base, lg); @@ -109,7 +113,11 @@ int hak_super_register(uintptr_t base, SuperSlab* ss) { // Phase 8.3: ACE - Try both lg_sizes (we don't know which one was used) // Phase 6: Registry Optimization - Also remove from per-class registry void hak_super_unregister(uintptr_t base) { +#if !HAKMEM_BUILD_RELEASE static int dbg_once = -1; // shared with register path for debug toggle +#else + static const int dbg_once = 0; +#endif if (!g_super_reg_initialized) return; pthread_mutex_lock(&g_super_reg_lock); @@ -136,12 +144,14 @@ void hak_super_unregister(uintptr_t base) { // Step 3: Clear lg_size (optional cleanup) e->lg_size = 0; +#if !HAKMEM_BUILD_RELEASE if (__builtin_expect(dbg_once == -1, 0)) { const char* e = getenv("HAKMEM_SUPER_REG_DEBUG"); dbg_once = (e && *e && *e!='0'); } if (dbg_once == 1) { fprintf(stderr, "[SUPER_REG] unregister base=%p\n", (void*)base); } +#endif // Found in hash table, continue to per-class removal goto hash_removed;