ENV Cleanup Step 8: Gate HAKMEM_SUPER_LOOKUP_DEBUG in header

Gate HAKMEM_SUPER_LOOKUP_DEBUG environment variable behind
#if !HAKMEM_BUILD_RELEASE in hakmem_super_registry.h inline function.

Changes:
- Wrap s_dbg initialization in conditional compilation
- Release builds use constant s_dbg = 0 for complete elimination
- Debug logging in hak_super_lookup() now fully compiled out in release

Performance: 30.3M ops/s Larson (stable, no regression)

🤖 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 01:45:45 +09:00
parent e29823c41e
commit f8b0f38f78
9 changed files with 50 additions and 31 deletions

View File

@ -11,8 +11,9 @@ core/box/free_local_box.o: core/box/free_local_box.c \
core/box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \ core/box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \
core/tiny_nextptr.h core/tiny_region_id.h core/tiny_box_geometry.h \ core/tiny_nextptr.h core/tiny_region_id.h core/tiny_box_geometry.h \
core/ptr_track.h core/hakmem_super_registry.h \ core/ptr_track.h core/hakmem_super_registry.h \
core/hakmem_tiny_superslab.h core/box/ss_hot_cold_box.h \ core/hakmem_tiny_superslab.h core/hakmem_tiny.h \
core/box/../superslab/superslab_types.h core/tiny_region_id.h core/box/ss_hot_cold_box.h core/box/../superslab/superslab_types.h \
core/tiny_region_id.h
core/box/free_local_box.h: core/box/free_local_box.h:
core/hakmem_tiny_superslab.h: core/hakmem_tiny_superslab.h:
core/superslab/superslab_types.h: core/superslab/superslab_types.h:
@ -38,6 +39,7 @@ core/tiny_box_geometry.h:
core/ptr_track.h: core/ptr_track.h:
core/hakmem_super_registry.h: core/hakmem_super_registry.h:
core/hakmem_tiny_superslab.h: core/hakmem_tiny_superslab.h:
core/hakmem_tiny.h:
core/box/ss_hot_cold_box.h: core/box/ss_hot_cold_box.h:
core/box/../superslab/superslab_types.h: core/box/../superslab/superslab_types.h:
core/tiny_region_id.h: core/tiny_region_id.h:

View File

@ -10,13 +10,13 @@ core/box/front_gate_classifier.o: core/box/front_gate_classifier.c \
core/box/../superslab/superslab_types.h \ core/box/../superslab/superslab_types.h \
core/box/../superslab/../tiny_box_geometry.h \ core/box/../superslab/../tiny_box_geometry.h \
core/box/../tiny_debug_ring.h core/box/../tiny_remote.h \ core/box/../tiny_debug_ring.h core/box/../tiny_remote.h \
core/box/../hakmem_tiny_superslab.h \ core/box/../hakmem_tiny.h core/box/../hakmem_trace.h \
core/box/../hakmem_tiny_mini_mag.h core/box/../hakmem_tiny_superslab.h \
core/box/../superslab/superslab_inline.h \ core/box/../superslab/superslab_inline.h \
core/box/../hakmem_build_flags.h core/box/../hakmem_internal.h \ core/box/../hakmem_build_flags.h core/box/../hakmem_internal.h \
core/box/../hakmem.h core/box/../hakmem_config.h \ core/box/../hakmem.h core/box/../hakmem_config.h \
core/box/../hakmem_features.h core/box/../hakmem_sys.h \ core/box/../hakmem_features.h core/box/../hakmem_sys.h \
core/box/../hakmem_whale.h core/box/../hakmem_tiny_config.h \ core/box/../hakmem_whale.h core/box/../hakmem_tiny_config.h
core/box/../pool_tls_registry.h
core/box/front_gate_classifier.h: core/box/front_gate_classifier.h:
core/box/../tiny_region_id.h: core/box/../tiny_region_id.h:
core/box/../hakmem_build_flags.h: core/box/../hakmem_build_flags.h:
@ -33,6 +33,9 @@ core/box/../superslab/superslab_types.h:
core/box/../superslab/../tiny_box_geometry.h: core/box/../superslab/../tiny_box_geometry.h:
core/box/../tiny_debug_ring.h: core/box/../tiny_debug_ring.h:
core/box/../tiny_remote.h: core/box/../tiny_remote.h:
core/box/../hakmem_tiny.h:
core/box/../hakmem_trace.h:
core/box/../hakmem_tiny_mini_mag.h:
core/box/../hakmem_tiny_superslab.h: core/box/../hakmem_tiny_superslab.h:
core/box/../superslab/superslab_inline.h: core/box/../superslab/superslab_inline.h:
core/box/../hakmem_build_flags.h: core/box/../hakmem_build_flags.h:
@ -43,4 +46,3 @@ core/box/../hakmem_features.h:
core/box/../hakmem_sys.h: core/box/../hakmem_sys.h:
core/box/../hakmem_whale.h: core/box/../hakmem_whale.h:
core/box/../hakmem_tiny_config.h: core/box/../hakmem_tiny_config.h:
core/box/../pool_tls_registry.h:

View File

@ -15,10 +15,10 @@ core/box/unified_batch_box.o: core/box/unified_batch_box.c \
core/box/../box/../superslab/superslab_types.h \ core/box/../box/../superslab/superslab_types.h \
core/box/../box/../superslab/../tiny_box_geometry.h \ core/box/../box/../superslab/../tiny_box_geometry.h \
core/box/../box/../tiny_debug_ring.h core/box/../box/../tiny_remote.h \ core/box/../box/../tiny_debug_ring.h core/box/../box/../tiny_remote.h \
core/box/../box/../hakmem_tiny_integrity.h \
core/box/../box/../hakmem_tiny.h core/box/../box/../hakmem_trace.h \ core/box/../box/../hakmem_tiny.h core/box/../box/../hakmem_trace.h \
core/box/../box/../hakmem_tiny_mini_mag.h core/box/../box/../ptr_track.h \ core/box/../box/../hakmem_tiny_mini_mag.h \
core/box/../box/../ptr_trace.h \ core/box/../box/../hakmem_tiny_integrity.h \
core/box/../box/../ptr_track.h core/box/../box/../ptr_trace.h \
core/box/../box/../box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \ core/box/../box/../box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \
core/tiny_nextptr.h core/hakmem_build_flags.h core/tiny_region_id.h \ core/tiny_nextptr.h core/hakmem_build_flags.h core/tiny_region_id.h \
core/superslab/superslab_inline.h core/box/../box/../tiny_debug_ring.h \ core/superslab/superslab_inline.h core/box/../box/../tiny_debug_ring.h \
@ -44,10 +44,10 @@ core/box/../box/../superslab/superslab_types.h:
core/box/../box/../superslab/../tiny_box_geometry.h: core/box/../box/../superslab/../tiny_box_geometry.h:
core/box/../box/../tiny_debug_ring.h: core/box/../box/../tiny_debug_ring.h:
core/box/../box/../tiny_remote.h: core/box/../box/../tiny_remote.h:
core/box/../box/../hakmem_tiny_integrity.h:
core/box/../box/../hakmem_tiny.h: core/box/../box/../hakmem_tiny.h:
core/box/../box/../hakmem_trace.h: core/box/../box/../hakmem_trace.h:
core/box/../box/../hakmem_tiny_mini_mag.h: core/box/../box/../hakmem_tiny_mini_mag.h:
core/box/../box/../hakmem_tiny_integrity.h:
core/box/../box/../ptr_track.h: core/box/../box/../ptr_track.h:
core/box/../box/../ptr_trace.h: core/box/../box/../ptr_trace.h:
core/box/../box/../box/tiny_next_ptr_box.h: core/box/../box/../box/tiny_next_ptr_box.h:

View File

@ -16,7 +16,8 @@ core/front/tiny_unified_cache.o: core/front/tiny_unified_cache.c \
core/hakmem_tiny_config.h core/tiny_nextptr.h core/hakmem_build_flags.h \ core/hakmem_tiny_config.h core/tiny_nextptr.h core/hakmem_build_flags.h \
core/tiny_region_id.h core/tiny_box_geometry.h core/ptr_track.h \ core/tiny_region_id.h core/tiny_box_geometry.h core/ptr_track.h \
core/hakmem_super_registry.h core/hakmem_tiny_superslab.h \ core/hakmem_super_registry.h core/hakmem_tiny_superslab.h \
core/superslab/superslab_inline.h core/front/../hakmem_tiny_superslab.h \ core/superslab/superslab_inline.h core/hakmem_tiny.h core/hakmem_trace.h \
core/hakmem_tiny_mini_mag.h core/front/../hakmem_tiny_superslab.h \
core/front/../superslab/superslab_inline.h \ core/front/../superslab/superslab_inline.h \
core/front/../box/pagefault_telemetry_box.h core/front/../box/pagefault_telemetry_box.h
core/front/tiny_unified_cache.h: core/front/tiny_unified_cache.h:
@ -47,6 +48,9 @@ core/ptr_track.h:
core/hakmem_super_registry.h: core/hakmem_super_registry.h:
core/hakmem_tiny_superslab.h: core/hakmem_tiny_superslab.h:
core/superslab/superslab_inline.h: core/superslab/superslab_inline.h:
core/hakmem_tiny.h:
core/hakmem_trace.h:
core/hakmem_tiny_mini_mag.h:
core/front/../hakmem_tiny_superslab.h: core/front/../hakmem_tiny_superslab.h:
core/front/../superslab/superslab_inline.h: core/front/../superslab/superslab_inline.h:
core/front/../box/pagefault_telemetry_box.h: core/front/../box/pagefault_telemetry_box.h:

View File

@ -119,12 +119,16 @@ static inline int hak_super_hash(uintptr_t base, int lg_size) {
static inline SuperSlab* hak_super_lookup(void* ptr) { static inline SuperSlab* hak_super_lookup(void* ptr) {
if (!g_super_reg_initialized) return NULL; if (!g_super_reg_initialized) return NULL;
#if !HAKMEM_BUILD_RELEASE
// Debug logging (ENV-gated) // Debug logging (ENV-gated)
static __thread int s_dbg = -1; static __thread int s_dbg = -1;
if (__builtin_expect(s_dbg == -1, 0)) { if (__builtin_expect(s_dbg == -1, 0)) {
const char* e = getenv("HAKMEM_SUPER_LOOKUP_DEBUG"); const char* e = getenv("HAKMEM_SUPER_LOOKUP_DEBUG");
s_dbg = (e && *e && *e != '0') ? 1 : 0; s_dbg = (e && *e && *e != '0') ? 1 : 0;
} }
#else
static const int s_dbg = 0;
#endif
// Try both 1MB and 2MB alignments (1MB first for Step 1 default) // Try both 1MB and 2MB alignments (1MB first for Step 1 default)
// ACE will use both sizes dynamically in Step 3 // ACE will use both sizes dynamically in Step 3

View File

@ -12,8 +12,8 @@ core/tiny_alloc_fast_push.o: core/tiny_alloc_fast_push.c \
core/box/../superslab/superslab_types.h \ core/box/../superslab/superslab_types.h \
core/box/../superslab/../tiny_box_geometry.h \ core/box/../superslab/../tiny_box_geometry.h \
core/box/../tiny_debug_ring.h core/box/../tiny_remote.h \ core/box/../tiny_debug_ring.h core/box/../tiny_remote.h \
core/box/../hakmem_tiny_integrity.h core/box/../hakmem_tiny.h \ core/box/../hakmem_tiny.h core/box/../hakmem_trace.h \
core/box/../hakmem_trace.h core/box/../hakmem_tiny_mini_mag.h \ core/box/../hakmem_tiny_mini_mag.h core/box/../hakmem_tiny_integrity.h \
core/box/../ptr_track.h core/box/../ptr_trace.h \ core/box/../ptr_track.h core/box/../ptr_trace.h \
core/box/../box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \ core/box/../box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \
core/tiny_nextptr.h core/hakmem_build_flags.h core/tiny_region_id.h \ core/tiny_nextptr.h core/hakmem_build_flags.h core/tiny_region_id.h \
@ -40,10 +40,10 @@ core/box/../superslab/superslab_types.h:
core/box/../superslab/../tiny_box_geometry.h: core/box/../superslab/../tiny_box_geometry.h:
core/box/../tiny_debug_ring.h: core/box/../tiny_debug_ring.h:
core/box/../tiny_remote.h: core/box/../tiny_remote.h:
core/box/../hakmem_tiny_integrity.h:
core/box/../hakmem_tiny.h: core/box/../hakmem_tiny.h:
core/box/../hakmem_trace.h: core/box/../hakmem_trace.h:
core/box/../hakmem_tiny_mini_mag.h: core/box/../hakmem_tiny_mini_mag.h:
core/box/../hakmem_tiny_integrity.h:
core/box/../ptr_track.h: core/box/../ptr_track.h:
core/box/../ptr_trace.h: core/box/../ptr_trace.h:
core/box/../box/tiny_next_ptr_box.h: core/box/../box/tiny_next_ptr_box.h:

View File

@ -22,11 +22,11 @@ hakmem.o: core/hakmem.c core/hakmem.h core/hakmem_build_flags.h \
core/box/hak_kpi_util.inc.h core/box/hak_core_init.inc.h \ core/box/hak_kpi_util.inc.h core/box/hak_core_init.inc.h \
core/hakmem_phase7_config.h core/box/ss_hot_prewarm_box.h \ core/hakmem_phase7_config.h core/box/ss_hot_prewarm_box.h \
core/box/hak_alloc_api.inc.h core/box/../hakmem_tiny.h \ core/box/hak_alloc_api.inc.h core/box/../hakmem_tiny.h \
core/box/../hakmem_smallmid.h core/box/../pool_tls.h \ core/box/../hakmem_smallmid.h core/box/hak_free_api.inc.h \
core/box/hak_free_api.inc.h core/hakmem_tiny_superslab.h \ core/hakmem_tiny_superslab.h core/box/../tiny_free_fast_v2.inc.h \
core/box/../tiny_free_fast_v2.inc.h core/box/../tiny_region_id.h \ core/box/../tiny_region_id.h core/box/../hakmem_build_flags.h \
core/box/../hakmem_build_flags.h core/box/../hakmem_tiny_config.h \ core/box/../hakmem_tiny_config.h core/box/../box/tls_sll_box.h \
core/box/../box/tls_sll_box.h core/box/../box/../hakmem_tiny_config.h \ core/box/../box/../hakmem_tiny_config.h \
core/box/../box/../hakmem_build_flags.h core/box/../box/../tiny_remote.h \ core/box/../box/../hakmem_build_flags.h core/box/../box/../tiny_remote.h \
core/box/../box/../tiny_region_id.h \ core/box/../box/../tiny_region_id.h \
core/box/../box/../hakmem_tiny_integrity.h \ core/box/../box/../hakmem_tiny_integrity.h \
@ -44,6 +44,8 @@ hakmem.o: core/hakmem.c core/hakmem.h core/hakmem_build_flags.h \
core/box/front_gate_classifier.h core/box/../front/malloc_tiny_fast.h \ core/box/front_gate_classifier.h core/box/../front/malloc_tiny_fast.h \
core/box/../front/../hakmem_build_flags.h \ core/box/../front/../hakmem_build_flags.h \
core/box/../front/../hakmem_tiny_config.h \ core/box/../front/../hakmem_tiny_config.h \
core/box/../front/../superslab/superslab_inline.h \
core/box/../front/../box/ss_slab_meta_box.h \
core/box/../front/tiny_unified_cache.h \ core/box/../front/tiny_unified_cache.h \
core/box/../front/../tiny_region_id.h core/box/../front/../hakmem_tiny.h core/box/../front/../tiny_region_id.h core/box/../front/../hakmem_tiny.h
core/hakmem.h: core/hakmem.h:
@ -104,7 +106,6 @@ core/box/ss_hot_prewarm_box.h:
core/box/hak_alloc_api.inc.h: core/box/hak_alloc_api.inc.h:
core/box/../hakmem_tiny.h: core/box/../hakmem_tiny.h:
core/box/../hakmem_smallmid.h: core/box/../hakmem_smallmid.h:
core/box/../pool_tls.h:
core/box/hak_free_api.inc.h: core/box/hak_free_api.inc.h:
core/hakmem_tiny_superslab.h: core/hakmem_tiny_superslab.h:
core/box/../tiny_free_fast_v2.inc.h: core/box/../tiny_free_fast_v2.inc.h:
@ -138,6 +139,8 @@ core/box/front_gate_classifier.h:
core/box/../front/malloc_tiny_fast.h: core/box/../front/malloc_tiny_fast.h:
core/box/../front/../hakmem_build_flags.h: core/box/../front/../hakmem_build_flags.h:
core/box/../front/../hakmem_tiny_config.h: core/box/../front/../hakmem_tiny_config.h:
core/box/../front/../superslab/superslab_inline.h:
core/box/../front/../box/ss_slab_meta_box.h:
core/box/../front/tiny_unified_cache.h: core/box/../front/tiny_unified_cache.h:
core/box/../front/../tiny_region_id.h: core/box/../front/../tiny_region_id.h:
core/box/../front/../hakmem_tiny.h: core/box/../front/../hakmem_tiny.h:

View File

@ -9,13 +9,13 @@ hakmem_shared_pool.o: core/hakmem_shared_pool.c core/hakmem_shared_pool.h \
core/box/../superslab/superslab_types.h core/box/slab_freelist_atomic.h \ core/box/../superslab/superslab_types.h core/box/slab_freelist_atomic.h \
core/box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \ core/box/tiny_next_ptr_box.h core/hakmem_tiny_config.h \
core/tiny_nextptr.h core/tiny_region_id.h core/tiny_box_geometry.h \ core/tiny_nextptr.h core/tiny_region_id.h core/tiny_box_geometry.h \
core/ptr_track.h core/hakmem_super_registry.h core/box/ss_hot_cold_box.h \ core/ptr_track.h core/hakmem_super_registry.h core/hakmem_tiny.h \
core/box/pagefault_telemetry_box.h core/box/tls_sll_drain_box.h \ core/hakmem_trace.h core/hakmem_tiny_mini_mag.h \
core/box/tls_sll_box.h core/box/../hakmem_tiny_config.h \ core/box/ss_hot_cold_box.h core/box/pagefault_telemetry_box.h \
core/box/../hakmem_build_flags.h core/box/../tiny_remote.h \ core/box/tls_sll_drain_box.h core/box/tls_sll_box.h \
core/box/../tiny_region_id.h core/box/../hakmem_tiny_integrity.h \ core/box/../hakmem_tiny_config.h core/box/../hakmem_build_flags.h \
core/box/../hakmem_tiny.h core/box/../hakmem_build_flags.h \ core/box/../tiny_remote.h core/box/../tiny_region_id.h \
core/box/../hakmem_trace.h core/box/../hakmem_tiny_mini_mag.h \ core/box/../hakmem_tiny_integrity.h core/box/../hakmem_tiny.h \
core/box/../ptr_track.h core/box/../ptr_trace.h \ core/box/../ptr_track.h core/box/../ptr_trace.h \
core/box/../tiny_debug_ring.h core/box/../superslab/superslab_inline.h \ core/box/../tiny_debug_ring.h core/box/../superslab/superslab_inline.h \
core/box/free_local_box.h core/hakmem_tiny_superslab.h \ core/box/free_local_box.h core/hakmem_tiny_superslab.h \
@ -43,6 +43,9 @@ core/tiny_region_id.h:
core/tiny_box_geometry.h: core/tiny_box_geometry.h:
core/ptr_track.h: core/ptr_track.h:
core/hakmem_super_registry.h: core/hakmem_super_registry.h:
core/hakmem_tiny.h:
core/hakmem_trace.h:
core/hakmem_tiny_mini_mag.h:
core/box/ss_hot_cold_box.h: core/box/ss_hot_cold_box.h:
core/box/pagefault_telemetry_box.h: core/box/pagefault_telemetry_box.h:
core/box/tls_sll_drain_box.h: core/box/tls_sll_drain_box.h:
@ -53,9 +56,6 @@ core/box/../tiny_remote.h:
core/box/../tiny_region_id.h: core/box/../tiny_region_id.h:
core/box/../hakmem_tiny_integrity.h: core/box/../hakmem_tiny_integrity.h:
core/box/../hakmem_tiny.h: core/box/../hakmem_tiny.h:
core/box/../hakmem_build_flags.h:
core/box/../hakmem_trace.h:
core/box/../hakmem_tiny_mini_mag.h:
core/box/../ptr_track.h: core/box/../ptr_track.h:
core/box/../ptr_trace.h: core/box/../ptr_trace.h:
core/box/../tiny_debug_ring.h: core/box/../tiny_debug_ring.h:

View File

@ -6,7 +6,8 @@ hakmem_smallmid.o: core/hakmem_smallmid.c core/hakmem_smallmid.h \
core/hakmem_tiny_superslab.h core/superslab/superslab_types.h \ core/hakmem_tiny_superslab.h core/superslab/superslab_types.h \
core/hakmem_tiny_superslab_constants.h core/superslab/superslab_inline.h \ core/hakmem_tiny_superslab_constants.h core/superslab/superslab_inline.h \
core/superslab/superslab_types.h core/superslab/../tiny_box_geometry.h \ core/superslab/superslab_types.h core/superslab/../tiny_box_geometry.h \
core/tiny_debug_ring.h core/tiny_remote.h core/tiny_debug_ring.h core/tiny_remote.h core/hakmem_tiny.h \
core/hakmem_trace.h core/hakmem_tiny_mini_mag.h
core/hakmem_smallmid.h: core/hakmem_smallmid.h:
core/hakmem_build_flags.h: core/hakmem_build_flags.h:
core/hakmem_smallmid_superslab.h: core/hakmem_smallmid_superslab.h:
@ -24,3 +25,6 @@ core/superslab/superslab_types.h:
core/superslab/../tiny_box_geometry.h: core/superslab/../tiny_box_geometry.h:
core/tiny_debug_ring.h: core/tiny_debug_ring.h:
core/tiny_remote.h: core/tiny_remote.h:
core/hakmem_tiny.h:
core/hakmem_trace.h:
core/hakmem_tiny_mini_mag.h: