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>
This commit is contained in:
parent
11222516c4
commit
61634dd415
24 changed files with 827 additions and 357 deletions
|
@ -23,16 +23,16 @@ namespace ARMeilleure.Instructions
|
|||
}
|
||||
|
||||
[ThreadStatic]
|
||||
private static ThreadContext _context;
|
||||
private static ThreadContext Context;
|
||||
|
||||
public static void RegisterThread(ExecutionContext context, IMemoryManager memory, Translator translator)
|
||||
{
|
||||
_context = new ThreadContext(context, memory, translator);
|
||||
Context = new ThreadContext(context, memory, translator);
|
||||
}
|
||||
|
||||
public static void UnregisterThread()
|
||||
{
|
||||
_context = null;
|
||||
Context = null;
|
||||
}
|
||||
|
||||
public static void Break(ulong address, int imm)
|
||||
|
@ -231,14 +231,24 @@ namespace ARMeilleure.Instructions
|
|||
|
||||
public static ulong GetFunctionAddress(ulong address)
|
||||
{
|
||||
TranslatedFunction function = _context.Translator.GetOrTranslate(address, GetContext().ExecutionMode);
|
||||
return GetFunctionAddressWithHint(address, true);
|
||||
}
|
||||
|
||||
public static ulong GetFunctionAddressWithoutRejit(ulong address)
|
||||
{
|
||||
return GetFunctionAddressWithHint(address, false);
|
||||
}
|
||||
|
||||
private static ulong GetFunctionAddressWithHint(ulong address, bool hintRejit)
|
||||
{
|
||||
TranslatedFunction function = Context.Translator.GetOrTranslate(address, GetContext().ExecutionMode, hintRejit);
|
||||
|
||||
return (ulong)function.FuncPtr.ToInt64();
|
||||
}
|
||||
|
||||
public static ulong GetIndirectFunctionAddress(ulong address, ulong entryAddress)
|
||||
{
|
||||
TranslatedFunction function = _context.Translator.GetOrTranslate(address, GetContext().ExecutionMode);
|
||||
TranslatedFunction function = Context.Translator.GetOrTranslate(address, GetContext().ExecutionMode, hintRejit: true);
|
||||
|
||||
ulong ptr = (ulong)function.FuncPtr.ToInt64();
|
||||
|
||||
|
@ -266,12 +276,12 @@ namespace ARMeilleure.Instructions
|
|||
|
||||
public static ExecutionContext GetContext()
|
||||
{
|
||||
return _context.Context;
|
||||
return Context.Context;
|
||||
}
|
||||
|
||||
public static IMemoryManager GetMemoryManager()
|
||||
{
|
||||
return _context.Memory;
|
||||
return Context.Memory;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue