Files
hakmem/core/box/smallobject_hotbox_v5_box.h
Moe Charm (CI) 83d4096fbc Phase v5-0: SmallObject v5 の設計・型/IF/ENV スケルトン追加
設計ドキュメント:
- docs/analysis/SMALLOBJECT_V5_DESIGN.md: v5 アーキテクチャ全体設計

新規ファイル (v5 スケルトン):
- core/box/smallobject_hotbox_v5_box.h: HotBox v5 型定義
- core/box/smallsegment_v5_box.h: Segment v5 型定義
- core/box/smallobject_cold_iface_v5.h: ColdIface v5 IF宣言
- core/box/smallobject_v5_env_box.h: ENV ゲート
- core/smallobject_hotbox_v5.c: 実装 stub (完全 fallback)

特徴:
 型とインターフェースのみ定義(v5-0 は機能なし)
 ENV デフォルト OFF(HAKMEM_SMALL_HEAP_V5_ENABLED=0)
 挙動完全不変(Mixed/C6 benchmark 確認済み)
 v4 との区別を明確化 (*_v5 suffix)
 v5-1 (stub) → v5-2 (本実装) → v5-3 (Mixed) への段階実装準備完了

フェーズ:
- v5-0: 型定義のみ(現在)
- v5-1: C6-only stub route 追加
- v5-2: Segment/HotBox 本実装 (C6-only bench A/B)
- v5-3: Mixed での段階昇格 (C6 → C5 → ...)

目標性能: Mixed 16–1024B で 50–60M ops/s (mimalloc の 5割)

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-11 03:09:57 +09:00

43 lines
1.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// smallobject_hotbox_v5_box.h - SmallObject HotBox v5 型定義Phase v5-0
//
// この段階では型とインターフェース定義のみ。挙動は変わらない。
#ifndef HAKMEM_SMALLOBJECT_HOTBOX_V5_BOX_H
#define HAKMEM_SMALLOBJECT_HOTBOX_V5_BOX_H
#include <stdint.h>
#define NUM_SMALL_CLASSES_V5 8 // C0C7
// SmallPageMetaV5: v5 ページメタデータ
typedef struct SmallPageMetaV5 {
void* free_list; // フリーリスト先頭
uint16_t used; // 使用中ブロック数
uint16_t capacity; // このページの総容量
uint8_t class_idx; // size class index
uint8_t flags; // reserved
uint16_t page_idx; // segment 内でのページインデックス
void* segment; // SmallSegmentV5* への backpointer
} SmallPageMetaV5;
// SmallClassHeapV5: サイズクラス毎のホットヒープ状態
typedef struct SmallClassHeapV5 {
SmallPageMetaV5* current; // 現在のページalloc 中)
SmallPageMetaV5* partial_head; // partial ページリスト
SmallPageMetaV5* full_head; // full ページリスト
} SmallClassHeapV5;
// SmallHeapCtxV5: per-thread ホットヒープコンテキスト
typedef struct SmallHeapCtxV5 {
SmallClassHeapV5 cls[NUM_SMALL_CLASSES_V5];
} SmallHeapCtxV5;
// API
SmallHeapCtxV5* small_heap_ctx_v5(void);
// Fast path将来実装
void* small_alloc_fast_v5(size_t size, uint32_t class_idx);
void small_free_fast_v5(void* ptr, uint32_t class_idx);
#endif // HAKMEM_SMALLOBJECT_HOTBOX_V5_BOX_H