diff --git a/core/hakmem_build_flags.h b/core/hakmem_build_flags.h index 8a414861..c4e5a0f2 100644 --- a/core/hakmem_build_flags.h +++ b/core/hakmem_build_flags.h @@ -91,6 +91,15 @@ # define HAKMEM_TINY_INLINE_SLL 0 #endif +// Phase 1A3: Always-inline tiny_region_id_write_header() +// Default: OFF (HAKMEM_TINY_HEADER_WRITE_ALWAYS_INLINE=0) - enable after A/B validation +// Purpose: Force inline expansion of header write to reduce alloc path overhead +// Expected impact: +0.5-2% on Mixed workloads +// Build: make EXTRA_CFLAGS=-DHAKMEM_TINY_HEADER_WRITE_ALWAYS_INLINE=1 [target] +#ifndef HAKMEM_TINY_HEADER_WRITE_ALWAYS_INLINE +# define HAKMEM_TINY_HEADER_WRITE_ALWAYS_INLINE 0 +#endif + // Phase 7 Task 3: Pre-warm TLS cache at init // Default: OFF (enable after implementation) // Build: make PREWARM_TLS=1 or make phase7 diff --git a/core/tiny_region_id.h b/core/tiny_region_id.h index 4735654e..f60a8fdc 100644 --- a/core/tiny_region_id.h +++ b/core/tiny_region_id.h @@ -212,6 +212,9 @@ static inline int tiny_header_mode(void) // Write class_idx to header (called after allocation) // Input: base (block start from SuperSlab) // Returns: user pointer (base + 1, skipping header) +#if HAKMEM_TINY_HEADER_WRITE_ALWAYS_INLINE +__attribute__((always_inline)) +#endif static inline void* tiny_region_id_write_header(void* base, int class_idx) { if (!base) return base; @@ -439,6 +442,9 @@ static inline size_t tiny_region_id_user_size(size_t alloc_size) { #else // !HAKMEM_TINY_HEADER_CLASSIDX // Disabled: No-op implementations +#if HAKMEM_TINY_HEADER_WRITE_ALWAYS_INLINE +__attribute__((always_inline)) +#endif static inline void* tiny_region_id_write_header(void* ptr, int class_idx) { (void)class_idx; return ptr;