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:
@ -5,52 +5,34 @@
|
||||
void* hak_pool_try_alloc(size_t size, uintptr_t site_id) {
|
||||
// Debug: IMMEDIATE output to verify function is called
|
||||
static int first_call = 1;
|
||||
if (first_call) {
|
||||
fprintf(stderr, "[Pool] hak_pool_try_alloc FIRST CALL EVER!\n");
|
||||
first_call = 0;
|
||||
}
|
||||
if (first_call) { HAKMEM_LOG("[Pool] hak_pool_try_alloc FIRST CALL EVER!\n"); first_call = 0; }
|
||||
|
||||
if (size == 40960) { // Exactly 40KB
|
||||
fprintf(stderr, "[Pool] hak_pool_try_alloc called with 40KB (Bridge class 5)\n");
|
||||
}
|
||||
if (size == 40960) { HAKMEM_LOG("[Pool] hak_pool_try_alloc called with 40KB (Bridge class 5)\n"); }
|
||||
|
||||
hak_pool_init(); // pthread_once() ensures thread-safe init (no data race!)
|
||||
|
||||
// Debug for 33-41KB allocations
|
||||
if (size >= 33000 && size <= 41000) {
|
||||
fprintf(stderr, "[Pool] hak_pool_try_alloc: size=%zu (after init)\n", size);
|
||||
}
|
||||
if (size >= 33000 && size <= 41000) { HAKMEM_LOG("[Pool] hak_pool_try_alloc: size=%zu (after init)\n", size); }
|
||||
|
||||
// P1.7 approach: Avoid using pool during ALL wrapper calls (conservative but safe)
|
||||
extern int hak_in_wrapper(void);
|
||||
if (hak_in_wrapper() && !g_wrap_l2_enabled) {
|
||||
if (size >= 33000 && size <= 41000) {
|
||||
fprintf(stderr, "[Pool] REJECTED: in_wrapper=%d, wrap_l2=%d\n",
|
||||
hak_in_wrapper(), g_wrap_l2_enabled);
|
||||
}
|
||||
if (size >= 33000 && size <= 41000) { HAKMEM_LOG("[Pool] REJECTED: in_wrapper=%d, wrap_l2=%d\n", hak_in_wrapper(), g_wrap_l2_enabled); }
|
||||
return NULL;
|
||||
}
|
||||
if (!hak_pool_is_poolable(size)) {
|
||||
if (size >= 33000 && size <= 41000) {
|
||||
fprintf(stderr, "[Pool] REJECTED: not poolable (min=%d, max=%d)\n",
|
||||
POOL_MIN_SIZE, POOL_MAX_SIZE);
|
||||
}
|
||||
if (size >= 33000 && size <= 41000) { HAKMEM_LOG("[Pool] REJECTED: not poolable (min=%d, max=%d)\n", POOL_MIN_SIZE, POOL_MAX_SIZE); }
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get class and shard indices
|
||||
int class_idx = hak_pool_get_class_index(size);
|
||||
if (class_idx < 0) {
|
||||
if (size >= 33000 && size <= 41000) {
|
||||
fprintf(stderr, "[Pool] REJECTED: class_idx=%d (size=%zu not mapped)\n",
|
||||
class_idx, size);
|
||||
}
|
||||
if (size >= 33000 && size <= 41000) { HAKMEM_LOG("[Pool] REJECTED: class_idx=%d (size=%zu not mapped)\n", class_idx, size); }
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size >= 33000 && size <= 41000) {
|
||||
fprintf(stderr, "[Pool] ACCEPTED: class_idx=%d, proceeding with allocation\n", class_idx);
|
||||
}
|
||||
if (size >= 33000 && size <= 41000) { HAKMEM_LOG("[Pool] ACCEPTED: class_idx=%d, proceeding with allocation\n", class_idx); }
|
||||
|
||||
// MF2: Per-Page Sharding path
|
||||
if (g_mf2_enabled) {
|
||||
|
||||
Reference in New Issue
Block a user