mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-08-02 17:02:24 -07:00
Add PPTC support
This commit is contained in:
@@ -1,24 +1,22 @@
|
||||
using ARMeilleure.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace ARMeilleure.Translation
|
||||
{
|
||||
class TranslatedFunction
|
||||
{
|
||||
private const int MinCallsForRejit = 100;
|
||||
|
||||
private readonly GuestFunction _func; // Ensure that this delegate will not be garbage collected.
|
||||
|
||||
private int _callCount;
|
||||
|
||||
public Counter CallCounter { get; }
|
||||
public ulong GuestSize { get; }
|
||||
public bool HighCq { get; }
|
||||
public IntPtr FuncPtr { get; }
|
||||
|
||||
public TranslatedFunction(GuestFunction func, ulong guestSize, bool highCq)
|
||||
public TranslatedFunction(GuestFunction func, Counter callCounter, ulong guestSize, bool highCq)
|
||||
{
|
||||
_func = func;
|
||||
CallCounter = callCounter;
|
||||
GuestSize = guestSize;
|
||||
HighCq = highCq;
|
||||
FuncPtr = Marshal.GetFunctionPointerForDelegate(func);
|
||||
@@ -28,15 +26,5 @@ namespace ARMeilleure.Translation
|
||||
{
|
||||
return _func(context.NativeContextPtr);
|
||||
}
|
||||
|
||||
public bool ShouldRejit()
|
||||
{
|
||||
return !HighCq && Interlocked.Increment(ref _callCount) == MinCallsForRejit;
|
||||
}
|
||||
|
||||
public void ResetCallCount()
|
||||
{
|
||||
Interlocked.Exchange(ref _callCount, 0);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user