Phase 7-Step8: Replace SFC/HEAP_V2/ULTRA_SLIM runtime checks with config macros

**Goal**: Complete dead code elimination infrastructure for all runtime checks

**Changes**:
1. core/box/tiny_front_config_box.h:
   - Rename sfc_cascade_enabled() → tiny_sfc_enabled() (avoid name collision)
   - Update TINY_FRONT_SFC_ENABLED macro to use tiny_sfc_enabled()

2. core/tiny_alloc_fast.inc.h (5 locations):
   - Line 274: tiny_heap_v2_alloc_by_class() - use TINY_FRONT_HEAP_V2_ENABLED
   - Line 431: SFC TLS cache init - use TINY_FRONT_SFC_ENABLED
   - Line 678: SFC cascade check - use TINY_FRONT_SFC_ENABLED
   - Line 740: Ultra SLIM debug check - use TINY_FRONT_ULTRA_SLIM_ENABLED

3. core/hakmem_tiny_free.inc (1 location):
   - Line 233: Heap V2 free path - use TINY_FRONT_HEAP_V2_ENABLED

**Performance**: 79.5M ops/s (maintained, -0.4M vs Step 7, within noise)
- Normal mode: Neutral (runtime checks preserved)
- PGO mode: Ready for dead code elimination

**Total Runtime Checks Replaced (Phase 7)**:
-  TINY_FRONT_FASTCACHE_ENABLED: 3 locations (Step 4-6)
-  TINY_FRONT_TLS_SLL_ENABLED: 7 locations (Step 7)
-  TINY_FRONT_SFC_ENABLED: 2 locations (Step 8)
-  TINY_FRONT_HEAP_V2_ENABLED: 2 locations (Step 8)
-  TINY_FRONT_ULTRA_SLIM_ENABLED: 1 location (Step 8)
**Total**: 15 runtime checks → config macros

**PGO Mode Expected Benefit**:
- Eliminate 15 runtime checks across hot paths
- Reduce branch mispredictions
- Smaller code size (dead code removed by compiler)
- Better instruction cache locality

**Design Complete**: Config Box as single entry point for all Tiny Front policy
- Unified macro interface for all feature toggles
- Include order independent (static inline wrappers)
- Dual-mode support (PGO compile-time vs normal runtime)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-11-29 17:40:05 +09:00
parent 69e6df4cbc
commit 6b75453072
3 changed files with 12 additions and 8 deletions

View File

@ -90,7 +90,7 @@ static inline int tiny_fastcache_enabled(void) {
return g_fastcache_enable;
}
static inline int sfc_cascade_enabled(void) {
static inline int tiny_sfc_enabled(void) {
extern int g_sfc_enabled;
return g_sfc_enabled;
}
@ -104,7 +104,7 @@ static inline int tiny_tls_sll_enabled(void) {
// These expand to actual function calls in normal mode
#define TINY_FRONT_ULTRA_SLIM_ENABLED ultra_slim_mode_enabled()
#define TINY_FRONT_HEAP_V2_ENABLED tiny_heap_v2_enabled()
#define TINY_FRONT_SFC_ENABLED sfc_cascade_enabled()
#define TINY_FRONT_SFC_ENABLED tiny_sfc_enabled()
#define TINY_FRONT_FASTCACHE_ENABLED tiny_fastcache_enabled()
#define TINY_FRONT_TLS_SLL_ENABLED tiny_tls_sll_enabled()
#define TINY_FRONT_UNIFIED_GATE_ENABLED front_gate_unified_enabled()