Files
hakmem/core/box/smallobject_hotbox_v5_box.h
Moe Charm (CI) 9c24bebf08 Phase v5-1: SmallObject v5 C6-only route stub 接続
- tiny_route_env_box.h: TINY_ROUTE_SMALL_HEAP_V5 enum 追加、route snapshot で C6→v5 分岐
- malloc_tiny_fast.h: alloc/free switch に v5 case 追加(v1/pool fallback)
- smallobject_hotbox_v5.c: stub 実装(alloc は NULL 返却、free は no-op)
- smallobject_hotbox_v5_box.h: 関数 signature に ctx パラメータ追加
- Makefile: core/smallobject_hotbox_v5.o をリンクリストに追加
- ENV_PROFILE_PRESETS.md: v5-1 プリセット追記
- CURRENT_TASK.md: Phase v5-1 完了記録

**特性**:
- ENV: HAKMEM_SMALL_HEAP_V5_ENABLED=1 / HAKMEM_SMALL_HEAP_V5_CLASSES=0x40 で opt-in
- テスト結果: C6-heavy (v5 OFF 15.5M → v5 ON 16.4M ops/s, 正常), Mixed 47.2M ops/s, SEGV/assert なし
- 挙動は v1/pool fallback と同じ(実装は v5-2)

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

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

48 lines
1.9 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 ページメタデータ
// Hot fields (alloc/free 頻繁アクセス) を先頭に集約L1 cache 最適化)
typedef struct SmallPageMetaV5 {
// Hot fields (alloc/free 頻繁アクセス)
void* free_list; // フリーリスト先頭 (offset 0)
uint16_t used; // 使用中ブロック数 (offset 8)
uint16_t capacity; // このページの総容量 (offset 10)
// Metadata初期化時のみ
uint8_t class_idx; // size class index (offset 12)
uint8_t flags; // reserved (offset 13)
uint16_t page_idx; // segment 内でのページインデックス (offset 14)
void* segment; // SmallSegmentV5* への backpointer (offset 16)
} SmallPageMetaV5; // total 24B
// SmallClassHeapV5: サイズクラス毎のホットヒープ状態
typedef struct SmallClassHeapV5 {
SmallPageMetaV5* current; // 現在のページalloc 中)
SmallPageMetaV5* partial_head; // partial ページリスト
SmallPageMetaV5* full_head; // full ページリスト
uint32_t partial_count; // partial ページ数
} SmallClassHeapV5;
// SmallHeapCtxV5: per-thread ホットヒープコンテキスト
typedef struct SmallHeapCtxV5 {
SmallClassHeapV5 cls[NUM_SMALL_CLASSES_V5];
} SmallHeapCtxV5;
// API
SmallHeapCtxV5* small_heap_ctx_v5(void);
// Fast pathPhase v5-1: C6-only route stub, v1/pool fallback
void* small_alloc_fast_v5(size_t size, uint32_t class_idx, SmallHeapCtxV5* ctx);
void small_free_fast_v5(void* ptr, uint32_t class_idx, SmallHeapCtxV5* ctx);
#endif // HAKMEM_SMALLOBJECT_HOTBOX_V5_BOX_H