mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-11-17 16:31:02 -05:00
misc: Replace references to IntPtr/UIntPtr with nint/nuint + code cleanups.
This commit is contained in:
@@ -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 AddressTable<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 = new();
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user