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
@@ -87,10 +87,7 @@ namespace StgSharp.HighPerformance.Memory
int id
)
{
throw new NotImplementedException();
/*
Tlsf* entry = (Tlsf*)(_entryManager._basePtr + id);
_bufferAllocator.Free(entry);
_bufferAllocator.Free(id);
/**/
}
@@ -100,7 +97,7 @@ namespace StgSharp.HighPerformance.Memory
Span<IL4Predict> predictorSpan
)
{
CacheLineHead* head = &_head[index];
CacheLineMetadata* head = &_head[index];
if (Interlocked.CompareExchange(ref head->RefCount, int.MinValue, 0) == 0)
{
// EvictLine(i + index);
@@ -108,7 +105,7 @@ namespace StgSharp.HighPerformance.Memory
int id = head->Predictor;
IL4Predict predict = predictorSpan[id] ??
throw new L4PredictUnregisteredException(id);
predict.WriteBack(head->Origin, head->Profile, new ReadOnlySpan<byte>((byte*)(ulong)head->Address, (int)(ulong)head->Size));
predict.WriteBack(head->Origin, head->Profile, new ReadOnlySpan<byte>((byte*)(ulong)head->Position, (int)(ulong)head->SizeForAllocator));
RecycleLine(index);
(*_mapCount)[index] = 0;
(*_predictCount)[index] = int.MaxValue;