Boxify superslab registry, add bench profile, and document C7 hotpath experiments
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
#include "tiny_tls_guard.h"
|
||||
#include "tiny_ready.h"
|
||||
#include "box/c7_meta_used_counter_box.h"
|
||||
#include "box/super_reg_box.h"
|
||||
#include "hakmem_tiny_tls_list.h"
|
||||
#include "hakmem_tiny_remote_target.h" // Phase 2C-1: Remote target queue
|
||||
#include "hakmem_tiny_bg_spill.h" // Phase 2C-2: Background spill queue
|
||||
@ -124,7 +125,7 @@ static void* __attribute__((cold, noinline)) hak_tiny_alloc_slow(size_t size, in
|
||||
// Box: adopt_gate_try (implementation moved from header for robust linkage)
|
||||
// ---------------------------------------------------------------------------
|
||||
#include "box/adopt_gate_box.h"
|
||||
extern SuperSlab* g_super_reg_by_class[TINY_NUM_CLASSES][SUPER_REG_PER_CLASS];
|
||||
#include "box/super_reg_box.h"
|
||||
extern int g_super_reg_class_size[TINY_NUM_CLASSES];
|
||||
extern unsigned long long g_adopt_gate_calls[];
|
||||
extern unsigned long long g_adopt_gate_success[];
|
||||
@ -137,6 +138,10 @@ SuperSlab* adopt_gate_try(int class_idx, TinyTLSSlab* tls) {
|
||||
if (ss) { g_adopt_gate_success[class_idx]++; return ss; }
|
||||
g_reg_scan_attempts[class_idx]++;
|
||||
int reg_size = g_super_reg_class_size[class_idx];
|
||||
int reg_cap = super_reg_effective_per_class();
|
||||
if (reg_cap > 0 && reg_size > reg_cap) {
|
||||
reg_size = reg_cap;
|
||||
}
|
||||
int scan_limit = tiny_reg_scan_max();
|
||||
if (scan_limit > reg_size) scan_limit = reg_size;
|
||||
uint32_t self_tid = tiny_self_u32();
|
||||
@ -156,7 +161,7 @@ SuperSlab* adopt_gate_try(int class_idx, TinyTLSSlab* tls) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < scan_limit; i++) {
|
||||
SuperSlab* cand = g_super_reg_by_class[class_idx][i];
|
||||
SuperSlab* cand = super_reg_by_class_at(class_idx, i);
|
||||
if (!(cand && cand->magic == SUPERSLAB_MAGIC)) continue;
|
||||
// Fast path: use nonempty_mask / freelist_mask to locate candidates in O(1)
|
||||
uint32_t mask = cand->nonempty_mask;
|
||||
|
||||
Reference in New Issue
Block a user