working on L4's tlsf

This commit is contained in:
Youmu Liu
2026-05-14 20:15:07 +08:00
parent c9fb11b47b
commit b87943495d
5 changed files with 126 additions and 139 deletions
@@ -74,13 +74,13 @@ namespace StgSharp.HighPerformance.Memory
// now prefetch the misses
for (int i = 0; i < missIndex; i++)
{
CacheLineHead* head;
CacheLineMetadata* head;
ref CacheLineDescription pHandle = ref span[i];
nuint address = pHandle.Address;
int index;
if (_map.TryGet(address, out nuint handle))
{
head = (CacheLineHead*)handle;
head = (CacheLineMetadata*)handle;
index = head->Id;
(*_predictCount)[index] = 0; // reset eviction counter
@@ -146,7 +146,7 @@ namespace StgSharp.HighPerformance.Memory
(*_mapCount)[index] = 1;
// pre fetch them here
predict.Prefetch(head->Origin, head->Profile, new Span<byte>((byte*)(ulong)head->Address, (int)(ulong)head->Size));
predict.Prefetch(head->Origin, head->Profile, new Span<byte>((byte*)(ulong)head->Address, (int)(ulong)head->SizeForAllocator));
_ = _map.TryAddOrSet(address, (nuint)head, out _);
}
_ = Interlocked.Add(ref _aheadCount, actualCount);