Remove hlsf, TLSF.alloc is ok
This commit is contained in:
@@ -35,7 +35,7 @@ using System.Runtime.Intrinsics.X86;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using HlsfEntry = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocator.Entry;
|
||||
using Tlsf = StgSharp.HighPerformance.Memory.TwoLayerSegregatedFitAllocator;
|
||||
|
||||
namespace StgSharp.HighPerformance.Memory
|
||||
{
|
||||
@@ -87,8 +87,11 @@ namespace StgSharp.HighPerformance.Memory
|
||||
int id
|
||||
)
|
||||
{
|
||||
HlsfEntry* entry = (HlsfEntry*)(_entryManager._basePtr + id);
|
||||
throw new NotImplementedException();
|
||||
/*
|
||||
Tlsf* entry = (Tlsf*)(_entryManager._basePtr + id);
|
||||
_bufferAllocator.Free(entry);
|
||||
/**/
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -105,7 +108,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*)head->Address, (int)head->Size));
|
||||
predict.WriteBack(head->Origin, head->Profile, new ReadOnlySpan<byte>((byte*)(ulong)head->Address, (int)(ulong)head->Size));
|
||||
RecycleLine(index);
|
||||
(*_mapCount)[index] = 0;
|
||||
(*_predictCount)[index] = int.MaxValue;
|
||||
@@ -121,12 +124,14 @@ namespace StgSharp.HighPerformance.Memory
|
||||
|
||||
)
|
||||
{
|
||||
if (!_bufferAllocator.TryAlloc(size, out HlsfHandle handle))
|
||||
if (!_bufferAllocator.TryAlloc(size, out Tlsf.Handle handle))
|
||||
{
|
||||
index = 0;
|
||||
return false;
|
||||
}
|
||||
CacheLineHead* entry = (CacheLineHead*)handle.EntryHandle;
|
||||
|
||||
// origin :CacheLineHead* entry = (CacheLineHead*)handle.EntryHandle;
|
||||
CacheLineHead* entry = (CacheLineHead*)handle.Pointer;
|
||||
index = entry->Id;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user