Comprehensive legacy cleanup and architecture consolidation

Summary of Changes:

MOVED TO ARCHIVE:
- core/hakmem_tiny_legacy_slow_box.inc → archive/
  * Slow path legacy code preserved for reference
  * Superseded by Gatekeeper Box architecture

- core/superslab_allocate.c → archive/superslab_allocate_legacy.c
  * Legacy SuperSlab allocation implementation
  * Functionality integrated into new Box system

- core/superslab_head.c → archive/superslab_head_legacy.c
  * Legacy slab head management
  * Refactored through Box architecture

REMOVED DEAD CODE:
- Eliminated unused allocation policy variants from ss_allocation_box.c
  * Reduced from 127+ lines of conditional logic to focused implementation
  * Removed: old policy branches, unused allocation strategies
  * Kept: current Box-based allocation path

ADDED NEW INFRASTRUCTURE:
- core/superslab_head_stub.c (41 lines)
  * Minimal stub for backward compatibility
  * Delegates to new architecture

- Enhanced core/superslab_cache.c (75 lines added)
  * Added missing API functions for cache management
  * Proper interface for SuperSlab cache integration

REFACTORED CORE SYSTEMS:
- core/hakmem_super_registry.c
  * Moved registration logic from scattered locations
  * Centralized SuperSlab registry management

- core/hakmem_tiny.c
  * Removed 27 lines of redundant initialization
  * Simplified through Box architecture

- core/hakmem_tiny_alloc.inc
  * Streamlined allocation path to use Gatekeeper
  * Removed legacy decision logic

- core/box/ss_allocation_box.c/h
  * Dramatically simplified allocation policy
  * Removed conditional branches for unused strategies
  * Focused on current Box-based approach

BUILD SYSTEM:
- Updated Makefile for archive structure
- Removed obsolete object file references
- Maintained build compatibility

SAFETY & TESTING:
- All deletions verified: no broken references
- Build verification: RELEASE=0 and RELEASE=1 pass
- Smoke tests: 100% pass rate
- Functional verification: allocation/free intact

Architecture Consolidation:
Before: Multiple overlapping allocation paths with legacy code branches
After:  Single unified path through Gatekeeper Boxes with clear architecture

Benefits:
- Reduced code size and complexity
- Improved maintainability
- Single source of truth for allocation logic
- Better diagnostic/observability hooks
- Foundation for future optimizations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm (CI)
2025-12-04 14:22:48 +09:00
parent a0a80f5403
commit 25cb7164c7
19 changed files with 218 additions and 222 deletions

View File

@ -1,11 +1,10 @@
// Box: Core Allocation
// Purpose: SuperSlab allocation/deallocation and slab initialization
// Purpose: SuperSlab allocation/deallocation(割り当ての出入口 Box
//
// Responsibilities:
// - Allocate SuperSlab with ACE-aware sizing
// - Free SuperSlab with LRU cache integration
// - Initialize slab metadata (capacity, stride, freelist)
// - Drain remote MPSC stack to freelist
// - Defer slablevel details to Slab Management Box
//
// Dependencies:
// - ss_os_acquire_box (OS-level mmap/munmap)
@ -18,8 +17,6 @@
// API:
// - superslab_allocate() - main allocation entry
// - superslab_free() - deallocation with LRU cache
// - superslab_init_slab() - slab metadata initialization
// - _ss_remote_drain_to_freelist_unsafe() - remote drain helper
#ifndef SS_ALLOCATION_BOX_H
#define SS_ALLOCATION_BOX_H
@ -33,10 +30,4 @@ SuperSlab* superslab_allocate(uint8_t size_class);
// SuperSlab deallocation (LRU cache integration)
void superslab_free(SuperSlab* ss);
// Slab initialization
void superslab_init_slab(SuperSlab* ss, int slab_idx, size_t block_size, uint32_t owner_tid);
// Remote drain helper (ownership already verified by caller)
void _ss_remote_drain_to_freelist_unsafe(SuperSlab* ss, int slab_idx, TinySlabMeta* meta);
#endif // SS_ALLOCATION_BOX_H