misc: chore: Use collection expressions in HLE project
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
|
||||
_current2 = new long[(int)LimitableResource.Count];
|
||||
_peak = new long[(int)LimitableResource.Count];
|
||||
|
||||
_waitingThreads = new LinkedList<KThread>();
|
||||
_waitingThreads = [];
|
||||
}
|
||||
|
||||
public bool Reserve(LimitableResource resource, ulong amount)
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
|
||||
|
||||
public KSynchronizationObject(KernelContext context) : base(context)
|
||||
{
|
||||
WaitingThreads = new LinkedList<KThread>();
|
||||
WaitingThreads = [];
|
||||
}
|
||||
|
||||
public LinkedListNode<KThread> AddWaitingThread(KThread thread)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
|
||||
public KTimeManager(KernelContext context)
|
||||
{
|
||||
_context = context;
|
||||
_waitingObjects = new List<WaitingObject>();
|
||||
_waitingObjects = [];
|
||||
_keepRunning = true;
|
||||
|
||||
Thread work = new(WaitAndCheckScheduledObjects)
|
||||
|
||||
@@ -72,13 +72,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
|
||||
|
||||
servicePool = new MemoryRegion(DramMemoryMap.SlabHeapEnd, servicePoolSize);
|
||||
|
||||
return new[]
|
||||
{
|
||||
return
|
||||
[
|
||||
GetMemoryRegion(applicationPool),
|
||||
GetMemoryRegion(appletPool),
|
||||
GetMemoryRegion(servicePool),
|
||||
GetMemoryRegion(nvServicesPool),
|
||||
};
|
||||
GetMemoryRegion(nvServicesPool)
|
||||
];
|
||||
}
|
||||
|
||||
private static KMemoryRegionManager GetMemoryRegion(MemoryRegion region)
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
||||
{
|
||||
_parent = parent;
|
||||
|
||||
_incomingConnections = new LinkedList<KServerSession>();
|
||||
_lightIncomingConnections = new LinkedList<KLightServerSession>();
|
||||
_incomingConnections = [];
|
||||
_lightIncomingConnections = [];
|
||||
}
|
||||
|
||||
public void EnqueueIncomingSession(KServerSession session)
|
||||
|
||||
@@ -10,12 +10,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
||||
{
|
||||
class KServerSession : KSynchronizationObject
|
||||
{
|
||||
private static readonly MemoryState[] _ipcMemoryStates = {
|
||||
private static readonly MemoryState[] _ipcMemoryStates =
|
||||
[
|
||||
MemoryState.IpcBuffer3,
|
||||
MemoryState.IpcBuffer0,
|
||||
MemoryState.IpcBuffer1,
|
||||
(MemoryState)0xfffce5d4, //This is invalid, shouldn't be accessed.
|
||||
};
|
||||
(MemoryState)0xfffce5d4 //This is invalid, shouldn't be accessed.
|
||||
];
|
||||
|
||||
private readonly struct Message
|
||||
{
|
||||
@@ -176,7 +177,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
||||
{
|
||||
_parent = parent;
|
||||
|
||||
_requests = new LinkedList<KSessionRequest>();
|
||||
_requests = [];
|
||||
}
|
||||
|
||||
public Result EnqueueRequest(KSessionRequest request)
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly int[] _memoryBlockPageShifts = { 12, 16, 21, 22, 25, 29, 30 };
|
||||
private static readonly int[] _memoryBlockPageShifts = [12, 16, 21, 22, 25, 29, 30];
|
||||
|
||||
#pragma warning disable IDE0052 // Remove unread private member
|
||||
private readonly ulong _heapAddress;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||
|
||||
public KPageList()
|
||||
{
|
||||
Nodes = new LinkedList<KPageNode>();
|
||||
Nodes = [];
|
||||
}
|
||||
|
||||
public Result AddRange(ulong address, ulong pagesCount)
|
||||
|
||||
@@ -13,14 +13,15 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||
{
|
||||
abstract class KPageTableBase
|
||||
{
|
||||
private static readonly int[] _mappingUnitSizes = {
|
||||
private static readonly int[] _mappingUnitSizes =
|
||||
[
|
||||
0x1000,
|
||||
0x10000,
|
||||
0x200000,
|
||||
0x400000,
|
||||
0x2000000,
|
||||
0x40000000,
|
||||
};
|
||||
0x40000000
|
||||
];
|
||||
|
||||
private const ulong RegionAlignment = 0x200000;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
|
||||
|
||||
public KSlabHeap(ulong pa, ulong itemSize, ulong size)
|
||||
{
|
||||
_items = new LinkedList<ulong>();
|
||||
_items = [];
|
||||
|
||||
int itemsCount = (int)(size / itemSize);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
{
|
||||
_owner = owner;
|
||||
|
||||
_images = new List<Image>();
|
||||
_images = [];
|
||||
}
|
||||
|
||||
public string GetGuestStackTrace(KThread thread)
|
||||
@@ -414,7 +414,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
ulong strTblAddr = textOffset + strTab;
|
||||
ulong symTblAddr = textOffset + symTab;
|
||||
|
||||
List<ElfSymbol> symbols = new();
|
||||
List<ElfSymbol> symbols = [];
|
||||
|
||||
while (symTblAddr < strTblAddr)
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
// TODO: Remove once we no longer need to initialize it externally.
|
||||
HandleTable = new KHandleTable();
|
||||
|
||||
_threads = new LinkedList<KThread>();
|
||||
_threads = [];
|
||||
|
||||
Debugger = new HleProcessDebugger(this);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
||||
{
|
||||
_context = context;
|
||||
|
||||
_condVarThreads = new List<KThread>();
|
||||
_arbiterThreads = new List<KThread>();
|
||||
_condVarThreads = [];
|
||||
_arbiterThreads = [];
|
||||
}
|
||||
|
||||
public Result ArbitrateLock(int ownerHandle, ulong mutexAddress, int requesterHandle)
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
||||
|
||||
for (int core = 0; core < KScheduler.CpuCoresCount; core++)
|
||||
{
|
||||
_suggestedThreadsPerPrioPerCore[prio][core] = new LinkedList<KThread>();
|
||||
_scheduledThreadsPerPrioPerCore[prio][core] = new LinkedList<KThread>();
|
||||
_suggestedThreadsPerPrioPerCore[prio][core] = [];
|
||||
_scheduledThreadsPerPrioPerCore[prio][core] = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,8 +121,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
||||
|
||||
SiblingsPerCore = new LinkedListNode<KThread>[KScheduler.CpuCoresCount];
|
||||
|
||||
_mutexWaiters = new LinkedList<KThread>();
|
||||
_pinnedWaiters = new LinkedList<KThread>();
|
||||
_mutexWaiters = [];
|
||||
_pinnedWaiters = [];
|
||||
}
|
||||
|
||||
public Result Initialize(
|
||||
|
||||
Reference in New Issue
Block a user