mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-01 11:17:18 +01:00
Modify TranslatedFunction.GetPointer () to optimize performance (#995)
* add local var to reduce calling Marshal.GetFunctionPointerForDelegate * modify code style
This commit is contained in:
parent
8226997bc7
commit
561d64e5bf
@ -9,6 +9,7 @@ namespace ARMeilleure.Translation
|
|||||||
private const int MinCallsForRejit = 100;
|
private const int MinCallsForRejit = 100;
|
||||||
|
|
||||||
private GuestFunction _func;
|
private GuestFunction _func;
|
||||||
|
private IntPtr _funcPtr;
|
||||||
|
|
||||||
private bool _rejit;
|
private bool _rejit;
|
||||||
private int _callCount;
|
private int _callCount;
|
||||||
@ -33,7 +34,12 @@ namespace ARMeilleure.Translation
|
|||||||
|
|
||||||
public IntPtr GetPointer()
|
public IntPtr GetPointer()
|
||||||
{
|
{
|
||||||
return Marshal.GetFunctionPointerForDelegate(_func);
|
if (_funcPtr == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
_funcPtr = Marshal.GetFunctionPointerForDelegate(_func);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _funcPtr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user