mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-22 02:31:12 +02:00
Memory Changes part 2
* Slightly refactors RangeLists from the last Memory Changes MR, which fixes issue 61. * Convert as many const size array iterators to span iterators as possible. When iterating over a const size array, every iteration created a Span, now only the first iteration does in most places. * Now using object pooling for a few object types that were rapidly deleted and recreated. * Converted a few flag checks to binary operations to save memory allocations.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using ARMeilleure.State;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Cpu;
|
||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||
@@ -658,17 +659,20 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
||||
const int MaxFpuRegistersAArch32 = 16;
|
||||
|
||||
ThreadContext context = new();
|
||||
|
||||
Span<ulong> registersSpan = context.Registers.AsSpan();
|
||||
Span<V128> fpuRegistersSpan = context.FpuRegisters.AsSpan();
|
||||
|
||||
if (Owner.Flags.HasFlag(ProcessCreationFlags.Is64Bit))
|
||||
{
|
||||
for (int i = 0; i < context.Registers.Length; i++)
|
||||
for (int i = 0; i < registersSpan.Length; i++)
|
||||
{
|
||||
context.Registers[i] = Context.GetX(i);
|
||||
registersSpan[i] = Context.GetX(i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < context.FpuRegisters.Length; i++)
|
||||
for (int i = 0; i < fpuRegistersSpan.Length; i++)
|
||||
{
|
||||
context.FpuRegisters[i] = Context.GetV(i);
|
||||
fpuRegistersSpan[i] = Context.GetV(i);
|
||||
}
|
||||
|
||||
context.Fp = Context.GetX(29);
|
||||
@@ -682,12 +686,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
||||
{
|
||||
for (int i = 0; i < MaxRegistersAArch32; i++)
|
||||
{
|
||||
context.Registers[i] = (uint)Context.GetX(i);
|
||||
registersSpan[i] = (uint)Context.GetX(i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MaxFpuRegistersAArch32; i++)
|
||||
{
|
||||
context.FpuRegisters[i] = Context.GetV(i);
|
||||
fpuRegistersSpan[i] = Context.GetV(i);
|
||||
}
|
||||
|
||||
context.Pc = (uint)Context.Pc;
|
||||
|
||||
Reference in New Issue
Block a user