Phase v7-2: SmallObject v7 C6-only implementation with RegionIdBox integration
- SmallSegment_v7: 2MiB segment with TLS slot and free page stack - ColdIface_v7: Page refill/retire between HotBox and SegmentBox - HotBox_v7: Full C6-only alloc/free with header writing (HEADER_MAGIC|class_idx) - Free path early-exit: Check v7 route BEFORE ss_fast_lookup (separate mmap segment) - RegionIdBox: Register v7 segment for ptr->region lookup - Benchmark: v7 ON ~54.5M ops/s (-7% overhead vs 58.6M legacy baseline) v7 correctly balances alloc/free counts and page lifecycle. RegionIdBox overhead identified as primary cost driver. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -45,6 +45,7 @@
|
||||
#include "../box/smallobject_hotbox_v5_box.h" // SmallObject HotHeap v5 (C6-only route stub, Phase v5-1)
|
||||
#include "../box/smallobject_core_v6_box.h" // SmallObject Core v6 (Phase V6-HDR-2)
|
||||
#include "../box/smallobject_v6_env_box.h" // SmallObject v6 ENV control (Phase V6-HDR-2)
|
||||
#include "../box/smallobject_hotbox_v7_box.h" // SmallObject HotBox v7 stub (Phase v7-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_c5_ultra_free_box.h" // Phase 5-1/5-2: C5 ULTRA-free + alloc integration
|
||||
@ -161,7 +162,7 @@ static inline void* malloc_tiny_fast(size_t size) {
|
||||
route != TINY_ROUTE_LEGACY && route != TINY_ROUTE_HEAP &&
|
||||
route != TINY_ROUTE_HOTHEAP_V2 && route != TINY_ROUTE_SMALL_HEAP_V3 &&
|
||||
route != TINY_ROUTE_SMALL_HEAP_V4 && route != TINY_ROUTE_SMALL_HEAP_V5 &&
|
||||
route != TINY_ROUTE_SMALL_HEAP_V6) {
|
||||
route != TINY_ROUTE_SMALL_HEAP_V6 && route != TINY_ROUTE_SMALL_HEAP_V7) {
|
||||
// Phase ALLOC-GATE-OPT-1: カウンタ散布 (3. route_for_class 呼び出し)
|
||||
ALLOC_GATE_STAT_INC(route_for_class_calls);
|
||||
route = tiny_route_for_class((uint8_t)class_idx);
|
||||
@ -223,6 +224,15 @@ static inline void* malloc_tiny_fast(size_t size) {
|
||||
}
|
||||
|
||||
switch (route) {
|
||||
case TINY_ROUTE_SMALL_HEAP_V7: {
|
||||
// Phase v7-1: C6-only v7 stub (MID v3 fallback)
|
||||
void* v7p = small_heap_alloc_fast_v7_stub(size, (uint8_t)class_idx);
|
||||
if (TINY_HOT_LIKELY(v7p != NULL)) {
|
||||
return v7p;
|
||||
}
|
||||
// v7 stub returned NULL -> fallback to legacy
|
||||
break;
|
||||
}
|
||||
case TINY_ROUTE_SMALL_HEAP_V6: {
|
||||
// Phase V6-HDR-2: Headerless alloc (ENV gated)
|
||||
if (small_v6_headerless_route_enabled((uint8_t)class_idx)) {
|
||||
@ -386,6 +396,16 @@ static inline int free_tiny_fast(void* ptr) {
|
||||
|
||||
tiny_route_kind_t route = tiny_route_for_class((uint8_t)class_idx);
|
||||
|
||||
// Phase v7-2: v7 early-exit for C6 (v7 uses separate mmap segment, not SuperSlab)
|
||||
// Must check BEFORE ss_fast_lookup since v7 pointers won't be in SuperSlab registry
|
||||
if (class_idx == 6 && route == TINY_ROUTE_SMALL_HEAP_V7) {
|
||||
if (small_heap_free_fast_v7_stub(ptr, (uint8_t)class_idx)) {
|
||||
FREE_PATH_STAT_INC(smallheap_v7_fast);
|
||||
return 1;
|
||||
}
|
||||
// v7 returned false (ptr not in v7 segment) -> fallback to legacy below
|
||||
}
|
||||
|
||||
if ((class_idx == 7 || class_idx == 6) &&
|
||||
route == TINY_ROUTE_SMALL_HEAP_V4 &&
|
||||
tiny_ptr_fast_classify_v4_enabled() &&
|
||||
@ -464,6 +484,13 @@ static inline int free_tiny_fast(void* ptr) {
|
||||
// Same-thread + TinyHeap route → route-based free
|
||||
if (__builtin_expect(use_tiny_heap, 0)) {
|
||||
switch (route) {
|
||||
case TINY_ROUTE_SMALL_HEAP_V7: {
|
||||
// Phase v7-1: C6-only v7 stub (MID v3 fallback)
|
||||
if (small_heap_free_fast_v7_stub(ptr, (uint8_t)class_idx)) {
|
||||
return 1;
|
||||
}
|
||||
break; // fallthrough to legacy
|
||||
}
|
||||
case TINY_ROUTE_SMALL_HEAP_V6: {
|
||||
// Phase V6-HDR-2: Headerless free (ENV gated)
|
||||
if (small_v6_headerless_route_enabled((uint8_t)class_idx)) {
|
||||
|
||||
Reference in New Issue
Block a user