HLSf use nuint rather than long, L4 now uses hlsf rather than array to alloc cache line.

This commit is contained in:
Youmu Liu
2026-04-21 20:32:28 +08:00
parent 2e2d64a2ce
commit 4f3e206dcb
11 changed files with 151 additions and 133 deletions
@@ -46,20 +46,20 @@ namespace StgSharp.HighPerformance.Memory
private int _maxUnused;
private int _recycleCount;
internal readonly Hlsf.Entry* _basePtr;
internal readonly CacheLineHead* _basePtr;
internal readonly int* _indexReuse;
public Slab(
nuint ptr
)
{
_basePtr = (Hlsf.Entry*)ptr;
_basePtr = (CacheLineHead*)ptr;
_indexReuse = (int*)(_basePtr + Capacity);
_maxUnused = 0;
_recycleCount = 0;
}
public static nuint RequestedAllocation { get; } = ((nuint)(Unsafe.SizeOf<Hlsf.Entry>() + sizeof(int))) * Capacity;
public static nuint RequestedAllocation { get; } = ((nuint)(Unsafe.SizeOf<CacheLineHead>() + sizeof(int))) * Capacity;
public override nuint Allocate()
{