Fix include order in hakmem.c - move hak_kpi_util.inc.h before hak_core_init.inc.h

Problem: hak_core_init.inc.h references KPI measurement variables
(g_latency_histogram, g_latency_samples, g_baseline_soft_pf, etc.)
but hakmem.c was including hak_kpi_util.inc.h AFTER hak_core_init.inc.h,
causing undefined reference errors.

Solution: Reorder includes so hak_kpi_util.inc.h (definition) comes
before hak_core_init.inc.h (usage).

Build result:  Success (libhakmem.so 547KB, 0 errors)

Minor changes:
- Added extern __thread declarations for TLS SLL debug variables
- Added signal handler logging for debug_dump_last_push
- Improved hakmem_tiny.c structure for Phase 2 preparation

🤖 Generated with Claude Code + Task Agent

Co-Authored-By: Gemini <gemini@example.com>
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-12-03 13:28:44 +09:00
parent b5be708b6a
commit 2dc9d5d596
21 changed files with 364 additions and 210 deletions

View File

@ -10,14 +10,18 @@
// Debug-only SIGSEGV handler (gated by HAKMEM_DEBUG_SEGV)
static void hakmem_sigsegv_handler(int sig) {
#ifdef __GLIBC__
void* bt[64]; int n = backtrace(bt, 64);
fprintf(stderr, "\n[HAKMEM][SIGSEGV] dumping backtrace (%d frames)\n", n);
backtrace_symbols_fd(bt, n, fileno(stderr));
#else
(void)sig;
fprintf(stderr, "\n[HAKMEM][SIGSEGV] (execinfo unavailable)\n");
const char* msg = "\n[HAKMEM] Segmentation Fault\n";
(void)write(2, msg, 29);
#if !HAKMEM_BUILD_RELEASE
// Dump Class 1 (16B) last push info for debugging
tiny_debug_dump_last_push(1);
#endif
// Restore default handler and re-raise
signal(sig, SIG_DFL);
raise(sig);
}
// Phase 7 Task 3: Pre-warm TLS cache helper