Phase 3d-A: SlabMeta Box boundary - Encapsulate SuperSlab metadata access
ChatGPT-guided Box theory refactoring (Phase A: Boundary only). Changes: - Created ss_slab_meta_box.h with 15 inline accessor functions - HOT fields (8): freelist, used, capacity (fast path) - COLD fields (6): class_idx, carved, owner_tid_low (init/debug) - Legacy (1): ss_slab_meta_ptr() for atomic ops - Migrated 14 direct slabs[] access sites across 6 files - hakmem_shared_pool.c (4 sites) - tiny_free_fast_v2.inc.h (1 site) - hakmem_tiny.c (3 sites) - external_guard_box.h (1 site) - hakmem_tiny_lifecycle.inc (1 site) - ss_allocation_box.c (4 sites) Architecture: - Zero overhead (static inline wrappers) - Single point of change for future layout optimizations - Enables Hot/Cold split (Phase C) without touching call sites - A/B testing support via compile-time flags Verification: - Build: ✅ Success (no errors) - Stability: ✅ All sizes pass (128B-1KB, 22-24M ops/s) - Behavior: Unchanged (thin wrapper, no logic changes) Next: Phase B (TLS Cache Merge, +12-18% expected) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
#include "front_gate_v2.h" // Phase 15: For fg_classification_t types
|
||||
#include "ss_slab_meta_box.h" // Phase 3d-A: SlabMeta Box boundary
|
||||
|
||||
// ENV control: mincore enable/disable
|
||||
static inline int external_guard_mincore_enabled(void) {
|
||||
@ -108,7 +109,7 @@ static inline int external_guard_try_free(void* ptr) {
|
||||
fprintf(stderr, "[ExternalGuard] hak_super_lookup(ptr) = %p\n", (void*)ss);
|
||||
if (ss) {
|
||||
fprintf(stderr, "[ExternalGuard] HAKMEM SS FOUND! ptr=%p ss=%p magic=0x%x class=%d\n",
|
||||
ptr, (void*)ss, ss->magic, ss->slabs ? ss->slabs[0].class_idx : -1);
|
||||
ptr, (void*)ss, ss->magic, ss->slabs ? ss_slab_meta_class_idx_get(ss, 0) : -1);
|
||||
}
|
||||
|
||||
// Debug: Check FrontGate classification (types defined in front_gate_v2.h)
|
||||
|
||||
Reference in New Issue
Block a user