Create only one Tier1Translator for all Threads
This commit is contained in:
parent
083383a00b
commit
8e5d66785a
2 changed files with 15 additions and 5 deletions
|
@ -30,7 +30,7 @@ namespace ChocolArm64
|
|||
{
|
||||
CachedSubs = new ConcurrentDictionary<long, ATranslatedSub>();
|
||||
|
||||
AsyncTranslator = new AsyncTier1Translator();
|
||||
AsyncTranslator = AsyncTier1Translator.GetAsyncTranslator();
|
||||
|
||||
if (SymbolTable != null)
|
||||
{
|
||||
|
@ -96,8 +96,6 @@ namespace ChocolArm64
|
|||
{
|
||||
AsyncTranslator.Enqueue(Position, this, State, Memory);
|
||||
}
|
||||
|
||||
TranslateTier1(State, Memory, Position);
|
||||
}
|
||||
|
||||
Position = Sub.Execute(State, Memory);
|
||||
|
|
|
@ -28,8 +28,10 @@ namespace ChocolArm64
|
|||
}
|
||||
}
|
||||
|
||||
Thread Thread;
|
||||
BlockingCollection<QueueObj> Queue = new BlockingCollection<QueueObj>();
|
||||
private Thread Thread;
|
||||
private BlockingCollection<QueueObj> Queue = new BlockingCollection<QueueObj>();
|
||||
|
||||
private static AsyncTier1Translator AsyncTranslator;
|
||||
|
||||
public AsyncTier1Translator()
|
||||
{
|
||||
|
@ -46,6 +48,16 @@ namespace ChocolArm64
|
|||
}
|
||||
}
|
||||
|
||||
public static AsyncTier1Translator GetAsyncTranslator()
|
||||
{
|
||||
if (AsyncTranslator == null)
|
||||
{
|
||||
AsyncTranslator = new AsyncTier1Translator();
|
||||
}
|
||||
|
||||
return AsyncTranslator;
|
||||
}
|
||||
|
||||
public void Enqueue(long Position, ATranslator Translator, AThreadState State, AMemory Memory)
|
||||
{
|
||||
Queue.Add(new QueueObj(Position, Translator, State, Memory));
|
||||
|
|
Loading…
Add table
Reference in a new issue