Refactoring: - Type naming: Rename small_page_v4 → SmallPageMeta, small_class_heap_v4 → SmallClassHeap, small_heap_ctx_v4 → SmallHeapCtx - Keep backward compatibility aliases for existing code - SmallSegment struct unified, clean forward declarations - Cold Iface: Remove vtable (SmallColdIfaceV4 struct) in favor of direct function calls - Simplify refill_page/retire_page to direct calls, not callbacks - smallobject_hotbox_v4.c: Update to call small_cold_v4_* functions directly Documentation: - Add docs/analysis/ENV_CLEANUP_CANDIDATES.md - Categorize ENVs: KEEP (production), RESEARCH (opt-in), DELETE (obsolete) - v2 code: Keep as research infrastructure (complete, safe, gated) - v4 code: Research scaffold for future mid-level allocator Build: - ビルド成功(警告のみ) - Backward compatible, all existing code still works 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
62 lines
2.0 KiB
C
62 lines
2.0 KiB
C
// 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 SmallSegment; // Forward declaration, defined in smallsegment_v4_box.h
|
|
|
|
// ============================================================================
|
|
// SmallObject v4 HotBox Type Definitions
|
|
// ============================================================================
|
|
|
|
// SmallPageMeta: Page metadata for v4 HotBox
|
|
typedef struct SmallPageMeta {
|
|
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 boundary)
|
|
struct SmallSegment* segment; // Segment owner (NULL if Tiny v1 path)
|
|
struct SmallPageMeta* next;
|
|
} SmallPageMeta;
|
|
|
|
// SmallClassHeap: Per-class heap state (current / partial / full lists)
|
|
typedef struct SmallClassHeap {
|
|
SmallPageMeta* current;
|
|
SmallPageMeta* partial_head;
|
|
SmallPageMeta* full_head;
|
|
uint32_t partial_count;
|
|
} SmallClassHeap;
|
|
|
|
// SmallHeapCtx: TLS heap context (per-thread)
|
|
typedef struct SmallHeapCtx {
|
|
SmallClassHeap cls[SMALLOBJECT_NUM_CLASSES];
|
|
} SmallHeapCtx;
|
|
|
|
// Backward compatibility aliases (deprecated, use SmallXxx directly)
|
|
typedef SmallPageMeta small_page_v4;
|
|
typedef SmallClassHeap small_class_heap_v4;
|
|
typedef SmallHeapCtx small_heap_ctx_v4;
|
|
|
|
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);
|