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>();
|
CachedSubs = new ConcurrentDictionary<long, ATranslatedSub>();
|
||||||
|
|
||||||
AsyncTranslator = new AsyncTier1Translator();
|
AsyncTranslator = AsyncTier1Translator.GetAsyncTranslator();
|
||||||
|
|
||||||
if (SymbolTable != null)
|
if (SymbolTable != null)
|
||||||
{
|
{
|
||||||
|
@ -96,8 +96,6 @@ namespace ChocolArm64
|
||||||
{
|
{
|
||||||
AsyncTranslator.Enqueue(Position, this, State, Memory);
|
AsyncTranslator.Enqueue(Position, this, State, Memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslateTier1(State, Memory, Position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Position = Sub.Execute(State, Memory);
|
Position = Sub.Execute(State, Memory);
|
||||||
|
|
|
@ -28,8 +28,10 @@ namespace ChocolArm64
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread Thread;
|
private Thread Thread;
|
||||||
BlockingCollection<QueueObj> Queue = new BlockingCollection<QueueObj>();
|
private BlockingCollection<QueueObj> Queue = new BlockingCollection<QueueObj>();
|
||||||
|
|
||||||
|
private static AsyncTier1Translator AsyncTranslator;
|
||||||
|
|
||||||
public AsyncTier1Translator()
|
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)
|
public void Enqueue(long Position, ATranslator Translator, AThreadState State, AMemory Memory)
|
||||||
{
|
{
|
||||||
Queue.Add(new QueueObj(Position, Translator, State, Memory));
|
Queue.Add(new QueueObj(Position, Translator, State, Memory));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue