28 lines
966 B
C
28 lines
966 B
C
|
|
// tiny_alloc_fast_push.c - Out-of-line helper for Box 5/6
|
||
|
|
// Purpose:
|
||
|
|
// Provide a non-inline definition of tiny_alloc_fast_push() for TUs
|
||
|
|
// that include tiny_free_fast_v2.inc.h / hak_free_api.inc.h without
|
||
|
|
// also including tiny_alloc_fast.inc.h.
|
||
|
|
//
|
||
|
|
// Box Theory:
|
||
|
|
// - Box 5 (Alloc Fast Path) owns the TLS freelist push semantics.
|
||
|
|
// - This file is a thin proxy that reuses existing Box APIs
|
||
|
|
// (front_gate_push_tls or tls_sll_push) without duplicating policy.
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
#include "hakmem_tiny_config.h"
|
||
|
|
#include "box/tls_sll_box.h"
|
||
|
|
#include "box/front_gate_box.h"
|
||
|
|
|
||
|
|
void tiny_alloc_fast_push(int class_idx, void* ptr) {
|
||
|
|
#ifdef HAKMEM_TINY_FRONT_GATE_BOX
|
||
|
|
// When FrontGate Box is enabled, delegate to its TLS push helper.
|
||
|
|
front_gate_push_tls(class_idx, ptr);
|
||
|
|
#else
|
||
|
|
// Default: push directly into TLS SLL with "unbounded" capacity.
|
||
|
|
uint32_t capacity = UINT32_MAX;
|
||
|
|
(void)tls_sll_push(class_idx, ptr, capacity);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
|