44 lines
1.6 KiB
C
44 lines
1.6 KiB
C
|
|
// Box: Legacy Backend (Phase 12)
|
||
|
|
// Purpose: Per-class SuperSlabHead backend (legacy implementation)
|
||
|
|
//
|
||
|
|
// Responsibilities:
|
||
|
|
// - Maintain per-class SuperSlabHead (g_superslab_heads)
|
||
|
|
// - Initialize SuperSlabHead for a class
|
||
|
|
// - Expand SuperSlabHead by allocating new chunks
|
||
|
|
// - Find chunk for a pointer (chunk walk)
|
||
|
|
// - Legacy hint box (per-thread, per-class bump allocation)
|
||
|
|
//
|
||
|
|
// Dependencies:
|
||
|
|
// - ss_allocation_box (superslab_allocate, superslab_free, superslab_init_slab)
|
||
|
|
// - hakmem_tiny_config (g_tiny_class_sizes)
|
||
|
|
//
|
||
|
|
// API:
|
||
|
|
// - init_superslab_head() - initialize SuperSlabHead for a class
|
||
|
|
// - expand_superslab_head() - expand SuperSlabHead by allocating new chunk
|
||
|
|
// - find_chunk_for_ptr() - find chunk for a pointer
|
||
|
|
// - hak_tiny_alloc_superslab_backend_legacy() - per-class backend
|
||
|
|
// - hak_tiny_alloc_superslab_backend_hint() - hint optimization
|
||
|
|
// - hak_tiny_ss_hint_record() - hint recording
|
||
|
|
|
||
|
|
#ifndef SS_LEGACY_BACKEND_BOX_H
|
||
|
|
#define SS_LEGACY_BACKEND_BOX_H
|
||
|
|
|
||
|
|
#include "hakmem_tiny_superslab.h"
|
||
|
|
|
||
|
|
// Global per-class SuperSlabHeads
|
||
|
|
extern SuperSlabHead* g_superslab_heads[TINY_NUM_CLASSES_SS];
|
||
|
|
|
||
|
|
// SuperSlabHead management
|
||
|
|
SuperSlabHead* init_superslab_head(int class_idx);
|
||
|
|
int expand_superslab_head(SuperSlabHead* head);
|
||
|
|
SuperSlab* find_chunk_for_ptr(void* ptr, int class_idx);
|
||
|
|
|
||
|
|
// Legacy backend API
|
||
|
|
void* hak_tiny_alloc_superslab_backend_legacy(int class_idx);
|
||
|
|
|
||
|
|
// Hint box (optional optimization)
|
||
|
|
void* hak_tiny_alloc_superslab_backend_hint(int class_idx);
|
||
|
|
void hak_tiny_ss_hint_record(int class_idx, SuperSlab* ss, int slab_idx);
|
||
|
|
|
||
|
|
#endif // SS_LEGACY_BACKEND_BOX_H
|