Phase V6-HDR-0: C6-only headerless core 設計確定

- CURRENT_TASK.md: V6-HDR-0 セクション追加(4層 Box Theory)
- SMALLOBJECT_CORE_V6_DESIGN.md: V6-HDR-0 設計方針追加
- REGIONID_V6_DESIGN.md: RegionIdBox 設計書新規作成
- smallobject_core_v6_box.h: SmallTlsLaneV6 型+TLS API 追加
- smallobject_core_v6.c: OBSERVE モード追加
- region_id_v6_box.h: RegionIdBox 型スケルトン
- page_stats_v6_box.h: PageStatsV6 箱スケルトン
- AGENTS.md: v6 研究箱ルールセクション追加

サニティベンチ: Mixed 42.1M, C6-heavy 25.0M(挙動不変確認)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-12-11 23:07:26 +09:00
parent 2d684ffd25
commit 406835feb3
8 changed files with 624 additions and 23 deletions

View File

@ -31,6 +31,78 @@
---
## Phase V6-HDR-0: C6-only headerless core 設計確定(進行中)
### 目的
Tiny/ULTRA 完成を受け、C6-only で **headerless 設計** を実証する最小コアv6を構築する。
C7 ULTRA は既に完成・凍結されており、v6 は C6 専用の研究ラインとして独立させる。
### 4層 Box Theory設計原則
```
┌──────────────────────────────────────────────────────────────┐
│ L0: ULTRA lanes (TinyC7UltraBox 等) │
│ - C7 ULTRA は frozen / v6 とは独立 │
│ - v6 ULTRA将来は C6-only で別途設計 │
├──────────────────────────────────────────────────────────────┤
│ L1: TLS Box (SmallTlsLaneV6 / SmallHeapCtxV6) │
│ - per-class TLS freelist + current page ptr │
│ - 責務: fast alloc/freeheader 書き込みなし) │
├──────────────────────────────────────────────────────────────┤
│ L2: Segment / ColdIface (SmallSegmentV6 / ColdIfaceV6) │
│ - page_meta[], segment base/end 管理 │
│ - refill / retire の page lifecycle 管理 │
├──────────────────────────────────────────────────────────────┤
│ L3: Policy / RegionIdBox / Stats │
│ - RegionIdBox: ptr→(region_kind, region_id, page_meta) │
│ - PageStatsV6: page lifetime summary占有率、retire 頻度)│
│ - Policy: GC / compaction 決定(将来) │
└──────────────────────────────────────────────────────────────┘
```
### 設計ポイント
1. **C7 ULTRA は独立 frozen 箱**
- TinyC7UltraBox / C7UltraSegmentBox はそのまま維持
- v6 は C7 に触らないC6-only
2. **v6 は C6-only small coreheaderless 研究)**
- alloc 時に header byte を書かないout-of-band metadata
- free 時は RegionIdBox で ptr 分類 → page_meta へ直接アクセス
3. **ptr 分類は RegionIdBox に集約**
- 従来: classify_ptr / hak_super_lookup / ss_fast_lookup など分散
- v6: `region_id_lookup_v6(ptr)` で (region_kind, region_id, page_meta*) を返す
- region_kind: SMALL_V6 / POOL / LARGE / UNKNOWN
4. **Stats/Learning は page lifetime summary のみを L3 に渡す**
- L1/L2 で個別 block の stats は取らない
- page retire 時に summary (total_allocs, avg_lifetime_ns) を L3 へ push
### 実装タスク(本フェーズ)
| No | タスク | 状態 |
|----|--------|------|
| 1-1 | CURRENT_TASK.md 整理(本セクション追加)| ✅ |
| 1-2 | SMALLOBJECT_CORE_V6_DESIGN.md 新規作成 | pending |
| 1-3 | REGIONID_V6_DESIGN.md 新規作成 | pending |
| 2-1 | SmallTlsLaneV6 / SmallHeapCtxV6 型スケルトン | pending |
| 2-2 | v6 TLS API (small_v6_tls_alloc/free) | pending |
| 3-1 | RegionIdBox 型と lookup API スケルトン | pending |
| 3-2 | OBSERVE モードv6 free 入口にログ)| pending |
| 4-1 | PageStatsV6 箱(未接続)| pending |
| 5-1 | AGENTS.md に v6 研究箱ルール追記 | pending |
| 5-2 | サニティベンチMixed / C6-heavy| pending |
### ENV予定
- `HAKMEM_SMALL_CORE_V6_ENABLED=0` (default OFF)
- `HAKMEM_REGION_ID_V6_OBSERVE=0` (default OFF, ログ出力用)
- `HAKMEM_PAGE_STATS_V6_ENABLED=0` (default OFF)
---
---
### 1. ベースライン1 thread, ws=400, iters=1M, seed=1