misc: Use nint/nuint instead of IntPtr/UIntPtr

This commit is contained in:
KeatonTheBot
2025-11-23 13:42:38 -06:00
parent 2d720fea03
commit c1e24961f9
163 changed files with 845 additions and 845 deletions
+11 -11
View File
@@ -10,31 +10,31 @@ using System.Runtime.InteropServices;
namespace Ryujinx.Cpu.LightningJit
{
delegate void DispatcherFunction(IntPtr nativeContext, ulong startAddress);
delegate void DispatcherFunction(nint nativeContext, ulong startAddress);
/// <summary>
/// Represents a stub manager.
/// </summary>
class TranslatorStubs : IDisposable
{
private delegate ulong GetFunctionAddressDelegate(IntPtr framePointer, ulong address);
private delegate ulong GetFunctionAddressDelegate(nint framePointer, ulong address);
private readonly Lazy<IntPtr> _slowDispatchStub;
private readonly Lazy<nint> _slowDispatchStub;
private bool _disposed;
private readonly IAddressTable<ulong> _functionTable;
private readonly NoWxCache _noWxCache;
private readonly GetFunctionAddressDelegate _getFunctionAddressRef;
private readonly IntPtr _getFunctionAddress;
private readonly Lazy<IntPtr> _dispatchStub;
private readonly nint _getFunctionAddress;
private readonly Lazy<nint> _dispatchStub;
private readonly Lazy<DispatcherFunction> _dispatchLoop;
/// <summary>
/// Gets the dispatch stub.
/// </summary>
/// <exception cref="ObjectDisposedException"><see cref="TranslatorStubs"/> instance was disposed</exception>
public IntPtr DispatchStub
public nint DispatchStub
{
get
{
@@ -48,7 +48,7 @@ namespace Ryujinx.Cpu.LightningJit
/// Gets the slow dispatch stub.
/// </summary>
/// <exception cref="ObjectDisposedException"><see cref="TranslatorStubs"/> instance was disposed</exception>
public IntPtr SlowDispatchStub
public nint SlowDispatchStub
{
get
{
@@ -138,7 +138,7 @@ namespace Ryujinx.Cpu.LightningJit
/// Generates a <see cref="DispatchStub"/>.
/// </summary>
/// <returns>Generated <see cref="DispatchStub"/></returns>
private IntPtr GenerateDispatchStub()
private nint GenerateDispatchStub()
{
List<int> branchToFallbackOffsets = [];
@@ -226,7 +226,7 @@ namespace Ryujinx.Cpu.LightningJit
/// Generates a <see cref="SlowDispatchStub"/>.
/// </summary>
/// <returns>Generated <see cref="SlowDispatchStub"/></returns>
private IntPtr GenerateSlowDispatchStub()
private nint GenerateSlowDispatchStub()
{
CodeWriter writer = new();
@@ -350,12 +350,12 @@ namespace Ryujinx.Cpu.LightningJit
throw new PlatformNotSupportedException();
}
IntPtr pointer = Map(writer.AsByteSpan());
nint pointer = Map(writer.AsByteSpan());
return Marshal.GetDelegateForFunctionPointer<DispatcherFunction>(pointer);
}
private IntPtr Map(ReadOnlySpan<byte> code)
private nint Map(ReadOnlySpan<byte> code)
{
if (_noWxCache != null)
{