Phase v5-2: SmallObject v5 C6-only 本実装 (WIP - header fix)

本実装修正:
- tiny_region_id_write_header() を追加: USER pointer を正しく返す
- TLS slot からの segment 探索 (page_meta_of)
- Page-level allocation で segment 再利用
- 2MiB alignment 保証 (4MiB 確保 + alignment)
- free パスの route 修正 (v4 から v5 への fallthrough 削除)

動作確認:
- SEGV 消失: alloc/free 基本動作 OK
- 性能: ~18-20M ops/s (baseline 43-47M の約 40-45%)
- 回帰原因: TLS slot 線形探索 O(n)、find_page O(n)

残タスク:
- O(1) segment lookup 最適化 (hash または array 直接参照)
- find_page 除去 (segment lookup 成功時)
- partial_count/list 管理の最適化

ENV デフォルト OFF なので本線影響なし。

🤖 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 03:47:24 +09:00
parent 9c24bebf08
commit e0fb7d550a
8 changed files with 742 additions and 63 deletions

View File

@ -360,18 +360,18 @@ static inline int free_tiny_fast(void* ptr) {
// Same-thread + TinyHeap route → route-based free
if (__builtin_expect(use_tiny_heap, 0)) {
switch (route) {
case TINY_ROUTE_SMALL_HEAP_V5: {
// Phase v5-2: C6-only full implementation
SmallHeapCtxV5* ctx = small_heap_ctx_v5();
small_free_fast_v5(base, (uint32_t)class_idx, ctx);
return 1;
}
case TINY_ROUTE_SMALL_HEAP_V4:
if (class_idx == 7 || class_idx == 6 || class_idx == 5) {
small_heap_free_fast_v4(small_heap_ctx_v4_get(), class_idx, base);
return 1;
}
__attribute__((fallthrough));
case TINY_ROUTE_SMALL_HEAP_V5: {
// Phase v5-1: C6-only route stub (v1/pool fallback)
SmallHeapCtxV5* ctx = small_heap_ctx_v5();
small_free_fast_v5(base, (uint32_t)class_idx, ctx);
return 1;
}
break; // fallthrough to default
case TINY_ROUTE_SMALL_HEAP_V3:
so_free((uint32_t)class_idx, base);
return 1;