ENV Cleanup Step 16: Gate HAKMEM_SS_FREE_DEBUG

Gate the shared pool free debug variable behind #if !HAKMEM_BUILD_RELEASE:
- HAKMEM_SS_FREE_DEBUG: Controls shared pool slot release tracing
- File: core/hakmem_shared_pool.c:1221-1229

The debug output was already gated inside #if !HAKMEM_BUILD_RELEASE blocks.
This change only gates the ENV check itself. In release builds, sets
dbg to constant 0, allowing compiler to optimize away checks.

Performance: 30.3M ops/s (baseline maintained)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-11-28 04:35:07 +09:00
parent f119f048f2
commit 2cdec72ee3

View File

@ -1218,11 +1218,15 @@ shared_pool_release_slab(SuperSlab* ss, int slab_idx)
} }
// Debug logging // Debug logging
#if !HAKMEM_BUILD_RELEASE
static int dbg = -1; static int dbg = -1;
if (__builtin_expect(dbg == -1, 0)) { if (__builtin_expect(dbg == -1, 0)) {
const char* e = getenv("HAKMEM_SS_FREE_DEBUG"); const char* e = getenv("HAKMEM_SS_FREE_DEBUG");
dbg = (e && *e && *e != '0') ? 1 : 0; dbg = (e && *e && *e != '0') ? 1 : 0;
} }
#else
static const int dbg = 0;
#endif
// P0 instrumentation: count lock acquisitions // P0 instrumentation: count lock acquisitions
lock_stats_init(); lock_stats_init();