mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-15 17:55:46 +00:00
Memory changes 2.2.1 (ryubing/ryujinx!144)
See merge request ryubing/ryujinx!144
This commit is contained in:
@@ -12,9 +12,6 @@ namespace Ryujinx.Memory.Range
|
||||
/// <typeparam name="T">Type of the range.</typeparam>
|
||||
public unsafe class NonOverlappingRangeList<T> : RangeListBase<T> where T : class, INonOverlappingRange
|
||||
{
|
||||
// private readonly Dictionary<ulong, RangeItem<T>> _quickAccess = new(AddressEqualityComparer.Comparer);
|
||||
// private readonly Dictionary<ulong, RangeItem<T>> _fastQuickAccess = new(AddressEqualityComparer.Comparer);
|
||||
|
||||
public readonly ReaderWriterLockSlim Lock = new();
|
||||
|
||||
/// <summary>
|
||||
@@ -44,8 +41,6 @@ namespace Ryujinx.Memory.Range
|
||||
RangeItem<T> rangeItem = new(item);
|
||||
|
||||
Insert(index, rangeItem);
|
||||
|
||||
// _quickAccess.Add(item.Address, rangeItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -71,15 +66,7 @@ namespace Ryujinx.Memory.Range
|
||||
Items[index + 1].Previous = rangeItem;
|
||||
}
|
||||
|
||||
// foreach (ulong addr in Items[index].QuickAccessAddresses)
|
||||
// {
|
||||
// _quickAccess.Remove(addr);
|
||||
// _fastQuickAccess.Remove(addr);
|
||||
// }
|
||||
|
||||
Items[index] = rangeItem;
|
||||
|
||||
// _quickAccess[item.Address] = rangeItem;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -108,19 +95,8 @@ namespace Ryujinx.Memory.Range
|
||||
Items[index + 1].Previous = rangeItem;
|
||||
}
|
||||
|
||||
// foreach (ulong addr in item.QuickAccessAddresses)
|
||||
// {
|
||||
// _quickAccess.Remove(addr);
|
||||
// _fastQuickAccess.Remove(addr);
|
||||
// }
|
||||
|
||||
Items[index] = rangeItem;
|
||||
|
||||
// if (item.Address != rangeItem.Address)
|
||||
// _quickAccess.Remove(item.Address);
|
||||
//
|
||||
// _quickAccess[rangeItem.Address] = rangeItem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -196,14 +172,6 @@ namespace Ryujinx.Memory.Range
|
||||
|
||||
if (index >= 0 && Items[index].Value.Equals(item))
|
||||
{
|
||||
// _quickAccess.Remove(item.Address);
|
||||
//
|
||||
// foreach (ulong addr in Items[index].QuickAccessAddresses)
|
||||
// {
|
||||
// _quickAccess.Remove(addr);
|
||||
// _fastQuickAccess.Remove(addr);
|
||||
// }
|
||||
|
||||
RemoveAt(index);
|
||||
|
||||
return true;
|
||||
@@ -232,16 +200,6 @@ namespace Ryujinx.Memory.Range
|
||||
|
||||
(int startIndex, int endIndex) = BinarySearchEdges(startItem.Address, endItem.EndAddress);
|
||||
|
||||
// for (int i = startIndex; i < endIndex; i++)
|
||||
// {
|
||||
// _quickAccess.Remove(Items[i].Address);
|
||||
// foreach (ulong addr in Items[i].QuickAccessAddresses)
|
||||
// {
|
||||
// _quickAccess.Remove(addr);
|
||||
// _fastQuickAccess.Remove(addr);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (endIndex < Count)
|
||||
{
|
||||
Items[endIndex].Previous = startIndex > 0 ? Items[startIndex - 1] : null;
|
||||
@@ -279,13 +237,6 @@ namespace Ryujinx.Memory.Range
|
||||
|
||||
while (Items[endIndex] is not null && Items[endIndex].Address < address + size)
|
||||
{
|
||||
// _quickAccess.Remove(Items[endIndex].Address);
|
||||
// foreach (ulong addr in Items[endIndex].QuickAccessAddresses)
|
||||
// {
|
||||
// _quickAccess.Remove(addr);
|
||||
// _fastQuickAccess.Remove(addr);
|
||||
// }
|
||||
|
||||
if (endIndex == Count - 1)
|
||||
{
|
||||
break;
|
||||
@@ -322,8 +273,6 @@ namespace Ryujinx.Memory.Range
|
||||
Lock.EnterWriteLock();
|
||||
Count = 0;
|
||||
Lock.ExitWriteLock();
|
||||
// _quickAccess.Clear();
|
||||
// _fastQuickAccess.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -436,11 +385,6 @@ namespace Ryujinx.Memory.Range
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override RangeItem<T> FindOverlap(ulong address, ulong size)
|
||||
{
|
||||
// if (_quickAccess.TryGetValue(address, out RangeItem<T> overlap))
|
||||
// {
|
||||
// return overlap;
|
||||
// }
|
||||
|
||||
int index = BinarySearchLeftEdge(address, address + size);
|
||||
|
||||
if (index < 0)
|
||||
@@ -448,12 +392,6 @@ namespace Ryujinx.Memory.Range
|
||||
return null;
|
||||
}
|
||||
|
||||
// if (Items[index].Address < address)
|
||||
// {
|
||||
// _quickAccess.TryAdd(address, Items[index]);
|
||||
// Items[index].QuickAccessAddresses.Add(address);
|
||||
// }
|
||||
|
||||
return Items[index];
|
||||
}
|
||||
|
||||
@@ -466,28 +404,12 @@ namespace Ryujinx.Memory.Range
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override RangeItem<T> FindOverlapFast(ulong address, ulong size)
|
||||
{
|
||||
// if (_quickAccess.TryGetValue(address, out RangeItem<T> overlap) || _fastQuickAccess.TryGetValue(address, out overlap))
|
||||
// {
|
||||
// return overlap;
|
||||
// }
|
||||
|
||||
int index = BinarySearch(address, address + size);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// if (Items[index].Address < address)
|
||||
// {
|
||||
// _quickAccess.TryAdd(address, Items[index]);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _fastQuickAccess.TryAdd(address, Items[index]);
|
||||
// }
|
||||
//
|
||||
// Items[index].QuickAccessAddresses.Add(address);
|
||||
|
||||
return Items[index];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user