Moe Charm (CI)
0c0d9c8c0b
Unify Unified Cache API to BASE-only pointer type with Phantom typing
Core Changes:
- Modified: core/front/tiny_unified_cache.h
* API signatures changed to use hak_base_ptr_t (Phantom type)
* unified_cache_pop() returns hak_base_ptr_t (was void*)
* unified_cache_push() accepts hak_base_ptr_t base (was void*)
* unified_cache_pop_or_refill() returns hak_base_ptr_t (was void*)
* Added #include "../box/ptr_type_box.h" for Phantom types
- Modified: core/front/tiny_unified_cache.c
* unified_cache_refill() return type changed to hak_base_ptr_t
* Uses HAK_BASE_FROM_RAW() for wrapping return values
* Uses HAK_BASE_TO_RAW() for unwrapping parameters
* Maintains internal void* storage in slots array
- Modified: core/box/tiny_front_cold_box.h
* Uses hak_base_ptr_t from unified_cache_refill()
* Uses hak_base_is_null() for NULL checks
* Maintains tiny_user_offset() for BASE→USER conversion
* Cold path refill integration updated to Phantom types
- Modified: core/front/malloc_tiny_fast.h
* Free path wraps BASE pointer with HAK_BASE_FROM_RAW()
* When pushing to Unified Cache via unified_cache_push()
Design Rationale:
- Unified Cache API now exclusively handles BASE pointers (no USER mixing)
- Phantom types enforce type distinction at compile time (debug mode)
- Zero runtime overhead in Release mode (macros expand to identity)
- Hot paths (tiny_hot_alloc_fast, tiny_hot_free_fast) remain unchanged
- Layout consistency maintained via tiny_user_offset() Box
Validation:
- All 25 Phantom type usage sites verified (25/25 correct)
- HAK_BASE_FROM_RAW(): 5/5 correct wrappings
- HAK_BASE_TO_RAW(): 1/1 correct unwrapping
- hak_base_is_null(): 4/4 correct NULL checks
- Compilation: RELEASE=0 and RELEASE=1 both successful
- Smoke tests: 3/3 passed (simple_alloc, loop 10M, pool_tls)
Type Safety Benefits:
- Prevents USER/BASE pointer confusion at API boundaries
- Compile-time checking in debug builds via Phantom struct
- Zero cost abstraction in release builds
- Clear intent: Unified Cache exclusively stores BASE pointers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 12:20:21 +09:00
..
2025-11-14 05:41:49 +09:00
2025-12-04 12:20:21 +09:00
2025-11-14 05:41:49 +09:00
2025-11-28 04:33:39 +09:00
2025-12-04 12:20:21 +09:00
2025-12-03 13:28:44 +09:00
2025-12-04 12:20:21 +09:00