misc: chore: Use collection expressions (part 2)

This commit is contained in:
KeatonTheBot
2025-03-10 21:32:01 -05:00
parent c923c0043a
commit 340ec79e9f
176 changed files with 308 additions and 308 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ namespace ARMeilleure.Common
_fillBottomLevel = new SparseMemoryBlock(bottomLevelSize, null, _sparseFill);
_fillBottomLevelPtr = (TEntry*)_fillBottomLevel.Block.Pointer;
_sparseReserved = new List<TableSparseBlock>();
_sparseReserved = [];
_sparseLock = new ReaderWriterLockSlim();
_sparseBlockSize = bottomLevelSize;
@@ -21,7 +21,7 @@ namespace Ryujinx.Cpu.Jit.HostTracked
public AddressSpacePartitioned(MemoryTracking tracking, MemoryBlock backingMemory, NativePageTable nativePageTable, bool useProtectionMirrors)
{
_backingMemory = backingMemory;
_partitions = new();
_partitions = [];
_asAllocator = new(tracking, nativePageTable.Read, _partitions);
_updatePtCallback = nativePageTable.Update;
_useProtectionMirrors = useProtectionMirrors;
@@ -36,7 +36,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
RegisterAllocator = registerAllocator;
MemoryManagerType = mmType;
_itConditions = new ArmCondition[4];
_pendingBranches = new();
_pendingBranches = [];
IsThumb = isThumb;
}
@@ -10,8 +10,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
{
public static MultiBlock DecodeMulti(CpuPreset cpuPreset, IMemoryManager memoryManager, ulong address, bool isThumb)
{
List<Block> blocks = new();
List<ulong> branchTargets = new();
List<Block> blocks = [];
List<ulong> branchTargets = [];
while (true)
{
@@ -202,7 +202,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
{
ulong startAddress = address;
List<InstInfo> insts = new();
List<InstInfo> insts = [];
uint encoding;
InstMeta meta;
+2 -2
View File
@@ -25,8 +25,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm64
{
Debug.Assert((int)((endAddress - address) / 4) == instructions.Count);
_predecessors = new();
_successors = new();
_predecessors = [];
_successors = [];
Address = address;
EndAddress = endAddress;
Instructions = instructions;
@@ -36,8 +36,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm64
{
Console.WriteLine($"bb {block.Index}");
List<int> predList = new();
List<int> succList = new();
List<int> predList = [];
List<int> succList = [];
for (int index = 0; index < block.PredecessorsCount; index++)
{
@@ -309,7 +309,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
MultiBlock multiBlock = Decoder.DecodeMulti(cpuPreset, memoryManager, address);
Dictionary<ulong, int> targets = new();
List<PendingBranch> pendingBranches = new();
List<PendingBranch> pendingBranches = [];
uint gprUseMask = multiBlock.GlobalUseMask.GprMask;
uint fpSimdUseMask = multiBlock.GlobalUseMask.FpSimdMask;
@@ -15,8 +15,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
public static MultiBlock DecodeMulti(CpuPreset cpuPreset, IMemoryManager memoryManager, ulong address)
{
List<Block> blocks = new();
List<ulong> branchTargets = new();
List<Block> blocks = [];
List<ulong> branchTargets = [];
RegisterMask useMask = RegisterMask.Zero;
@@ -238,7 +238,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
{
ulong startAddress = address;
List<InstInfo> insts = new();
List<InstInfo> insts = [];
uint gprUseMask = useMask.GprMask;
uint fpSimdUseMask = useMask.FpSimdMask;
@@ -24,7 +24,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
}
}
private readonly List<MemoryBlock> _blocks = new();
private readonly List<MemoryBlock> _blocks = [];
public CacheMemoryAllocator(int capacity)
{
@@ -23,11 +23,11 @@ namespace Ryujinx.Cpu.LightningJit.Cache
private static CacheMemoryAllocator _cacheAllocator;
private static readonly List<CacheEntry> _cacheEntries = new();
private static readonly List<CacheEntry> _cacheEntries = [];
private static readonly Lock _lock = new();
private static bool _initialized;
private static readonly List<ReservedRegion> _jitRegions = new();
private static readonly List<ReservedRegion> _jitRegions = [];
private static int _activeRegionIndex = 0;
[SupportedOSPlatform("windows")]
@@ -231,7 +231,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
_sharedCache.Pointer,
SharedCacheSize);
List<(ulong, ThreadLocalCacheEntry)> toDelete = new();
List<(ulong, ThreadLocalCacheEntry)> toDelete = [];
foreach ((ulong address, ThreadLocalCacheEntry entry) in _threadLocalCache)
{
@@ -35,8 +35,8 @@ namespace Ryujinx.Cpu.LightningJit.Cache
{
_alignedRangeAction = alignedRangeAction;
_alignedFunctionAction = alignedFunctionAction;
_pendingFunctions = new();
_ranges = new();
_pendingFunctions = [];
_ranges = [];
}
public bool Has(ulong address)
@@ -26,7 +26,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
public Assembler(CodeWriter writer)
{
_code = writer.GetList();
_labels = new List<LabelState>();
_labels = [];
}
public readonly Operand CreateLabel()
@@ -8,7 +8,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
{
public IEnumerable<ulong> GetCallStack(IntPtr framePointer, IntPtr codeRegionStart, int codeRegionSize, IntPtr codeRegion2Start, int codeRegion2Size)
{
List<ulong> functionPointers = new();
List<ulong> functionPointers = [];
while (true)
{
@@ -16,7 +16,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
public TailMerger()
{
_branchPointers = new();
_branchPointers = [];
}
public void AddConditionalReturn(CodeWriter writer, in Assembler asm, ArmCondition returnCondition)
+1 -1
View File
@@ -12,7 +12,7 @@ namespace Ryujinx.Cpu.LightningJit
public CodeWriter()
{
_instructions = new();
_instructions = [];
}
public void WriteInstruction(uint instruction)
@@ -34,7 +34,7 @@ namespace Ryujinx.Cpu.LightningJit.Table
{
int splitIndex = (int)((insts[index].Encoding >> _shift) & _mask);
(splitList[splitIndex] ??= new()).Add(insts[index]);
(splitList[splitIndex] ??= []).Add(insts[index]);
}
for (int index = 0; index < count; index++)
@@ -140,7 +140,7 @@ namespace Ryujinx.Cpu.LightningJit
/// <returns>Generated <see cref="DispatchStub"/></returns>
private IntPtr GenerateDispatchStub()
{
List<int> branchToFallbackOffsets = new();
List<int> branchToFallbackOffsets = [];
CodeWriter writer = new();