release: silence runtime logs and stabilize benches

- Fix HAKMEM_LOG gating to use  (numeric) so release builds compile out logs.
- Switch remaining prints to HAKMEM_LOG or guard with :
  - core/box/hak_core_init.inc.h (EVO sample warning, shutdown banner)
  - core/hakmem_config.c (config/feature prints)
  - core/hakmem.c (BigCache eviction prints)
  - core/hakmem_tiny_superslab.c (OOM, head init/expand, C7 init diagnostics)
  - core/hakmem_elo.c (init/evolution)
  - core/hakmem_batch.c (init/flush/stats)
  - core/hakmem_ace.c (33KB route diagnostics)
  - core/hakmem_ace_controller.c (ACE logs macro → no-op in release)
  - core/hakmem_site_rules.c (init banner)
  - core/box/hak_free_api.inc.h (unknown method error → release-gated)
- Rebuilt benches and verified quiet output for release:
  - bench_fixed_size_hakmem/system
  - bench_random_mixed_hakmem/system
  - bench_mid_large_mt_hakmem/system
  - bench_comprehensive_hakmem/system

Note: Kept debug logs available in debug builds and when explicitly toggled via env.
This commit is contained in:
Moe Charm (CI)
2025-11-11 01:47:06 +09:00
parent a97005f50e
commit 8feeb63c2b
25 changed files with 215 additions and 144 deletions

View File

@ -23,7 +23,7 @@ int hak_is_initializing(void);
#define TINY_NUM_CLASSES 8
#define TINY_SLAB_SIZE (64 * 1024) // 64KB per slab
#define TINY_MAX_SIZE 1536 // Maximum allocation size (1.5KB, accommodate 1024B + header)
#define TINY_MAX_SIZE 1024 // Tiny handles up to 1024B (C7 headerless)
// ============================================================================
// Size Classes
@ -236,18 +236,17 @@ void hkm_ace_set_drain_threshold(int class_idx, uint32_t threshold);
// Convert size to class index (branchless lookup)
// Quick Win #4: 2-3 cycles (table lookup) vs 5 cycles (branch chain)
static inline int hak_tiny_size_to_class(size_t size) {
if (size == 0 || size > TINY_MAX_SIZE) return -1;
if (size == 0) return -1;
#if HAKMEM_TINY_HEADER_CLASSIDX
// Phase 7 header adds +1 byte. Special-case 1024B to remain in Tiny (no header).
// Rationale: Avoid forcing 1024B to Mid/OS which causes frequent mmap/madvise.
if (size == TINY_MAX_SIZE) {
return g_size_to_class_lut_1k[size]; // class 7 (1024B blocks)
}
size_t alloc_size = size + 1; // Add header for other sizes
if (alloc_size > TINY_MAX_SIZE) return -1;
// C7: 1024B is headerless and maps directly to class 7
if (size == 1024) return g_size_to_class_lut_1k[1024];
// Other sizes must fit with +1 header within 1..1024 range
size_t alloc_size = size + 1; // header byte
if (alloc_size < 1 || alloc_size > 1024) return -1;
return g_size_to_class_lut_1k[alloc_size];
#else
return g_size_to_class_lut_1k[size]; // 1..1024: single load
if (size > 1024) return -1;
return g_size_to_class_lut_1k[size]; // 1..1024
#endif
}