mirror of
https://github.com/GreemDev/Ryujinx
synced 2025-01-26 23:37:08 +01:00
misc: chore: Use explicit types in Tests projects
Some checks are pending
Canary release job / Create tag (push) Waiting to run
Canary release job / Release for linux-arm64 (push) Waiting to run
Canary release job / Release for linux-x64 (push) Waiting to run
Canary release job / Release for win-x64 (push) Waiting to run
Canary release job / Release MacOS universal (push) Waiting to run
Some checks are pending
Canary release job / Create tag (push) Waiting to run
Canary release job / Release for linux-arm64 (push) Waiting to run
Canary release job / Release for linux-x64 (push) Waiting to run
Canary release job / Release for win-x64 (push) Waiting to run
Canary release job / Release MacOS universal (push) Waiting to run
This commit is contained in:
parent
93539e7d45
commit
250acab7a7
8 changed files with 60 additions and 57 deletions
|
@ -24,7 +24,8 @@ namespace Ryujinx.Common.Configuration
|
|||
public static EnabledDirtyHack Unpack(ulong packedHack)
|
||||
{
|
||||
uint[] unpackedFields = packedHack.UnpackBitFields(PackedFormat);
|
||||
if (unpackedFields is not [var hack, var value])
|
||||
// ReSharper disable once PatternAlwaysMatches
|
||||
if (unpackedFields is not [uint hack, uint value])
|
||||
throw new Exception("The unpack operation on the integer resulted in an invalid unpacked result.");
|
||||
|
||||
return new EnabledDirtyHack((DirtyHack)hack, (int)value);
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
ReadOnlySequence<byte> sequence =
|
||||
CreateSegmentedByteSequence(originalStructs, maxSegmentSize ?? Unsafe.SizeOf<MyUnmanagedStruct>());
|
||||
|
||||
var sequenceReader = new SequenceReader<byte>(sequence);
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(sequence);
|
||||
|
||||
foreach (var original in originalStructs)
|
||||
foreach (MyUnmanagedStruct original in originalStructs)
|
||||
{
|
||||
// Act
|
||||
ref readonly MyUnmanagedStruct read = ref sequenceReader.GetRefOrRefToCopy<MyUnmanagedStruct>(out _);
|
||||
|
@ -43,12 +43,12 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
|
||||
ReadOnlySequence<byte> sequence = CreateSegmentedByteSequence(originalStructs, 3);
|
||||
|
||||
var sequenceReader = new SequenceReader<byte>(sequence);
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(sequence);
|
||||
|
||||
foreach (var original in originalStructs)
|
||||
foreach (MyUnmanagedStruct original in originalStructs)
|
||||
{
|
||||
// Act
|
||||
ref readonly MyUnmanagedStruct read = ref sequenceReader.GetRefOrRefToCopy<MyUnmanagedStruct>(out var copy);
|
||||
ref readonly MyUnmanagedStruct read = ref sequenceReader.GetRefOrRefToCopy<MyUnmanagedStruct>(out MyUnmanagedStruct copy);
|
||||
|
||||
// Assert
|
||||
MyUnmanagedStruct.Assert(Assert.AreEqual, original, read);
|
||||
|
@ -64,12 +64,12 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
|
||||
ReadOnlySequence<byte> sequence = CreateSegmentedByteSequence(originalStructs, int.MaxValue);
|
||||
|
||||
var sequenceReader = new SequenceReader<byte>(sequence);
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(sequence);
|
||||
|
||||
foreach (var original in originalStructs)
|
||||
foreach (MyUnmanagedStruct original in originalStructs)
|
||||
{
|
||||
// Act
|
||||
ref readonly MyUnmanagedStruct read = ref sequenceReader.GetRefOrRefToCopy<MyUnmanagedStruct>(out var copy);
|
||||
ref readonly MyUnmanagedStruct read = ref sequenceReader.GetRefOrRefToCopy<MyUnmanagedStruct>(out MyUnmanagedStruct copy);
|
||||
|
||||
// Assert
|
||||
MyUnmanagedStruct.Assert(Assert.AreEqual, original, read);
|
||||
|
@ -88,7 +88,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
// Act/Assert
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
{
|
||||
var sequenceReader = new SequenceReader<byte>(sequence);
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(sequence);
|
||||
|
||||
sequenceReader.Advance(1);
|
||||
|
||||
|
@ -106,7 +106,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
|
||||
BinaryPrimitives.WriteInt32LittleEndian(buffer.AsSpan(), TestValue);
|
||||
|
||||
var sequenceReader = new SequenceReader<byte>(new ReadOnlySequence<byte>(buffer));
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(new ReadOnlySequence<byte>(buffer));
|
||||
|
||||
// Act
|
||||
sequenceReader.ReadLittleEndian(out int roundTrippedValue);
|
||||
|
@ -125,7 +125,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
|
||||
BinaryPrimitives.WriteInt32BigEndian(buffer.AsSpan(), TestValue);
|
||||
|
||||
var sequenceReader = new SequenceReader<byte>(new ReadOnlySequence<byte>(buffer));
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(new ReadOnlySequence<byte>(buffer));
|
||||
|
||||
// Act
|
||||
sequenceReader.ReadLittleEndian(out int roundTrippedValue);
|
||||
|
@ -147,7 +147,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
// Act/Assert
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
{
|
||||
var sequenceReader = new SequenceReader<byte>(new ReadOnlySequence<byte>(buffer));
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(new ReadOnlySequence<byte>(buffer));
|
||||
sequenceReader.Advance(1);
|
||||
|
||||
sequenceReader.ReadLittleEndian(out int roundTrippedValue);
|
||||
|
@ -173,7 +173,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
// Act/Assert
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
{
|
||||
var sequenceReader = new SequenceReader<byte>(sequence);
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(sequence);
|
||||
|
||||
sequenceReader.Advance(1);
|
||||
|
||||
|
@ -200,7 +200,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
{
|
||||
var sequenceReader = new SequenceReader<byte>(sequence);
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(sequence);
|
||||
|
||||
sequenceReader.SetConsumed(MyUnmanagedStruct.SizeOf * StructCount + 1);
|
||||
});
|
||||
|
@ -213,9 +213,9 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
|
||||
ReadOnlySequence<byte> sequence = CreateSegmentedByteSequence(originalStructs, maxSegmentLength);
|
||||
|
||||
var sequenceReader = new SequenceReader<byte>(sequence);
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(sequence);
|
||||
|
||||
foreach (var original in originalStructs)
|
||||
foreach (MyUnmanagedStruct original in originalStructs)
|
||||
{
|
||||
// Act
|
||||
sequenceReader.ReadUnmanaged(out MyUnmanagedStruct read);
|
||||
|
@ -232,7 +232,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
|
||||
ReadOnlySequence<byte> sequence = CreateSegmentedByteSequence(originalStructs, maxSegmentLength);
|
||||
|
||||
var sequenceReader = new SequenceReader<byte>(sequence);
|
||||
SequenceReader<byte> sequenceReader = new SequenceReader<byte>(sequence);
|
||||
|
||||
static void SetConsumedAndAssert(scoped ref SequenceReader<byte> sequenceReader, long consumed)
|
||||
{
|
||||
|
@ -283,7 +283,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
const int BaseInt32Value = 0x1234abcd;
|
||||
const short BaseInt16Value = 0x5678;
|
||||
|
||||
var result = new MyUnmanagedStruct
|
||||
MyUnmanagedStruct result = new MyUnmanagedStruct
|
||||
{
|
||||
BehaviourSize = BaseInt32Value ^ rng.Next(),
|
||||
MemoryPoolsSize = BaseInt32Value ^ rng.Next(),
|
||||
|
@ -320,7 +320,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
|
||||
private static IEnumerable<MyUnmanagedStruct> EnumerateNewUnmanagedStructs()
|
||||
{
|
||||
var rng = new Random(0);
|
||||
Random rng = new Random(0);
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
private static ReadOnlySequence<byte> CreateSegmentedByteSequence<T>(T[] array, int maxSegmentLength) where T : unmanaged
|
||||
{
|
||||
byte[] arrayBytes = MemoryMarshal.AsBytes(array.AsSpan()).ToArray();
|
||||
var memory = new Memory<byte>(arrayBytes);
|
||||
Memory<byte> memory = new Memory<byte>(arrayBytes);
|
||||
int index = 0;
|
||||
|
||||
BytesReadOnlySequenceSegment first = null, last = null;
|
||||
|
@ -339,7 +339,7 @@ namespace Ryujinx.Tests.Common.Extensions
|
|||
while (index < memory.Length)
|
||||
{
|
||||
int nextSegmentLength = Math.Min(maxSegmentLength, memory.Length - index);
|
||||
var nextSegment = memory.Slice(index, nextSegmentLength);
|
||||
Memory<byte> nextSegment = memory.Slice(index, nextSegmentLength);
|
||||
|
||||
if (first == null)
|
||||
{
|
||||
|
|
|
@ -296,7 +296,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
FinalRegs = test.FinalRegs,
|
||||
});
|
||||
|
||||
foreach (var (address, value) in test.MemoryDelta)
|
||||
foreach ((ulong address, ushort value) in test.MemoryDelta)
|
||||
{
|
||||
testMem[address - DataBaseAddress + 0] = (byte)(value >> 0);
|
||||
testMem[address - DataBaseAddress + 1] = (byte)(value >> 8);
|
||||
|
|
|
@ -465,7 +465,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
|
||||
opcode |= (fixImm & 0x3f) << 16;
|
||||
|
||||
var v0 = new V128((uint)s0, (uint)s1, (uint)s2, (uint)s3);
|
||||
V128 v0 = new V128((uint)s0, (uint)s1, (uint)s2, (uint)s3);
|
||||
|
||||
SingleOpcode(opcode, v0: v0);
|
||||
|
||||
|
@ -505,7 +505,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
|
||||
opcode |= (fixImm & 0x3f) << 16;
|
||||
|
||||
var v0 = new V128(s0, s1, s2, s3);
|
||||
V128 v0 = new V128(s0, s1, s2, s3);
|
||||
|
||||
SingleOpcode(opcode, v0: v0);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
[Range(0u, 3u)] uint n,
|
||||
[Values(0x0u)] uint offset)
|
||||
{
|
||||
var data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
byte[] data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
SetWorkingMemory(0, data);
|
||||
|
||||
uint opcode = 0xf4a00000u; // VLD1.8 {D0[0]}, [R0], R0
|
||||
|
@ -74,7 +74,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
[Values] bool t,
|
||||
[Values(0x0u)] uint offset)
|
||||
{
|
||||
var data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
byte[] data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
SetWorkingMemory(0, data);
|
||||
|
||||
uint opcode = 0xf4a00c00u; // VLD1.8 {D0[0]}, [R0], R0
|
||||
|
@ -103,7 +103,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
[Range(0u, 10u)] uint mode,
|
||||
[Values(0x0u)] uint offset)
|
||||
{
|
||||
var data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
byte[] data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
SetWorkingMemory(0, data);
|
||||
|
||||
uint opcode = 0xf4200000u; // VLD4.8 {D0, D1, D2, D3}, [R0], R0
|
||||
|
@ -133,7 +133,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
[Range(0u, 3u)] uint n,
|
||||
[Values(0x0u)] uint offset)
|
||||
{
|
||||
var data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
byte[] data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
SetWorkingMemory(0, data);
|
||||
|
||||
(V128 vec1, V128 vec2, V128 vec3, V128 vec4) = GenerateTestVectors();
|
||||
|
@ -164,7 +164,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
[Range(0u, 10u)] uint mode,
|
||||
[Values(0x0u)] uint offset)
|
||||
{
|
||||
var data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
byte[] data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
SetWorkingMemory(0, data);
|
||||
|
||||
(V128 vec1, V128 vec2, V128 vec3, V128 vec4) = GenerateTestVectors();
|
||||
|
@ -194,7 +194,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
[Values(0x1u, 0x32u)] uint regs,
|
||||
[Values] bool single)
|
||||
{
|
||||
var data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
byte[] data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
SetWorkingMemory(0, data);
|
||||
|
||||
uint opcode = 0xec100a00u; // VST4.8 {D0, D1, D2, D3}, [R0], R0
|
||||
|
@ -246,7 +246,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
[Values(0x0u)] uint imm,
|
||||
[Values] bool sub)
|
||||
{
|
||||
var data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
byte[] data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
SetWorkingMemory(0, data);
|
||||
|
||||
uint opcode = 0xed900a00u; // VLDR.32 S0, [R0, #0]
|
||||
|
@ -281,7 +281,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
[Values(0x0u)] uint imm,
|
||||
[Values] bool sub)
|
||||
{
|
||||
var data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
byte[] data = GenerateVectorSequence((int)MemoryBlock.GetPageSize());
|
||||
SetWorkingMemory(0, data);
|
||||
|
||||
uint opcode = 0xed800a00u; // VSTR.32 S0, [R0, #0]
|
||||
|
@ -331,7 +331,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
data[i] = i + (i / 9f);
|
||||
}
|
||||
|
||||
var result = new byte[length];
|
||||
byte[] result = new byte[length];
|
||||
Buffer.BlockCopy(data, 0, result, 0, result.Length);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
using ARMeilleure.State;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Internal;
|
||||
|
||||
namespace Ryujinx.Tests.Cpu
|
||||
{
|
||||
|
@ -467,7 +468,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
opcode |= (vn & 0xf) << 16;
|
||||
opcode |= (length & 0x3) << 8;
|
||||
|
||||
var rnd = TestContext.CurrentContext.Random;
|
||||
Randomizer rnd = TestContext.CurrentContext.Random;
|
||||
V128 v2 = new(TestContext.CurrentContext.Random.NextULong(), TestContext.CurrentContext.Random.NextULong());
|
||||
V128 v3 = new(TestContext.CurrentContext.Random.NextULong(), TestContext.CurrentContext.Random.NextULong());
|
||||
V128 v4 = new(TestContext.CurrentContext.Random.NextULong(), TestContext.CurrentContext.Random.NextULong());
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace Ryujinx.Tests.Cpu
|
|||
bool methodCalled = false;
|
||||
bool isFz = false;
|
||||
|
||||
var method = TranslatorTestMethods.GenerateFpFlagsPInvokeTest();
|
||||
TranslatorTestMethods.FpFlagsPInvokeTest method = TranslatorTestMethods.GenerateFpFlagsPInvokeTest();
|
||||
|
||||
// This method sets flush-to-zero and then calls the managed method.
|
||||
// Before and after setting the flags, it ensures subnormal addition works as expected.
|
||||
|
|
|
@ -3,6 +3,7 @@ using ARMeilleure.Memory;
|
|||
using ARMeilleure.Signal;
|
||||
using ARMeilleure.Translation;
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory.PartialUnmaps;
|
||||
using Ryujinx.Cpu;
|
||||
using Ryujinx.Cpu.Jit;
|
||||
|
@ -26,11 +27,11 @@ namespace Ryujinx.Tests.Memory
|
|||
{
|
||||
MemoryAllocationFlags asFlags = MemoryAllocationFlags.Reserve | MemoryAllocationFlags.ViewCompatible;
|
||||
|
||||
var addressSpace = new MemoryBlock(asSize, asFlags);
|
||||
var addressSpaceMirror = new MemoryBlock(asSize, asFlags);
|
||||
MemoryBlock addressSpace = new MemoryBlock(asSize, asFlags);
|
||||
MemoryBlock addressSpaceMirror = new MemoryBlock(asSize, asFlags);
|
||||
|
||||
var tracking = new MemoryTracking(new MockVirtualMemoryManager(asSize, 0x1000), 0x1000);
|
||||
var exceptionHandler = new MemoryEhMeilleure(addressSpace, addressSpaceMirror, tracking);
|
||||
MemoryTracking tracking = new MemoryTracking(new MockVirtualMemoryManager(asSize, 0x1000), 0x1000);
|
||||
MemoryEhMeilleure exceptionHandler = new MemoryEhMeilleure(addressSpace, addressSpaceMirror, tracking);
|
||||
|
||||
return (addressSpace, addressSpaceMirror, exceptionHandler);
|
||||
}
|
||||
|
@ -39,7 +40,7 @@ namespace Ryujinx.Tests.Memory
|
|||
{
|
||||
int count = 0;
|
||||
|
||||
ref var ids = ref state.LocalCounts.ThreadIds;
|
||||
ref Array20<int> ids = ref state.LocalCounts.ThreadIds;
|
||||
|
||||
for (int i = 0; i < ids.Length; i++)
|
||||
{
|
||||
|
@ -71,13 +72,13 @@ namespace Ryujinx.Tests.Memory
|
|||
ulong vaSize = 0x100000;
|
||||
|
||||
// The first 0x100000 is mapped to start. It is replaced from the center with the 0x200000 mapping.
|
||||
var backing = new MemoryBlock(vaSize * 2, MemoryAllocationFlags.Mirrorable);
|
||||
MemoryBlock backing = new MemoryBlock(vaSize * 2, MemoryAllocationFlags.Mirrorable);
|
||||
|
||||
(MemoryBlock unusedMainMemory, MemoryBlock memory, MemoryEhMeilleure exceptionHandler) = GetVirtual(vaSize * 2);
|
||||
|
||||
EnsureTranslator();
|
||||
|
||||
ref var state = ref PartialUnmapState.GetRef();
|
||||
ref PartialUnmapState state = ref PartialUnmapState.GetRef();
|
||||
|
||||
Thread testThread = null;
|
||||
bool shouldAccess = true;
|
||||
|
@ -216,17 +217,17 @@ namespace Ryujinx.Tests.Memory
|
|||
ulong vaSize = 0x100000;
|
||||
|
||||
// The first 0x100000 is mapped to start. It is replaced from the center with the 0x200000 mapping.
|
||||
var backing = new MemoryBlock(vaSize * 2, MemoryAllocationFlags.Mirrorable);
|
||||
MemoryBlock backing = new MemoryBlock(vaSize * 2, MemoryAllocationFlags.Mirrorable);
|
||||
|
||||
(MemoryBlock mainMemory, MemoryBlock unusedMirror, MemoryEhMeilleure exceptionHandler) = GetVirtual(vaSize * 2);
|
||||
|
||||
EnsureTranslator();
|
||||
|
||||
ref var state = ref PartialUnmapState.GetRef();
|
||||
ref PartialUnmapState state = ref PartialUnmapState.GetRef();
|
||||
|
||||
// Create some state to be used for managing the native writing loop.
|
||||
int stateSize = Unsafe.SizeOf<NativeWriteLoopState>();
|
||||
var statePtr = Marshal.AllocHGlobal(stateSize);
|
||||
IntPtr statePtr = Marshal.AllocHGlobal(stateSize);
|
||||
Unsafe.InitBlockUnaligned((void*)statePtr, 0, (uint)stateSize);
|
||||
|
||||
ref NativeWriteLoopState writeLoopState = ref Unsafe.AsRef<NativeWriteLoopState>((void*)statePtr);
|
||||
|
@ -241,7 +242,7 @@ namespace Ryujinx.Tests.Memory
|
|||
// Create a large mapping.
|
||||
mainMemory.MapView(backing, 0, 0, vaSize);
|
||||
|
||||
var writeFunc = TestMethods.GenerateDebugNativeWriteLoop();
|
||||
TestMethods.DebugNativeWriteLoop writeFunc = TestMethods.GenerateDebugNativeWriteLoop();
|
||||
nint writePtr = mainMemory.GetPointer(vaSize - 0x1000, 4);
|
||||
|
||||
Thread testThread = new(() =>
|
||||
|
@ -292,10 +293,10 @@ namespace Ryujinx.Tests.Memory
|
|||
public void ThreadLocalMap()
|
||||
{
|
||||
PartialUnmapState.Reset();
|
||||
ref var state = ref PartialUnmapState.GetRef();
|
||||
ref PartialUnmapState state = ref PartialUnmapState.GetRef();
|
||||
|
||||
bool running = true;
|
||||
var testThread = new Thread(() =>
|
||||
Thread testThread = new Thread(() =>
|
||||
{
|
||||
PartialUnmapState.GetRef().RetryFromAccessViolation();
|
||||
while (running)
|
||||
|
@ -331,11 +332,11 @@ namespace Ryujinx.Tests.Memory
|
|||
|
||||
PartialUnmapState.Reset();
|
||||
|
||||
ref var state = ref PartialUnmapState.GetRef();
|
||||
ref PartialUnmapState state = ref PartialUnmapState.GetRef();
|
||||
|
||||
fixed (void* localMap = &state.LocalCounts)
|
||||
{
|
||||
var getOrReserve = TestMethods.GenerateDebugThreadLocalMapGetOrReserve((nint)localMap);
|
||||
TestMethods.DebugThreadLocalMapGetOrReserve getOrReserve = TestMethods.GenerateDebugThreadLocalMapGetOrReserve((nint)localMap);
|
||||
|
||||
for (int i = 0; i < ThreadLocalMap<int>.MapSize; i++)
|
||||
{
|
||||
|
@ -375,8 +376,8 @@ namespace Ryujinx.Tests.Memory
|
|||
[Test]
|
||||
public void NativeReaderWriterLock()
|
||||
{
|
||||
var rwLock = new NativeReaderWriterLock();
|
||||
var threads = new List<Thread>();
|
||||
NativeReaderWriterLock rwLock = new NativeReaderWriterLock();
|
||||
List<Thread> threads = new List<Thread>();
|
||||
|
||||
int value = 0;
|
||||
|
||||
|
@ -386,7 +387,7 @@ namespace Ryujinx.Tests.Memory
|
|||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
var readThread = new Thread(() =>
|
||||
Thread readThread = new Thread(() =>
|
||||
{
|
||||
int count = 0;
|
||||
while (running)
|
||||
|
@ -423,7 +424,7 @@ namespace Ryujinx.Tests.Memory
|
|||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
var writeThread = new Thread(() =>
|
||||
Thread writeThread = new Thread(() =>
|
||||
{
|
||||
int count = 0;
|
||||
while (running)
|
||||
|
@ -453,7 +454,7 @@ namespace Ryujinx.Tests.Memory
|
|||
threads.Add(writeThread);
|
||||
}
|
||||
|
||||
foreach (var thread in threads)
|
||||
foreach (Thread thread in threads)
|
||||
{
|
||||
thread.Start();
|
||||
}
|
||||
|
@ -462,7 +463,7 @@ namespace Ryujinx.Tests.Memory
|
|||
|
||||
running = false;
|
||||
|
||||
foreach (var thread in threads)
|
||||
foreach (Thread thread in threads)
|
||||
{
|
||||
thread.Join();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue