diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-09-19 17:07:56 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-19 17:07:56 -0300 |
| commit | 6d65e536642a7cff7afa34be10fdc8ca66a6e79c (patch) | |
| tree | 6e7344ea3f5ea7bb84c3b11c241ff7f579457c3e /ChocolArm64/Translation | |
| parent | 99b2692425ff4045f103cde0745624b9b41d6fe6 (diff) | |
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
Diffstat (limited to 'ChocolArm64/Translation')
| -rw-r--r-- | ChocolArm64/Translation/AILEmitterCtx.cs | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/ChocolArm64/Translation/AILEmitterCtx.cs b/ChocolArm64/Translation/AILEmitterCtx.cs index 48700715..cad0d323 100644 --- a/ChocolArm64/Translation/AILEmitterCtx.cs +++ b/ChocolArm64/Translation/AILEmitterCtx.cs @@ -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; } |
