Files
hakmem/core/link_stubs.c
Moe Charm (CI) dde490f842 Phase 7: header-aware TLS front caches and FG gating
- core/hakmem_tiny_fastcache.inc.h: make tiny_fast_pop/push read/write next at base+1 for C0–C6; clear C7 next on pop
- core/hakmem_tiny_hot_pop.inc.h: header-aware next reads for g_fast_head pops (classes 0–3)
- core/tiny_free_magazine.inc.h: header-aware chain linking for BG spill chain (base+1 for C0–C6)
- core/box/front_gate_classifier.c: registry fallback classifies headerless only for class 7; others as headered

Build OK; bench_fixed_size_hakmem still SIGBUS right after init. FREE_ROUTE trace shows invalid frees (ptr=0xa0, etc.). Next steps: instrument early frees and audit remaining header-aware writes in any front caches not yet patched.
2025-11-10 18:04:08 +09:00

28 lines
1.1 KiB
C

#include <stddef.h>
#include <stdlib.h>
// Weak, no-op stubs to satisfy link in configurations where
// optional components are compiled out or gated by flags.
// Real implementations (when present) will override these.
__attribute__((weak)) void hak_tiny_prewarm_tls_cache(void) {}
// Weak stubs for remote tracking (avoid LTO link errors when tiny_remote.c is GC'ed)
struct SuperSlab; // forward decl to avoid heavy includes
__attribute__((weak)) void tiny_remote_track_on_local_free(struct SuperSlab* ss, int slab_idx, void* node, const char* stage, unsigned int tid) {
(void)ss; (void)slab_idx; (void)node; (void)stage; (void)tid;
}
__attribute__((weak)) void tiny_remote_track_expect_alloc(struct SuperSlab* ss, int slab_idx, void* node, const char* stage, unsigned int tid) {
(void)ss; (void)slab_idx; (void)node; (void)stage; (void)tid;
}
__attribute__((weak)) void* pool_alloc(size_t size) {
// Fallback to malloc if Pool TLS not linked
return malloc(size);
}
__attribute__((weak)) void pool_free(void* ptr) {
// Fallback to free if Pool TLS not linked
free(ptr);
}