working on L4's tlsf
This commit is contained in:
@@ -31,8 +31,6 @@ using StgSharp.HighPerformance.ProcessorAbstraction;
|
||||
using System.Data;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using HLSF = StgSharp.HighPerformance.Memory.TwoLayerSegregatedFitAllocator;
|
||||
|
||||
namespace StgSharp.HighPerformance.Memory
|
||||
{
|
||||
public sealed unsafe partial class L4 : IDisposable
|
||||
@@ -50,8 +48,6 @@ namespace StgSharp.HighPerformance.Memory
|
||||
private readonly CacheLineDescription* _prediction;
|
||||
private bool _disposed;
|
||||
private bool _exhausted;
|
||||
|
||||
private readonly HLSF _bufferAllocator;
|
||||
private int _activeCount;
|
||||
|
||||
private int _aheadCount;
|
||||
@@ -59,9 +55,10 @@ namespace StgSharp.HighPerformance.Memory
|
||||
private readonly int _bindedNuma;
|
||||
private volatile int _prefetching;
|
||||
private readonly nuint _baseAddress;
|
||||
private readonly Slab _entryManager;
|
||||
private readonly SwissTable _map;
|
||||
|
||||
private readonly TLSF _bufferAllocator;
|
||||
|
||||
public L4(
|
||||
int bindedNuma,
|
||||
nuint bufferSize = 8192 * 8192,
|
||||
@@ -72,7 +69,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
_bindedNuma = bindedNuma;
|
||||
|
||||
// init order is fallow by align requirement of each component.
|
||||
nuint entrySize = Slab.RequestedAllocation; // SIMDID, no less than 16 byte bit
|
||||
nuint entrySize = TLSF.RequestedAllocation; // SIMDID, no less than 16 byte bit
|
||||
nuint headSize = ((nuint)Unsafe.SizeOf<CacheLineHead>()) * CacheLineCount; // 16 byte align
|
||||
nuint predictionSize = ((nuint)Unsafe.SizeOf<CacheLineDescription>()) * PredictionCount; //16 byte align
|
||||
nuint mapSize = SwissTable.RequestedNativeMemorySize; // 16 byte align
|
||||
@@ -89,9 +86,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
|
||||
// init all components with the buffer, and move the buffer pointer forward.
|
||||
nuint _buffer = _baseAddress + normalizedBufferSize;
|
||||
_entryManager = new Slab(_buffer);
|
||||
_bufferAllocator = new HLSF(entrySize, align, maxCacheLineSize, (void*)_baseAddress,
|
||||
static _ => { }/*, _entryManager/**/);
|
||||
_bufferAllocator = new TLSF(bufferSize, maxCacheLineSize, (void*)_baseAddress);
|
||||
ptr += entrySize;
|
||||
_head = (CacheLineHead*)ptr;
|
||||
ptr += headSize;
|
||||
@@ -141,12 +136,11 @@ namespace StgSharp.HighPerformance.Memory
|
||||
}
|
||||
_disposed = true;
|
||||
_map.Dispose();
|
||||
_entryManager.Dispose();
|
||||
_bufferAllocator.Dispose();
|
||||
GC.SuppressFinalize(_bufferAllocator);
|
||||
|
||||
|
||||
// init order is fallow by align requirement of each component.
|
||||
nuint entrySize = Slab.RequestedAllocation; // SIMDID, no less than 16 byte bit
|
||||
nuint entrySize = TLSF.RequestedAllocation; // SIMDID, no less than 16 byte bit
|
||||
nuint headSize = ((nuint)Unsafe.SizeOf<CacheLineHead>()) * CacheLineCount; // 16 byte align
|
||||
nuint predictionSize = ((nuint)Unsafe.SizeOf<CacheLineDescription>()) * PredictionCount; //16 byte align
|
||||
nuint mapSize = SwissTable.RequestedNativeMemorySize; // 16 byte align
|
||||
|
||||
Reference in New Issue
Block a user