mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-07-03 09:39:04 +00:00
instanced jit cache (#152)
- jit caches are no longer static. - JitUnwindWindows now supports multiple jit caches. - Jit caches should no longer cause crashes due to entry offset collisions. - cpu tests now run concurrently. Co-authored-by: LotP1 <68976644+LotP1@users.noreply.github.com> Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/152
This commit is contained in:
@@ -19,6 +19,8 @@ namespace Ryujinx.Cpu.LightningJit
|
||||
{
|
||||
private delegate ulong GetFunctionAddressDelegate(nint framePointer, ulong address);
|
||||
|
||||
private readonly JitCache _jitCache;
|
||||
|
||||
private readonly Lazy<nint> _slowDispatchStub;
|
||||
|
||||
private bool _disposed;
|
||||
@@ -76,13 +78,16 @@ namespace Ryujinx.Cpu.LightningJit
|
||||
/// Initializes a new instance of the <see cref="TranslatorStubs"/> class with the specified
|
||||
/// <see cref="Translator"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="jitCache">Jit cache to map functions in</param>
|
||||
/// <param name="functionTable">Function table used to store pointers to the functions that the guest code will call</param>
|
||||
/// <param name="noWxCache">Cache used on platforms that enforce W^X, otherwise should be null</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="translator"/> is null</exception>
|
||||
public TranslatorStubs(IAddressTable<ulong> functionTable, NoWxCache noWxCache)
|
||||
public TranslatorStubs(JitCache jitCache, IAddressTable<ulong> functionTable, NoWxCache noWxCache)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(functionTable);
|
||||
|
||||
_jitCache = jitCache;
|
||||
|
||||
_functionTable = functionTable;
|
||||
_noWxCache = noWxCache;
|
||||
_getFunctionAddressRef = NativeInterface.GetFunctionAddress;
|
||||
@@ -113,12 +118,12 @@ namespace Ryujinx.Cpu.LightningJit
|
||||
{
|
||||
if (_dispatchStub.IsValueCreated)
|
||||
{
|
||||
JitCache.Unmap(_dispatchStub.Value);
|
||||
_jitCache.Unmap(_dispatchStub.Value);
|
||||
}
|
||||
|
||||
if (_dispatchLoop.IsValueCreated)
|
||||
{
|
||||
JitCache.Unmap(Marshal.GetFunctionPointerForDelegate(_dispatchLoop.Value));
|
||||
_jitCache.Unmap(Marshal.GetFunctionPointerForDelegate(_dispatchLoop.Value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +368,7 @@ namespace Ryujinx.Cpu.LightningJit
|
||||
}
|
||||
else
|
||||
{
|
||||
return JitCache.Map(code);
|
||||
return _jitCache.Map(code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user