Phase POLICY-FAST-PATH-V2 complete + MID-V35-HOTPATH-OPT-1 design
## Phase POLICY-FAST-PATH-V2 (FROZEN) - Implementation complete: free_policy_fast_v2_box.h + malloc_tiny_fast.h integration - A/B Results: - Mixed (ws=400): -1.6% regression ❌ (branch cost > skip benefit) - C6-heavy (ws=200): +5.4% improvement ✅ - Decision: Default OFF, FROZEN (ws<300 / C6-heavy research only) - Learning: Large WS causes branch misprediction to dominate ## Phase 3-GRADUATE + ENV probe fix - 64-probe retry for getenv() stability during bench_profile putenv() - C6 ULTRA intrusive freelist: FROZEN (research box) ## Phase MID-V35-HOTPATH-OPT-1-DESIGN - Design doc for next optimization target - Target: MID v3.5 alloc/free hot path (C5-C6) - Boxes: Stats Gate, TLS Layout, Boundary Check elimination - Expected: +3-9% on Mixed mainline Files: - core/box/free_policy_fast_v2_box.h (new) - core/box/free_path_stats_box.h/c (policy_fast_v2_skip counter) - core/front/malloc_tiny_fast.h (fast-path integration) - docs/analysis/MID_V35_HOTPATH_OPT_1_DESIGN.md (new) - docs/analysis/PHASE_3_GRADUATE_*.md (new) - CURRENT_TASK.md (phase status update) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -29,16 +29,31 @@ typedef struct FreePathStats {
|
||||
|
||||
// Phase 4-1: Legacy per-class breakdown
|
||||
uint64_t legacy_by_class[8]; // C0-C7 の Legacy fallback 内訳
|
||||
|
||||
// Phase POLICY-FAST-PATH-V2: Fast-path policy skip
|
||||
uint64_t policy_fast_v2_skip; // Phase POLICY-FAST-PATH-V2 fast-path skips
|
||||
} FreePathStats;
|
||||
|
||||
// ENV gate
|
||||
static inline bool free_path_stats_enabled(void) {
|
||||
static int g_enabled = -1;
|
||||
if (__builtin_expect(g_enabled == -1, 0)) {
|
||||
const char* e = getenv("HAKMEM_FREE_PATH_STATS");
|
||||
g_enabled = (e && *e && *e != '0') ? 1 : 0;
|
||||
static int g_enabled = -1; // -1: unknown, 0: off, 1: on
|
||||
static int g_probe_left = 64; // tolerate early getenv() instability (bench_profile putenv)
|
||||
|
||||
if (__builtin_expect(g_enabled == 1, 1)) return true;
|
||||
if (__builtin_expect(g_enabled == 0, 1)) return false;
|
||||
|
||||
const char* e = getenv("HAKMEM_FREE_PATH_STATS");
|
||||
if (e && *e) {
|
||||
g_enabled = (*e != '0') ? 1 : 0;
|
||||
return g_enabled == 1;
|
||||
}
|
||||
return g_enabled;
|
||||
|
||||
if (g_probe_left-- > 0) {
|
||||
return false; // keep g_enabled==-1, retry later
|
||||
}
|
||||
|
||||
g_enabled = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Global stats instance
|
||||
|
||||
Reference in New Issue
Block a user