Phase12 debug: restore SUPERSLAB constants/APIs, implement Box2 drain boundary, fix tiny_fast_pop to return BASE, honor TLS SLL toggle in alloc/free fast paths, add fail-fast stubs, and quiet capacity sentinel. Update CURRENT_TASK with A/B results (SLL-off stable; SLL-on crash).

This commit is contained in:
Moe Charm (CI)
2025-11-14 01:02:00 +09:00
parent 03df05ec75
commit fcf098857a
53 changed files with 1608 additions and 2198 deletions

View File

@ -570,13 +570,18 @@ static inline void* tiny_alloc_fast(size_t size) {
}
// Generic front (FastCache/SFC/SLL)
// Respect SLL global toggle; when disabled, skip TLS SLL fast pop entirely
if (__builtin_expect(g_tls_sll_enable, 1)) {
#if HAKMEM_TINY_AGGRESSIVE_INLINE
// Phase 2: Use inline macro (3-4 instructions, zero call overhead)
TINY_ALLOC_FAST_POP_INLINE(class_idx, ptr);
// Phase 2: Use inline macro (3-4 instructions, zero call overhead)
TINY_ALLOC_FAST_POP_INLINE(class_idx, ptr);
#else
// Legacy: Function call (10-15 instructions, 5-10 cycle overhead)
ptr = tiny_alloc_fast_pop(class_idx);
// Legacy: Function call (10-15 instructions, 5-10 cycle overhead)
ptr = tiny_alloc_fast_pop(class_idx);
#endif
} else {
ptr = NULL;
}
if (__builtin_expect(ptr != NULL, 1)) {
HAK_RET_ALLOC(class_idx, ptr);
}
@ -594,13 +599,17 @@ static inline void* tiny_alloc_fast(size_t size) {
{
int refilled = tiny_alloc_fast_refill(class_idx);
if (__builtin_expect(refilled > 0, 1)) {
if (__builtin_expect(g_tls_sll_enable, 1)) {
#if HAKMEM_TINY_AGGRESSIVE_INLINE
// Phase 2: Use inline macro (3-4 instructions, zero call overhead)
TINY_ALLOC_FAST_POP_INLINE(class_idx, ptr);
// Phase 2: Use inline macro (3-4 instructions, zero call overhead)
TINY_ALLOC_FAST_POP_INLINE(class_idx, ptr);
#else
// Legacy: Function call (10-15 instructions, 5-10 cycle overhead)
ptr = tiny_alloc_fast_pop(class_idx);
// Legacy: Function call (10-15 instructions, 5-10 cycle overhead)
ptr = tiny_alloc_fast_pop(class_idx);
#endif
} else {
ptr = NULL;
}
if (ptr) {
HAK_RET_ALLOC(class_idx, ptr);
}