Cleanup: Unify type naming and Cold Iface architecture

Refactoring:
- Type naming: Rename small_page_v4 → SmallPageMeta, small_class_heap_v4 → SmallClassHeap, small_heap_ctx_v4 → SmallHeapCtx
- Keep backward compatibility aliases for existing code
- SmallSegment struct unified, clean forward declarations
- Cold Iface: Remove vtable (SmallColdIfaceV4 struct) in favor of direct function calls
- Simplify refill_page/retire_page to direct calls, not callbacks
- smallobject_hotbox_v4.c: Update to call small_cold_v4_* functions directly

Documentation:
- Add docs/analysis/ENV_CLEANUP_CANDIDATES.md
- Categorize ENVs: KEEP (production), RESEARCH (opt-in), DELETE (obsolete)
- v2 code: Keep as research infrastructure (complete, safe, gated)
- v4 code: Research scaffold for future mid-level allocator

Build:
- ビルド成功(警告のみ)
- Backward compatible, all existing code still works

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-12-10 23:30:32 +09:00
parent 52c65da783
commit e3e4cab833
5 changed files with 197 additions and 80 deletions

View File

@ -15,10 +15,14 @@
#define SMALLOBJECT_NUM_CLASSES TINY_NUM_CLASSES
#endif
struct small_segment_v4;
struct SmallSegment; // Forward declaration, defined in smallsegment_v4_box.h
// Page metadata for v4 HotBox
typedef struct small_page_v4 {
// ============================================================================
// SmallObject v4 HotBox Type Definitions
// ============================================================================
// SmallPageMeta: Page metadata for v4 HotBox
typedef struct SmallPageMeta {
void* freelist;
uint16_t used;
uint16_t capacity;
@ -26,29 +30,28 @@ typedef struct small_page_v4 {
uint8_t flags;
uint32_t block_size;
uint8_t* base;
void* slab_ref; // Superslab / lease token (box境界で扱う)
struct small_segment_v4* segment; // PF3: segment ownerNULLなら Tiny v1 経路)
struct small_page_v4* next;
} small_page_v4;
void* slab_ref; // Superslab / lease token (box boundary)
struct SmallSegment* segment; // Segment owner (NULL if Tiny v1 path)
struct SmallPageMeta* next;
} SmallPageMeta;
// Per-class heap state (current / partial / full lists)
typedef struct small_class_heap_v4 {
small_page_v4* current;
small_page_v4* partial_head;
small_page_v4* full_head;
// SmallClassHeap: Per-class heap state (current / partial / full lists)
typedef struct SmallClassHeap {
SmallPageMeta* current;
SmallPageMeta* partial_head;
SmallPageMeta* full_head;
uint32_t partial_count;
} small_class_heap_v4;
} SmallClassHeap;
// TLS heap context (per-thread)
typedef struct small_heap_ctx_v4 {
small_class_heap_v4 cls[SMALLOBJECT_NUM_CLASSES];
} small_heap_ctx_v4;
// SmallHeapCtx: TLS heap context (per-thread)
typedef struct SmallHeapCtx {
SmallClassHeap cls[SMALLOBJECT_NUM_CLASSES];
} SmallHeapCtx;
// TLS accessor (実装は後続フェーズで追加)
// SmallPageMeta を external で使う場合のエイリアス
typedef small_page_v4 SmallPageMeta;
typedef small_class_heap_v4 SmallClassHeap;
typedef small_heap_ctx_v4 SmallHeapCtx;
// Backward compatibility aliases (deprecated, use SmallXxx directly)
typedef SmallPageMeta small_page_v4;
typedef SmallClassHeap small_class_heap_v4;
typedef SmallHeapCtx small_heap_ctx_v4;
small_heap_ctx_v4* small_heap_ctx_v4_get(void);