ENV Cleanup Step 2a: Gate debug code in hakmem_tiny_slow.inc

Gate tiny_alloc_dump_tls_state() call and getenv debug code on slow path
failure with HAKMEM_BUILD_RELEASE guard.

Performance: 30.5M ops/s (baseline: 30.2M)

🤖 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 00:43:57 +09:00
parent 3833d4e3eb
commit d6c2ea6f3e

View File

@ -75,6 +75,7 @@ static void* __attribute__((cold, noinline)) hak_tiny_alloc_slow(size_t size, in
HAK_RET_ALLOC(class_idx, ss_ptr);
}
#if !HAKMEM_BUILD_RELEASE
tiny_alloc_dump_tls_state(class_idx, "slow_fail", &g_tls_slabs[class_idx]);
// Optional one-shot debug when final slow path fails
static int g_alloc_dbg = -1; if (__builtin_expect(g_alloc_dbg == -1, 0)) { const char* e=getenv("HAKMEM_TINY_ALLOC_DEBUG"); g_alloc_dbg = (e && atoi(e)!=0)?1:0; }
@ -84,6 +85,7 @@ static void* __attribute__((cold, noinline)) hak_tiny_alloc_slow(size_t size, in
fprintf(stderr, "[ALLOC-SLOW] hak_tiny_alloc_superslab returned NULL class=%d size=%zu\n", class_idx, size);
}
}
#endif
return ss_ptr;
}