aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Translation/TranslatedFunction.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/Translation/TranslatedFunction.cs')
-rw-r--r--ARMeilleure/Translation/TranslatedFunction.cs20
1 files changed, 4 insertions, 16 deletions
diff --git a/ARMeilleure/Translation/TranslatedFunction.cs b/ARMeilleure/Translation/TranslatedFunction.cs
index 8b075928..04dd769c 100644
--- a/ARMeilleure/Translation/TranslatedFunction.cs
+++ b/ARMeilleure/Translation/TranslatedFunction.cs
@@ -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<uint> 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<uint> 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);
- }
}
} \ No newline at end of file