Implement Phase 2: Headerless Allocator Support (Partial)
- Feature: Added HAKMEM_TINY_HEADERLESS toggle (A/B testing) - Feature: Implemented Headerless layout logic (Offset=0) - Refactor: Centralized layout definitions in tiny_layout_box.h - Refactor: Abstracted pointer arithmetic in free path via ptr_conversion_box.h - Verification: sh8bench passes in Headerless mode (No TLS_SLL_HDR_RESET) - Known Issue: Regression in Phase 1 mode due to blind pointer conversion logic
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdlib.h>
|
||||
#include "hakmem_build_flags.h" // Ensure flags are overridden
|
||||
#include "tiny_region_id.h" // For HEADER_MAGIC, HEADER_CLASS_MASK (Fix #6)
|
||||
#include "ptr_track.h" // Pointer tracking for debugging header corruption
|
||||
#include "box/tiny_next_ptr_box.h" // Box API: Next pointer read/write
|
||||
@ -251,7 +252,7 @@ static inline uint32_t trc_pop_from_freelist(struct TinySlabMeta* meta,
|
||||
// DEBUG: Log header restoration for class 2
|
||||
uint8_t before = *(uint8_t*)p;
|
||||
PTR_TRACK_FREELIST_POP(p, class_idx);
|
||||
*(uint8_t*)p = HEADER_MAGIC | (class_idx & HEADER_CLASS_MASK);
|
||||
tiny_header_write_if_preserved(p, class_idx); // Box API
|
||||
PTR_TRACK_HEADER_WRITE(p, HEADER_MAGIC | (class_idx & HEADER_CLASS_MASK));
|
||||
static _Atomic uint64_t g_freelist_count_c2 = 0;
|
||||
if (class_idx == 2) {
|
||||
@ -320,7 +321,7 @@ static inline uint32_t trc_linear_carve(uint8_t* base, size_t bs,
|
||||
for (uint32_t i = 0; i < batch; i++) {
|
||||
uint8_t* block = cursor + (i * stride);
|
||||
PTR_TRACK_CARVE((void*)block, class_idx);
|
||||
*block = HEADER_MAGIC | (class_idx & HEADER_CLASS_MASK);
|
||||
tiny_header_write_if_preserved((void*)block, class_idx); // Box API
|
||||
PTR_TRACK_HEADER_WRITE((void*)block, HEADER_MAGIC | (class_idx & HEADER_CLASS_MASK));
|
||||
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
|
||||
Reference in New Issue
Block a user