Major Features: - Debug counter infrastructure for Refill Stage tracking - Free Pipeline counters (ss_local, ss_remote, tls_sll) - Diagnostic counters for early return analysis - Unified larson.sh benchmark runner with profiles - Phase 6-3 regression analysis documentation Bug Fixes: - Fix SuperSlab disabled by default (HAKMEM_TINY_USE_SUPERSLAB) - Fix profile variable naming consistency - Add .gitignore patterns for large files Performance: - Phase 6-3: 4.79 M ops/s (has OOM risk) - With SuperSlab: 3.13 M ops/s (+19% improvement) This is a clean repository without large log files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
38 lines
1.6 KiB
C
38 lines
1.6 KiB
C
// Inline helpers for Background Refill Bin (lock-free SLL)
|
|
// This header is textually included from hakmem_tiny.c after the following
|
|
// symbols are defined:
|
|
// - g_bg_bin_enable, g_bg_bin_target, g_bg_bin_head[]
|
|
// - tiny_bg_refill_main() declaration/definition if needed
|
|
|
|
static inline void* bgbin_pop(int class_idx) {
|
|
if (!g_bg_bin_enable) return NULL;
|
|
uintptr_t h = atomic_load_explicit(&g_bg_bin_head[class_idx], memory_order_acquire);
|
|
while (h != 0) {
|
|
void* p = (void*)h;
|
|
uintptr_t next = (uintptr_t)(*(void**)p);
|
|
if (atomic_compare_exchange_weak_explicit(&g_bg_bin_head[class_idx], &h, next,
|
|
memory_order_acq_rel, memory_order_acquire)) {
|
|
#if HAKMEM_DEBUG_COUNTERS
|
|
g_bgbin_pops[class_idx]++;
|
|
#endif
|
|
return p;
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
static inline void bgbin_push_chain(int class_idx, void* chain_head, void* chain_tail) {
|
|
if (!chain_head) return;
|
|
uintptr_t h = atomic_load_explicit(&g_bg_bin_head[class_idx], memory_order_acquire);
|
|
do { *(void**)chain_tail = (void*)h; }
|
|
while (!atomic_compare_exchange_weak_explicit(&g_bg_bin_head[class_idx], &h,
|
|
(uintptr_t)chain_head,
|
|
memory_order_acq_rel, memory_order_acquire));
|
|
}
|
|
|
|
static inline int bgbin_length_approx(int class_idx, int cap) {
|
|
uintptr_t h = atomic_load_explicit(&g_bg_bin_head[class_idx], memory_order_acquire);
|
|
int n = 0; while (h && n < cap) { void* p = (void*)h; h = (uintptr_t)(*(void**)p); n++; }
|
|
return n;
|
|
}
|