// tiny_c7_hotbox.h - C7 専用 TinyHeap(TinyHeapBox 上の薄ラッパ) // Box 方針: // - C7 (≈1KiB) だけを担当するホットパス入口をここで閉じ込める。 // - 実体の管理は core/box/tiny_heap_box.h の汎用 TinyHeapBox に委譲し、下層 Box との // 接続(Superslab/Warm/Tier)は TinyHeapBox の slow 境界に集約する。 #pragma once #include "tiny_heap_box.h" // 共通 TinyHeap コンテキスト #include "c7_hotpath_env_box.h" // HAKMEM_TINY_C7_HOT gate // 旧 C7HotBox の型名互換(TinyHeapBox の型をエイリアス) typedef tiny_heap_page_t tiny_c7_page_t; typedef tiny_heap_ctx_t tiny_c7_heap_t; // 旧 MAX 設定の互換マクロ #ifndef TINY_C7_HOTBOX_MAX_PAGES #define TINY_C7_HOTBOX_MAX_PAGES TINY_HEAP_MAX_PAGES_PER_CLASS #endif static inline tiny_c7_heap_t* tiny_c7_heap_for_thread(void) { return tiny_heap_ctx_for_thread(); } static inline tiny_c7_page_t* tiny_c7_page_of(void* base_ptr) { return tiny_heap_page_of(tiny_c7_heap_for_thread(), 7, base_ptr); } static inline tiny_c7_page_t* tiny_c7_heap_attach_page(tiny_c7_heap_t* heap, SuperSlab* ss, int slab_idx) { return tiny_heap_attach_page(heap, 7, ss, slab_idx); } static inline void tiny_c7_page_becomes_empty(tiny_c7_heap_t* heap, tiny_c7_page_t* page) { tiny_heap_page_becomes_empty(heap ? heap : tiny_c7_heap_for_thread(), 7, page); } static inline void* tiny_c7_alloc_slow_from_heap(tiny_c7_heap_t* heap) { return tiny_heap_alloc_slow_from_class(heap ? heap : tiny_c7_heap_for_thread(), 7); } // C7 alloc ホットパス(size は Gate で 1024 確定済み) __attribute__((always_inline)) static inline void* tiny_c7_alloc_fast(size_t size) { (void)size; return tiny_heap_alloc_class_fast(tiny_c7_heap_for_thread(), 7, size); } // Superslab/Slab メタが既に分かっている場合の free(Gate から渡されるホットパス用) static inline void tiny_c7_free_fast_with_meta(SuperSlab* ss, int slab_idx, void* base) { tiny_heap_free_class_fast_with_meta(tiny_c7_heap_for_thread(), 7, ss, slab_idx, base); } // C7 free ホットパス(ptr は USER ポインタ) static inline void tiny_c7_free_fast(void* ptr) { tiny_heap_free_class_fast(tiny_c7_heap_for_thread(), 7, ptr); }