diff --git a/core/box/tiny_ultra_classes_box.h b/core/box/tiny_ultra_classes_box.h new file mode 100644 index 00000000..1207600d --- /dev/null +++ b/core/box/tiny_ultra_classes_box.h @@ -0,0 +1,13 @@ +#ifndef HAKMEM_TINY_ULTRA_CLASSES_BOX_H +#define HAKMEM_TINY_ULTRA_CLASSES_BOX_H + +// Purpose: Named constants for ULTRA tier classes (C6, C7) +#define TINY_CLASS_C6 6 +#define TINY_CLASS_C7 7 + +// Helper macros for class checking +#define tiny_class_is_c6(idx) ((idx) == TINY_CLASS_C6) +#define tiny_class_is_c7(idx) ((idx) == TINY_CLASS_C7) +#define tiny_class_is_ultra(idx) (tiny_class_is_c6(idx) || tiny_class_is_c7(idx)) + +#endif // HAKMEM_TINY_ULTRA_CLASSES_BOX_H diff --git a/core/front/malloc_tiny_fast.h b/core/front/malloc_tiny_fast.h index ee3a5968..1a313bc8 100644 --- a/core/front/malloc_tiny_fast.h +++ b/core/front/malloc_tiny_fast.h @@ -47,6 +47,7 @@ // #include "../box/smallobject_core_v6_box.h" // SmallObject Core v6 (C6-only route stub, Phase v6-1) #include "../box/tiny_c7_ultra_box.h" // C7 ULTRA stub (UF-1, delegates to v3) #include "../box/tiny_c6_ultra_free_box.h" // Phase 4-2: C6 ULTRA-free (free-only, C6-only) +#include "../box/tiny_ultra_classes_box.h" // Phase REFACTOR-1: Named constants for C6/C7 #include "../box/tiny_front_v3_env_box.h" // Tiny front v3 snapshot gate #include "../box/tiny_heap_env_box.h" // ENV gate for TinyHeap front (A/B) #include "../box/tiny_route_env_box.h" // Route snapshot (Heap vs Legacy) @@ -177,7 +178,7 @@ static inline void* malloc_tiny_fast(size_t size) { tiny_front_alloc_stat_inc(class_idx); // C7 ULTRA stub (UF-1): delegates to v3, ENV gated - if (class_idx == 7 && + if (tiny_class_is_c7(class_idx) && tiny_front_v3_enabled() && tiny_front_v3_c7_ultra_enabled() && small_heap_v3_c7_enabled()) { @@ -189,7 +190,7 @@ static inline void* malloc_tiny_fast(size_t size) { } // Phase 4-4: C6 ULTRA free+alloc integration (寄生型 TLS キャッシュ pop) - if (class_idx == 6 && tiny_c6_ultra_free_enabled()) { + if (tiny_class_is_c6(class_idx) && tiny_c6_ultra_free_enabled()) { TinyC6UltraFreeTLS* ctx = tiny_c6_ultra_free_tls(); if (TINY_HOT_LIKELY(ctx->count > 0)) { void* base = ctx->freelist[--ctx->count]; @@ -322,7 +323,7 @@ static inline int free_tiny_fast(void* ptr) { FREE_PATH_STAT_INC(total_calls); // C7 ULTRA stub (UF-1): delegates to v3, ENV gated - if (class_idx == 7 && + if (tiny_class_is_c7(class_idx) && tiny_front_v3_enabled() && tiny_front_v3_c7_ultra_enabled() && small_heap_v3_c7_enabled()) { @@ -333,7 +334,7 @@ static inline int free_tiny_fast(void* ptr) { } // Phase 4-2: C6 ULTRA-free (C6-only, free-only, ENV gated) - if (class_idx == 6 && tiny_c6_ultra_free_enabled()) { + if (tiny_class_is_c6(class_idx) && tiny_c6_ultra_free_enabled()) { tiny_c6_ultra_free_fast(base, class_idx); return 1; }