RejitRequest as a class rather than a tuple
Makes a lot more sense than storing tuples on a dictionary.
This commit is contained in:
parent
1d5cf13b9f
commit
08311618a8
2 changed files with 20 additions and 4 deletions
16
ARMeilleure/Translation/RejitRequest.cs
Normal file
16
ARMeilleure/Translation/RejitRequest.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
using ARMeilleure.State;
|
||||||
|
|
||||||
|
namespace ARMeilleure.Translation
|
||||||
|
{
|
||||||
|
class RejitRequest
|
||||||
|
{
|
||||||
|
public ulong Address;
|
||||||
|
public ExecutionMode Mode;
|
||||||
|
|
||||||
|
public RejitRequest(ulong address, ExecutionMode mode)
|
||||||
|
{
|
||||||
|
Address = address;
|
||||||
|
Mode = mode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,7 +20,7 @@ namespace ARMeilleure.Translation
|
||||||
|
|
||||||
private ConcurrentDictionary<ulong, TranslatedFunction> _funcs;
|
private ConcurrentDictionary<ulong, TranslatedFunction> _funcs;
|
||||||
|
|
||||||
private PriorityQueue<(ulong Address, ExecutionMode Mode)> _backgroundQueue;
|
private PriorityQueue<RejitRequest> _backgroundQueue;
|
||||||
|
|
||||||
private AutoResetEvent _backgroundTranslatorEvent;
|
private AutoResetEvent _backgroundTranslatorEvent;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace ARMeilleure.Translation
|
||||||
|
|
||||||
_funcs = new ConcurrentDictionary<ulong, TranslatedFunction>();
|
_funcs = new ConcurrentDictionary<ulong, TranslatedFunction>();
|
||||||
|
|
||||||
_backgroundQueue = new PriorityQueue<(ulong, ExecutionMode)>(2);
|
_backgroundQueue = new PriorityQueue<RejitRequest>(2);
|
||||||
|
|
||||||
_backgroundTranslatorEvent = new AutoResetEvent(false);
|
_backgroundTranslatorEvent = new AutoResetEvent(false);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace ARMeilleure.Translation
|
||||||
{
|
{
|
||||||
while (_threadCount != 0)
|
while (_threadCount != 0)
|
||||||
{
|
{
|
||||||
if (_backgroundQueue.TryDequeue(out (ulong Address, ExecutionMode Mode) request))
|
if (_backgroundQueue.TryDequeue(out RejitRequest request))
|
||||||
{
|
{
|
||||||
TranslatedFunction func = Translate(request.Address, request.Mode, highCq: true);
|
TranslatedFunction func = Translate(request.Address, request.Mode, highCq: true);
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ namespace ARMeilleure.Translation
|
||||||
}
|
}
|
||||||
else if (isCallTarget && func.ShouldRejit())
|
else if (isCallTarget && func.ShouldRejit())
|
||||||
{
|
{
|
||||||
_backgroundQueue.Enqueue(0, (address, mode));
|
_backgroundQueue.Enqueue(0, new RejitRequest(address, mode));
|
||||||
|
|
||||||
_backgroundTranslatorEvent.Set();
|
_backgroundTranslatorEvent.Set();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue