diff options
Diffstat (limited to 'ARMeilleure/Translation/Translator.cs')
| -rw-r--r-- | ARMeilleure/Translation/Translator.cs | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/ARMeilleure/Translation/Translator.cs b/ARMeilleure/Translation/Translator.cs index ac96475f..f64912b3 100644 --- a/ARMeilleure/Translation/Translator.cs +++ b/ARMeilleure/Translation/Translator.cs @@ -11,8 +11,10 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Runtime; using System.Threading; +using static ARMeilleure.Common.BitMapPool; using static ARMeilleure.IntermediateRepresentation.OperandHelper; using static ARMeilleure.IntermediateRepresentation.OperationHelper; @@ -148,10 +150,12 @@ namespace ARMeilleure.Translation ClearJitCache(); - ResetPools(); + DisposePools(); _jumpTable.Dispose(); _jumpTable = null; + + GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; } } @@ -207,7 +211,7 @@ namespace ARMeilleure.Translation Logger.EndPass(PassName.Decoding); - PreparePool(highCq); + PreparePool(highCq ? 1 : 0); Logger.StartPass(PassName.Translation); @@ -240,13 +244,15 @@ namespace ARMeilleure.Translation { func = Compiler.Compile<GuestFunction>(cfg, argTypes, OperandType.I64, options); - ReturnPool(highCq); + ResetPool(highCq ? 1 : 0); } - else using (PtcInfo ptcInfo = new PtcInfo()) + else { + using PtcInfo ptcInfo = new PtcInfo(); + func = Compiler.Compile<GuestFunction>(cfg, argTypes, OperandType.I64, options, ptcInfo); - ReturnPool(highCq); + ResetPool(highCq ? 1 : 0); Ptc.WriteInfoCodeRelocUnwindInfo(address, funcSize, highCq, ptcInfo); } @@ -254,22 +260,23 @@ namespace ARMeilleure.Translation return new TranslatedFunction(func, funcSize, highCq); } - internal static void PreparePool(bool highCq) + internal static void PreparePool(int groupId = 0) { - PrepareOperandPool(highCq); - PrepareOperationPool(highCq); + PrepareOperandPool(groupId); + PrepareOperationPool(groupId); } - internal static void ReturnPool(bool highCq) + internal static void ResetPool(int groupId = 0) { - ReturnOperandPool(highCq); - ReturnOperationPool(highCq); + ResetOperationPool(groupId); + ResetOperandPool(groupId); } - internal static void ResetPools() + internal static void DisposePools() { - ResetOperandPools(); - ResetOperationPools(); + DisposeOperandPools(); + DisposeOperationPools(); + DisposeBitMapPools(); } private struct Range |
