Files
hakmem/core/box/smallobject_hotbox_v4_box.h
Moe Charm (CI) 2a13478dc7 Optimize C6 heavy and C7 ultra performance analysis with refined design refinements
- Update environment profile presets and visibility analysis
- Enhance small object and tiny segment v4 box implementations
- Refine C7 ultra and C6 heavy allocation strategies
- Add comprehensive performance metrics and design documentation

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-10 22:57:26 +09:00

54 lines
1.7 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_v4_box.h - SmallObject HotHeap v4 (型スケルトン)
//
// 役割:
// - v4 のページ / クラス / TLS コンテキスト型と API 宣言だけを定義する箱。
// - 挙動はまだ v3/v1 のまま。alloc/free 本体は後続フェーズで実装する。
#pragma once
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include "tiny_geometry_box.h"
#ifndef SMALLOBJECT_NUM_CLASSES
#define SMALLOBJECT_NUM_CLASSES TINY_NUM_CLASSES
#endif
struct small_segment_v4;
// Page metadata for v4 HotBox
typedef struct small_page_v4 {
void* freelist;
uint16_t used;
uint16_t capacity;
uint8_t class_idx;
uint8_t flags;
uint32_t block_size;
uint8_t* base;
void* slab_ref; // Superslab / lease token (box境界で扱う)
struct small_segment_v4* segment; // PF3: segment ownerNULLなら Tiny v1 経路)
struct small_page_v4* next;
} small_page_v4;
// Per-class heap state (current / partial / full lists)
typedef struct small_class_heap_v4 {
small_page_v4* current;
small_page_v4* partial_head;
small_page_v4* full_head;
uint32_t partial_count;
} small_class_heap_v4;
// TLS heap context (per-thread)
typedef struct small_heap_ctx_v4 {
small_class_heap_v4 cls[SMALLOBJECT_NUM_CLASSES];
} small_heap_ctx_v4;
// TLS accessor (実装は後続フェーズで追加)
small_heap_ctx_v4* small_heap_ctx_v4_get(void);
// Hot path API (C7-only stub; later phases will expand)
void* small_heap_alloc_fast_v4(small_heap_ctx_v4* ctx, int class_idx);
void small_heap_free_fast_v4(small_heap_ctx_v4* ctx, int class_idx, void* ptr);
int smallobject_hotbox_v4_can_own(int class_idx, void* ptr);