Phase 7-Step7: Replace g_tls_sll_enable with TINY_FRONT_TLS_SLL_ENABLED macro
**Goal**: Enable dead code elimination for TLS SLL checks in PGO mode **Changes**: 1. core/box/tiny_front_config_box.h: - Add TINY_FRONT_TLS_SLL_ENABLED macro (PGO: 1, Normal: tiny_tls_sll_enabled()) - Add tiny_tls_sll_enabled() wrapper function (static inline) 2. core/tiny_alloc_fast.inc.h (5 hot path locations): - Line 220: tiny_heap_v2_refill_mag() - early return check - Line 388: SLIM mode - SLL freelist check - Line 459: tiny_alloc_fast_pop() - Layer 1 SLL check - Line 774: Main alloc path - cached sll_enabled check (most critical!) - Line 815: Generic front - SLL toggle respect 3. core/hakmem_tiny_refill.inc.h (2 locations): - Line 186: bulk_mag_refill_fc() - refill from SLL - Line 213: bulk_mag_to_sll_if_room() - push to SLL **Performance**: 79.9M ops/s (maintained, +0.1M vs Step 6) - Normal mode: Same performance (runtime checks preserved) - PGO mode: Dead code elimination ready (if (!1) → removed by compiler) **Expected PGO benefit**: - Eliminate 7 TLS SLL checks across hot paths - Reduce instruction count in main alloc loop - Better branch prediction (no runtime checks) **Design**: Config Box as single entry point - All TLS SLL checks now use TINY_FRONT_TLS_SLL_ENABLED - Consistent pattern with FASTCACHE/SFC/HEAP_V2 macros - Include order independent (wrapper in config box header) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -52,6 +52,7 @@
|
||||
#define TINY_FRONT_HEAP_V2_ENABLED 0 // Disabled (use Unified Cache)
|
||||
#define TINY_FRONT_SFC_ENABLED 1 // Enabled (SFC cascade)
|
||||
#define TINY_FRONT_FASTCACHE_ENABLED 0 // Disabled (use Unified Cache)
|
||||
#define TINY_FRONT_TLS_SLL_ENABLED 1 // Enabled (TLS SLL freelist)
|
||||
#define TINY_FRONT_UNIFIED_GATE_ENABLED 1 // Enabled (Front Gate Unification)
|
||||
#define TINY_FRONT_METRICS_ENABLED 0 // Disabled (no runtime overhead)
|
||||
#define TINY_FRONT_DIAG_ENABLED 0 // Disabled (no diagnostics)
|
||||
@ -94,12 +95,18 @@ static inline int sfc_cascade_enabled(void) {
|
||||
return g_sfc_enabled;
|
||||
}
|
||||
|
||||
static inline int tiny_tls_sll_enabled(void) {
|
||||
extern int g_tls_sll_enable;
|
||||
return g_tls_sll_enable;
|
||||
}
|
||||
|
||||
// Config macros (runtime function calls)
|
||||
// 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_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()
|
||||
#define TINY_FRONT_METRICS_ENABLED tiny_metrics_enabled()
|
||||
#define TINY_FRONT_DIAG_ENABLED tiny_diag_enabled()
|
||||
|
||||
Reference in New Issue
Block a user