Ryujinx/Ryujinx.Cpu/CpuContext.cs
gdkchan 61634dd415
Clear JIT cache on exit (#1518)
* Initial cache memory allocator implementation

* Get rid of CallFlag

* Perform cache cleanup on exit

* Basic cache invalidation

* Thats not how conditionals works in C# it seems

* Set PTC version to PR number

* Address PR feedback

* Update InstEmitFlowHelper.cs

* Flag clear on address is no longer needed

* Do not include exit block in function size calculation

* Dispose jump table

* For future use

* InternalVersion = 1519 (force retest).

Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>
2020-12-16 17:07:42 -03:00

32 lines
807 B
C#

using ARMeilleure.State;
using ARMeilleure.Translation;
namespace Ryujinx.Cpu
{
public class CpuContext
{
private readonly Translator _translator;
public CpuContext(MemoryManager memory)
{
_translator = new Translator(new JitMemoryAllocator(), memory);
memory.UnmapEvent += UnmapHandler;
}
private void UnmapHandler(ulong address, ulong size)
{
_translator.InvalidateJitCacheRegion(address, size);
}
public static ExecutionContext CreateExecutionContext()
{
return new ExecutionContext(new JitMemoryAllocator());
}
public void Execute(ExecutionContext context, ulong address)
{
_translator.Execute(context, address);
}
}
}