1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-10-01 12:30:00 +02:00

Modify TranslatedFunction.GetPointer () to optimize performance (#995)

* add local var to reduce calling Marshal.GetFunctionPointerForDelegate

* modify code style
This commit is contained in:
Chenj168 2020-03-20 07:11:20 +09:00 committed by GitHub
parent 8226997bc7
commit 561d64e5bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ namespace ARMeilleure.Translation
private const int MinCallsForRejit = 100;
private GuestFunction _func;
private IntPtr _funcPtr;
private bool _rejit;
private int _callCount;
@ -33,7 +34,12 @@ namespace ARMeilleure.Translation
public IntPtr GetPointer()
{
return Marshal.GetFunctionPointerForDelegate(_func);
if (_funcPtr == IntPtr.Zero)
{
_funcPtr = Marshal.GetFunctionPointerForDelegate(_func);
}
return _funcPtr;
}
}
}