Add a simple Pools Limiter. (#1830)

* Added support for offline invalidation, via PPTC, of low cq translations replaced by high cq translations; both on a single run and between runs.

Added invalidation of .cache files in the event of reuse on a different user operating system.

Added .info and .cache files invalidation in case of a failed stream decompression.

Nits.

* InternalVersion = 1712;

* Nits.

* Address comment.

* Get rid of BinaryFormatter.

Nits.

* Move Ptc.LoadTranslations().

Nits.

* Nits.

* Fixed corner cases (in case backup copies have to be used). Added save logs.

* Not core fixes.

* Complement to the previous commit. Added load logs. Removed BinaryFormatter leftovers.

* Add LoadTranslations log.

* Nits.

* Removed the search and management of LowCq overlapping functions.

* Final increment of .info and .cache flags.

* Nit.

* Free up memory allocated by Pools during any PPTC translations at boot time.

* Nit due to rebase.

* Add a simple Pools Limiter.

* Nits.

* Fix missing JumpTable.RegisterFunction() due to rebase.

Clear MemoryStreams as soon as possible, when they are no longer needed.

* Code cleaning.

* Nit for retrigger Checks.

* Update Ptc.cs

* Contextual refactoring of Translator. Ignore resetting of pools for DirectCallStubs.

* Nit for retrigger Checks.
This commit is contained in:
LDj3SNuD 2021-01-12 19:04:02 +01:00 committed by GitHub
parent e57b140429
commit 68f6b79fd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 87 additions and 52 deletions

View file

@ -201,15 +201,14 @@ namespace ARMeilleure.Translation
{
ArmEmitterContext context = new ArmEmitterContext(memory, jumpTable, address, highCq, Aarch32Mode.User);
PrepareOperandPool(highCq);
PrepareOperationPool(highCq);
Logger.StartPass(PassName.Decoding);
Block[] blocks = Decoder.Decode(memory, address, mode, highCq, singleBlock: false);
Logger.EndPass(PassName.Decoding);
PreparePool(highCq);
Logger.StartPass(PassName.Translation);
EmitSynchronization(context);
@ -240,23 +239,33 @@ namespace ARMeilleure.Translation
if (Ptc.State == PtcState.Disabled)
{
func = Compiler.Compile<GuestFunction>(cfg, argTypes, OperandType.I64, options);
ReturnPool(highCq);
}
else
else using (PtcInfo ptcInfo = new PtcInfo())
{
using (PtcInfo ptcInfo = new PtcInfo())
{
func = Compiler.Compile<GuestFunction>(cfg, argTypes, OperandType.I64, options, ptcInfo);
func = Compiler.Compile<GuestFunction>(cfg, argTypes, OperandType.I64, options, ptcInfo);
Ptc.WriteInfoCodeReloc(address, funcSize, highCq, ptcInfo);
}
ReturnPool(highCq);
Ptc.WriteInfoCodeRelocUnwindInfo(address, funcSize, highCq, ptcInfo);
}
ReturnOperandPool(highCq);
ReturnOperationPool(highCq);
return new TranslatedFunction(func, funcSize, highCq);
}
internal static void PreparePool(bool highCq)
{
PrepareOperandPool(highCq);
PrepareOperationPool(highCq);
}
internal static void ReturnPool(bool highCq)
{
ReturnOperandPool(highCq);
ReturnOperationPool(highCq);
}
internal static void ResetPools()
{
ResetOperandPools();