// C7 専用の実験的ホットパス。HAKMEM_TINY_C7_HOT=1 でのみ有効化し、 // デフォルト(未設定/0)のときは従来経路に完全フォールバックする。 // 本番デフォルトで ON にしない前提の A/B 用スイッチ。 #pragma once #include "../hakmem_build_flags.h" #include "c7_hotpath_env_box.h" #include "tiny_c7_uc_hit_box.h" #include "tiny_c7_warm_spill_box.h" #include "tiny_c7_stats_sample_box.h" #include "tiny_front_hot_box.h" #include "tiny_front_cold_box.h" #include "front_gate_box.h" #include "tls_sll_box.h" #include "ptr_conversion_box.h" // C7 alloc ホットパス。 // 順序: // 1) TLS/SFC (front_gate_try_pop) を先に覗く // 2) Unified Cache のヒット専用パス tiny_uc_pop_c7_hit_only() // 3) それでもダメなら通常の cold refill(refill/統計は cold 側に任せる) static inline void* tiny_c7_alloc_hot(size_t size) { (void)size; // size は class_idx=7 前提なので未使用 void* user = NULL; // 1) SFC/TLS SLL 直叩き(ユーザーポインタが返る) if (front_gate_try_pop(/*class_idx=*/7, &user)) { return user; } // 2) Unified Cache ヒット user = tiny_uc_pop_c7_hit_only(); if (__builtin_expect(user != NULL, 1)) { return user; } // 3) Cold refill へフォールバック return tiny_cold_refill_and_alloc(7); } // C7 free ホットパス。BASE を受け取り TLS→UC の順に試す。 static inline int tiny_c7_free_hot(void* base) { // 1) TLS SLL へ直接 push(BASE のまま渡す) extern int g_tls_sll_enable; if (__builtin_expect(g_tls_sll_enable, 1)) { if (tls_sll_push(7, HAK_BASE_FROM_RAW(base), UINT32_MAX)) { return 1; } } // 2) Unified Cache へ push(ヒット専用の軽量版) if (tiny_uc_push_c7_hot(base)) { return 1; } // 3) Warm spill(将来用のフック) if (tiny_c7_warm_spill_one(base)) { return 1; } // 4) 最後に cold free パスへフォールバック return tiny_cold_drain_and_free(7, base); }