Files
hakmem/core/box/smallsegment_v4_box.h
Moe Charm (CI) e3e4cab833 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>
2025-12-10 23:30:32 +09:00

33 lines
1.4 KiB
C

// smallsegment_v4_box.h - Small-object専用 Segment Box の型定義と API 宣言
// Phase v4-mid-0: SmallSegment の型と API だけを先行定義。実装は後フェーズ。
#pragma once
#include <stdint.h>
// Forward declaration
struct SmallPageMeta;
// ============================================================================
// SmallSegment: class_idx ごとに小さな segment を管理
// ============================================================================
typedef struct SmallSegment {
uintptr_t base; // Segment base address
uint32_t num_pages; // Number of pages in segment
uint32_t owner_tid; // Thread ID that owns this segment
uint32_t magic; // Magic number for validation
// Page metadata array (flexible, actual size depends on SMALL_PAGE_SIZE / SMALL_SEGMENT_SIZE)
// struct SmallPageMeta* page_meta[];
} SmallSegment;
// Backward compatibility alias
typedef SmallSegment small_segment_v4;
// ============================================================================
// API: Segment Management
// ============================================================================
SmallSegment* smallsegment_v4_acquire(int class_idx);
void smallsegment_v4_release_if_empty(SmallSegment* seg, void* page, int class_idx);
struct SmallPageMeta* smallsegment_v4_page_meta_of(SmallSegment* seg, void* ptr);