diff --git a/core/box/tiny_front_config_box.h b/core/box/tiny_front_config_box.h index b6217841..c3b363ce 100644 --- a/core/box/tiny_front_config_box.h +++ b/core/box/tiny_front_config_box.h @@ -80,7 +80,19 @@ // - etc. // // This config box ONLY defines the macros that expand to function calls. -// The functions themselves must be included/defined before using these macros. +// The functions themselves are implemented here as static inline to avoid include order issues. + +// Phase 7-Step6-Fix: Config wrapper functions (for normal mode) +// These are static inline to access static global variables from any include order +static inline int tiny_fastcache_enabled(void) { + extern int g_fastcache_enable; + return g_fastcache_enable; +} + +static inline int sfc_cascade_enabled(void) { + extern int g_sfc_enabled; + return g_sfc_enabled; +} // Config macros (runtime function calls) // These expand to actual function calls in normal mode diff --git a/core/hakmem_tiny_refill.inc.h b/core/hakmem_tiny_refill.inc.h index 5caf1a64..c4e38487 100644 --- a/core/hakmem_tiny_refill.inc.h +++ b/core/hakmem_tiny_refill.inc.h @@ -19,6 +19,7 @@ #include "superslab/superslab_inline.h" #include "box/tls_sll_box.h" #include "box/tiny_header_box.h" // Header Box: Single Source of Truth for header operations +#include "box/tiny_front_config_box.h" // Phase 7-Step6-Fix: Config macros for dead code elimination #include "hakmem_tiny_integrity.h" #include "box/tiny_next_ptr_box.h" #include "tiny_region_id.h" // For HEADER_MAGIC/HEADER_CLASS_MASK (prepare header before SLL push) @@ -157,7 +158,8 @@ static inline void* superslab_tls_bump_fast(int class_idx) { static inline void* tiny_fast_refill_and_take(int class_idx, TinyTLSList* tls) { // 1) Front FastCache から直接 - if (__builtin_expect(g_fastcache_enable && class_idx <= 3, 1)) { + // Phase 7-Step6-Fix: Use config macro for dead code elimination in PGO mode + if (__builtin_expect(TINY_FRONT_FASTCACHE_ENABLED && class_idx <= 3, 1)) { void* fc = fastcache_pop(class_idx); if (fc) { extern unsigned long long g_front_fc_hit[TINY_NUM_CLASSES]; diff --git a/core/tiny_alloc_fast.inc.h b/core/tiny_alloc_fast.inc.h index 1d31a004..78b53e7f 100644 --- a/core/tiny_alloc_fast.inc.h +++ b/core/tiny_alloc_fast.inc.h @@ -28,17 +28,8 @@ #endif #include "hakmem_tiny_integrity.h" // PRIORITY 1-4: Corruption detection -// Phase 7-Step3: Config wrapper functions (for normal mode, eliminated in PGO mode) -// These functions wrap global enable flags for dead code elimination in PGO builds -static inline int tiny_fastcache_enabled(void) { - extern int g_fastcache_enable; - return g_fastcache_enable; -} - -static inline int sfc_cascade_enabled(void) { - extern int g_sfc_enabled; - return g_sfc_enabled; -} +// Phase 7-Step6-Fix: Config wrapper functions moved to tiny_fastcache.c +// (Forward declarations are in tiny_front_config_box.h) #ifdef HAKMEM_TINY_HEADER_CLASSIDX // Ring Cache and Unified Cache removed (A/B test: OFF is faster) #endif