HLSF full functionally available. Working on Matrix.
Signed-off-by: Youmu Liu <105042599+Nitload-NSI@users.noreply.github.com>
This commit is contained in:
@@ -54,37 +54,24 @@ namespace StgSharp.HighPerformance.Memory
|
||||
if (e == null) {
|
||||
return;
|
||||
}
|
||||
AcquireEntrySpinLock(e);
|
||||
try
|
||||
{
|
||||
if (GetEntryState(e) != EntryState.Allocated) {
|
||||
return;
|
||||
}
|
||||
SetEntryState(e, EntryState.ThreadOccupied);
|
||||
|
||||
if (e->State != EntryState.Allocated) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Set to ThreadOccupied to prevent other operations
|
||||
e->State = EntryState.Empty;
|
||||
|
||||
|
||||
// Try merge with adjacent free blocks and remove them from buckets
|
||||
MergeAndRemoveFromBuckets(e);
|
||||
|
||||
|
||||
// Calculate final level and segment for the merged block
|
||||
uint finalSize = e->Size;
|
||||
int finalLevel = GetLevelFromSize(finalSize);
|
||||
int finalSegment = DetermineSegmentIndex(finalSize, finalLevel);
|
||||
|
||||
|
||||
// Set the merged entry state to Empty (ready to be reused)
|
||||
e->State = EntryState.Empty;
|
||||
|
||||
|
||||
// Push the merged entry back to appropriate bucket
|
||||
PushLevel(finalLevel, finalSegment, (BucketNode*)e->Position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user