Boxify superslab registry, add bench profile, and document C7 hotpath experiments
This commit is contained in:
@ -36,6 +36,7 @@
|
||||
#include "../hakmem_tiny.h" // For hak_tiny_size_to_class
|
||||
#include "../box/tiny_front_hot_box.h" // Phase 4-Step2: Hot Path Box
|
||||
#include "../box/tiny_front_cold_box.h" // Phase 4-Step2: Cold Path Box
|
||||
#include "../box/tiny_c7_hotpath_box.h" // Optional: C7 専用ホットパス
|
||||
|
||||
// Helper: current thread id (low 32 bits) for owner check
|
||||
#ifndef TINY_SELF_U32_LOCAL_DEFINED
|
||||
@ -98,6 +99,11 @@ static inline void* malloc_tiny_fast(size_t size) {
|
||||
// 1. size → class_idx (inline table lookup, 1-2 instructions)
|
||||
int class_idx = hak_tiny_size_to_class(size);
|
||||
|
||||
// Optional: C7 専用ホットパス(環境変数 HAKMEM_TINY_C7_HOT でON)
|
||||
if (__builtin_expect(class_idx == 7 && tiny_c7_hot_enabled(), 0)) {
|
||||
return tiny_c7_alloc_hot(size);
|
||||
}
|
||||
|
||||
// 2. Phase 4-Step2: Hot/Cold Path Box
|
||||
// Try hot path first (cache hit, 1 branch)
|
||||
void* ptr = tiny_hot_alloc_fast(class_idx);
|
||||
@ -235,6 +241,14 @@ static inline int free_tiny_fast(void* ptr) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Optional: C7 専用ホットパス(キャッシュのみで完了させる)
|
||||
if (__builtin_expect(class_idx == 7 && tiny_c7_hot_enabled(), 0)) {
|
||||
if (tiny_c7_free_hot(base)) {
|
||||
return 1;
|
||||
}
|
||||
// fallthrough to unified cache push on failure
|
||||
}
|
||||
|
||||
int pushed = unified_cache_push(class_idx, HAK_BASE_FROM_RAW(base));
|
||||
if (__builtin_expect(pushed, 1)) {
|
||||
return 1; // Success
|
||||
|
||||
Reference in New Issue
Block a user