Fix C7 warm/TLS Release path and unify debug instrumentation
This commit is contained in:
@ -4,6 +4,10 @@
|
||||
// Date: 2025-11-28
|
||||
|
||||
#include "hakmem_tiny_superslab_internal.h"
|
||||
#include "box/c7_meta_used_counter_box.h"
|
||||
#include <stdatomic.h>
|
||||
|
||||
static _Atomic uint32_t g_c7_backend_calls = 0;
|
||||
|
||||
// Note: Legacy backend moved to archive/superslab_backend_legacy.c (not built).
|
||||
|
||||
@ -83,6 +87,20 @@ void* hak_tiny_alloc_superslab_backend_shared(int class_idx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (class_idx == 7) {
|
||||
uint32_t n = atomic_fetch_add_explicit(&g_c7_backend_calls, 1, memory_order_relaxed);
|
||||
if (n < 8) {
|
||||
fprintf(stderr,
|
||||
"[REL_C7_BACKEND_CALL] cls=%d meta_cls=%u used=%u cap=%u ss=%p slab=%d\n",
|
||||
class_idx,
|
||||
(unsigned)meta->class_idx,
|
||||
(unsigned)meta->used,
|
||||
(unsigned)meta->capacity,
|
||||
(void*)ss,
|
||||
slab_idx);
|
||||
}
|
||||
}
|
||||
|
||||
// Simple bump allocation within this slab.
|
||||
if (meta->used >= meta->capacity) {
|
||||
// Slab exhausted: in minimal Phase12-2 backend we do not loop;
|
||||
@ -101,6 +119,7 @@ void* hak_tiny_alloc_superslab_backend_shared(int class_idx)
|
||||
uint8_t* base = (uint8_t*)ss + slab_base_off + offset;
|
||||
|
||||
meta->used++;
|
||||
c7_meta_used_note(class_idx, C7_META_USED_SRC_BACKEND);
|
||||
atomic_fetch_add_explicit(&ss->total_active_blocks, 1, memory_order_relaxed);
|
||||
|
||||
HAK_RET_ALLOC_BLOCK_TRACED(class_idx, base, ALLOC_PATH_BACKEND);
|
||||
|
||||
Reference in New Issue
Block a user