Files
hakmem/core/box/smallsegment_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

32 lines
1.3 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.

// smallsegment_v5_box.h - SmallSegment v5Phase v5-0
//
// 2MiB Segment / 64KiB Page ベースの O(1) page_meta lookup
#ifndef HAKMEM_SMALLSEGMENT_V5_BOX_H
#define HAKMEM_SMALLSEGMENT_V5_BOX_H
#include <stdint.h>
#include "smallobject_hotbox_v5_box.h"
#define SMALL_SEGMENT_V5_SIZE (2 * 1024 * 1024) // 2 MiB
#define SMALL_SEGMENT_V5_PAGE_SIZE (64 * 1024) // 64 KiB
#define SMALL_SEGMENT_V5_NUM_PAGES (SMALL_SEGMENT_V5_SIZE / SMALL_SEGMENT_V5_PAGE_SIZE) // 32
#define SMALL_SEGMENT_V5_MAGIC 0xDEADBEEF
#define SMALL_SEGMENT_V5_PAGE_SHIFT 16 // log2(64KiB)
// SmallSegmentV5: セグメント構造体
typedef struct SmallSegmentV5 {
uintptr_t base; // セグメント先頭アドレス
uint32_t num_pages; // ページ数(通常は 32
uint32_t owner_tid; // オーナースレッド ID
uint32_t magic; // 0xDEADBEEF for validation
SmallPageMetaV5 page_meta[SMALL_SEGMENT_V5_NUM_PAGES]; // page metadata array
} SmallSegmentV5;
// APIv5-0 では宣言のみ、実装は v5-2
SmallSegmentV5* small_segment_v5_acquire(void);
void small_segment_v5_release(SmallSegmentV5* seg);
SmallPageMetaV5* small_segment_v5_page_meta_of(void* ptr);
#endif // HAKMEM_SMALLSEGMENT_V5_BOX_H