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>
36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
#pragma once
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
#include "hakx/hakx_api.h"
|
|
#include "hakx/hakx_api.h" // ensure API visible for fallback
|
|
#include "hakmem_tiny.h" // tiny alloc/free + class tables / usable_size
|
|
#include "hakmem_super_registry.h" // superslab owner lookup
|
|
|
|
// Bench-only inlined front path to shave call overhead in tiny hot loops.
|
|
// Falls back to HAKMEM backend for non-tiny or miss.
|
|
|
|
static inline void* hakx_malloc_fast(size_t size) {
|
|
if (size <= 128u) {
|
|
void* p = hak_tiny_alloc(size);
|
|
if (p) return p;
|
|
}
|
|
return hakx_malloc(size); // backend (may be HAKMEM/mi/sys)
|
|
}
|
|
|
|
static inline void hakx_free_fast(void* ptr) {
|
|
if (!ptr) return;
|
|
if (hak_tiny_owner_slab(ptr) || hak_super_lookup(ptr)) { hak_tiny_free(ptr); return; }
|
|
hakx_free(ptr);
|
|
}
|
|
|
|
static inline void* hakx_realloc_fast(void* ptr, size_t new_size) {
|
|
if (!ptr) return hakx_malloc_fast(new_size);
|
|
if (new_size == 0) { hakx_free_fast(ptr); return NULL; }
|
|
// No size knowledge here; do a conservative move.
|
|
void* np = hakx_malloc_fast(new_size);
|
|
if (!np) return NULL;
|
|
memcpy(np, ptr, new_size);
|
|
hakx_free_fast(ptr);
|
|
return np;
|
|
}
|