Phase V6-HDR-4: Headerless 最適化 (P0 + P1)

## P0: Double validation 排除
- region_id_lookup_v6() で TLS segment 登録済み + 範囲内なら
  small_page_meta_v6_of() を呼ばずに直接 page_meta を計算
- 削除された重複チェック:
  - slot->in_use (TLS登録で保証)
  - small_ptr_in_segment_v6() (addr範囲で既にチェック済み)
  - 関数呼び出しオーバーヘッド
- 推定効果: +1-2% (6-8 instructions 削減)

## P1: TLS cache に page_meta キャッシュ追加
- RegionIdTlsCache に追加:
  - last_page_base / last_page_end (ページ範囲)
  - last_page (SmallPageMetaV6* 直接ポインタ)
- region_id_lookup_cached_v6() で same-page hit 時は
  page_meta lookup を完全スキップ
- 推定効果: +1.5-2.5% (10-12 instructions 削減)

## ベンチマーク結果 (揺れあり)
- V6-HDR-3 (P0/P1 前): -3.5% ~ -8.3% 回帰
- V6-HDR-4 (P0+P1 後): +2.7% ~ +12% 改善 (一部の run で)

設計原則:
- RegionIdBox は薄く保つ (分類のみ)
- キャッシュは TLS 側に寄せる
- same-page 判定で last_page_base/end を使用

🤖 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-12 00:16:32 +09:00
parent 969170c0fb
commit ce372cfc7e
2 changed files with 60 additions and 22 deletions

View File

@ -122,9 +122,13 @@ void region_id_observe_unregister(uint32_t id);
// ============================================================================
/// TLS cache for fast lookup (single entry)
/// Phase V6-HDR-4 P1: page_meta キャッシュ追加
typedef struct RegionIdTlsCache {
uintptr_t last_base; // Cached region base
uintptr_t last_end; // Cached region end
uintptr_t last_base; // Cached segment base
uintptr_t last_end; // Cached segment end
uintptr_t last_page_base; // Cached page base (for same-page optimization)
uintptr_t last_page_end; // Cached page end
SmallPageMetaV6* last_page; // Cached page_meta (direct pointer)
RegionLookupV6 last_result; // Cached result
} RegionIdTlsCache;