Remove cold methods from the CPU cache (#224)

* Remove unused tracing functionality from the CPU

* GetNsoExecutable -> GetExecutable

* Unsigned comparison

* Re-add cpu tracing

* Config change

* Remove cold methods from the translation cache on the cpu

* Replace lock with try lock, pass new ATranslatorCache instead of ATranslator

* Rebase fixups
This commit is contained in:
gdkchan 2018-09-19 17:07:56 -03:00 committed by GitHub
parent 99b2692425
commit 6d65e53664
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 318 additions and 232 deletions

View file

@ -10,7 +10,7 @@ namespace ChocolArm64.Translation
{
class AILEmitterCtx
{
private ATranslator Translator;
private ATranslatorCache Cache;
private Dictionary<long, AILLabel> Labels;
@ -40,29 +40,14 @@ namespace ChocolArm64.Translation
private const int Tmp5Index = -5;
public AILEmitterCtx(
ATranslator Translator,
ABlock[] Graph,
ABlock Root,
string SubName)
ATranslatorCache Cache,
ABlock[] Graph,
ABlock Root,
string SubName)
{
if (Translator == null)
{
throw new ArgumentNullException(nameof(Translator));
}
if (Graph == null)
{
throw new ArgumentNullException(nameof(Graph));
}
if (Root == null)
{
throw new ArgumentNullException(nameof(Root));
}
this.Translator = Translator;
this.Graph = Graph;
this.Root = Root;
this.Cache = Cache ?? throw new ArgumentNullException(nameof(Cache));
this.Graph = Graph ?? throw new ArgumentNullException(nameof(Graph));
this.Root = Root ?? throw new ArgumentNullException(nameof(Root));
Labels = new Dictionary<long, AILLabel>();
@ -147,7 +132,12 @@ namespace ChocolArm64.Translation
return false;
}
if (!Translator.TryGetCachedSub(CurrOp, out ATranslatedSub Sub))
if (CurrOp.Emitter != AInstEmit.Bl)
{
return false;
}
if (!Cache.TryGetSubroutine(((AOpCodeBImmAl)CurrOp).Imm, out ATranslatedSub Subroutine))
{
return false;
}
@ -157,7 +147,7 @@ namespace ChocolArm64.Translation
EmitLdarg(Index);
}
foreach (ARegister Reg in Sub.Params)
foreach (ARegister Reg in Subroutine.Params)
{
switch (Reg.Type)
{
@ -167,9 +157,9 @@ namespace ChocolArm64.Translation
}
}
EmitCall(Sub.Method);
EmitCall(Subroutine.Method);
Sub.AddCaller(Root.Position);
Subroutine.AddCaller(Root.Position);
return true;
}