From 2aff9a3c428820376bc1b8ea608a450d55bd9602 Mon Sep 17 00:00:00 2001 From: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com> Date: Wed, 25 Sep 2019 00:34:04 +0200 Subject: [PATCH] Translator response tweak for Aot disabled. Nit. --- ARMeilleure/Translation/Translator.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ARMeilleure/Translation/Translator.cs b/ARMeilleure/Translation/Translator.cs index d0e3b3c97e..586ae2cb80 100644 --- a/ARMeilleure/Translation/Translator.cs +++ b/ARMeilleure/Translation/Translator.cs @@ -20,16 +20,17 @@ namespace ARMeilleure.Translation { private const ulong CallFlag = InstEmitFlowHelper.CallFlag; - private MemoryManager _memory; + private readonly MemoryManager _memory; private readonly object _locker; - private Dictionary _funcs; - private ConcurrentDictionary _funcsHighCq; + private readonly Dictionary _funcs; + private readonly ConcurrentDictionary _funcsHighCq; - private ConcurrentQueue _backgroundQueue; + private readonly int _maxBackgroundQueueCount = 30; + private readonly ConcurrentQueue _backgroundQueue; - private AutoResetEvent _backgroundTranslatorEvent; + private readonly AutoResetEvent _backgroundTranslatorEvent; private volatile int _threadCount; @@ -45,6 +46,8 @@ namespace ARMeilleure.Translation if (Aot.Enabled) { Aot.FullTranslate(_funcsHighCq, memory.PageTable); + + _maxBackgroundQueueCount *= 10; } _backgroundQueue = new ConcurrentQueue(); @@ -116,8 +119,6 @@ namespace ARMeilleure.Translation private TranslatedFunction GetOrTranslate(ulong address, ExecutionMode mode) { - const int MaxBackgroundQueueCount = 300; - // TODO: Investigate how we should handle code at unaligned addresses. // Currently, those low bits are used to store special flags. bool isCallTarget = (address & CallFlag) != 0; @@ -139,7 +140,7 @@ namespace ARMeilleure.Translation Debug.Assert(isAddressUnique, $"The address 0x{address:X16} is not unique."); } - if (isCallTarget && func.GetRejit() && _backgroundQueue.Count < MaxBackgroundQueueCount) + if (isCallTarget && func.GetRejit() && _backgroundQueue.Count < _maxBackgroundQueueCount) { func.ResetRejit();