diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 1ba9d51d27..8a424ad805 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -874,7 +874,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc fpr.BindToRegister(reg, true, false); } - Jit64Tables::CompileInstruction(*this, ops[i]); + CompileInstruction(ops[i]); if (jo.memcheck && (opinfo->flags & FL_LOADSTORE)) { diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.h b/Source/Core/Core/PowerPC/Jit64/Jit.h index 1c48da0650..af990d1f12 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.h +++ b/Source/Core/Core/PowerPC/Jit64/Jit.h @@ -31,22 +31,6 @@ class Jit64 : public Jitx86Base { -private: - void AllocStack(); - void FreeStack(); - - GPRRegCache gpr{*this}; - FPURegCache fpr{*this}; - - // The default code buffer. We keep it around to not have to alloc/dealloc a - // large chunk of memory for each recompiled block. - PPCAnalyst::CodeBuffer code_buffer; - Jit64AsmRoutineManager asm_routines; - - bool m_enable_blr_optimization; - bool m_cleanup_after_stackfault; - u8* m_stack; - public: Jit64() : code_buffer(32000) {} ~Jit64() {} @@ -248,4 +232,22 @@ public: void dcbx(UGeckoInstruction inst); void eieio(UGeckoInstruction inst); + +private: + void CompileInstruction(PPCAnalyst::CodeOp& op); + + void AllocStack(); + void FreeStack(); + + GPRRegCache gpr{*this}; + FPURegCache fpr{*this}; + + // The default code buffer. We keep it around to not have to alloc/dealloc a + // large chunk of memory for each recompiled block. + PPCAnalyst::CodeBuffer code_buffer; + Jit64AsmRoutineManager asm_routines; + + bool m_enable_blr_optimization; + bool m_cleanup_after_stackfault; + u8* m_stack; }; diff --git a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp index 7981d7e333..93988b44f5 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp @@ -358,25 +358,26 @@ static GekkoOPTemplate table63_2[] = { {31, &Jit64::fmaddXX}, // fnmaddx }; -namespace Jit64Tables +void Jit64::CompileInstruction(PPCAnalyst::CodeOp& op) { -void CompileInstruction(Jit64& jit, PPCAnalyst::CodeOp& op) -{ - (jit.*dynaOpTable[op.inst.OPCD])(op.inst); + (this->*dynaOpTable[op.inst.OPCD])(op.inst); + GekkoOPInfo* info = op.opinfo; if (info) { #ifdef OPLOG if (!strcmp(info->opname, OP_TO_LOG)) // "mcrfs" { - rsplocations.push_back(jit.js.compilerPC); + rsplocations.push_back(js.compilerPC); } #endif info->compileCount++; - info->lastUse = jit.js.compilerPC; + info->lastUse = js.compilerPC; } } +namespace Jit64Tables +{ void InitTables() { // once initialized, tables are read-only diff --git a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.h b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.h index 8daa24f360..90e1d2b766 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.h +++ b/Source/Core/Core/PowerPC/Jit64/Jit64_Tables.h @@ -13,6 +13,5 @@ struct CodeOp; namespace Jit64Tables { -void CompileInstruction(Jit64& jit, PPCAnalyst::CodeOp& op); void InitTables(); } diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp index ba4d8291da..e864aefe2b 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp @@ -640,7 +640,7 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc ibuild.EmitBreakPointCheck(ibuild.EmitIntConst(ops[i].address)); } - JitILTables::CompileInstruction(*this, ops[i]); + CompileInstruction(ops[i]); if (jo.memcheck && (opinfo->flags & FL_LOADSTORE)) { diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.h b/Source/Core/Core/PowerPC/Jit64IL/JitIL.h index 5dd943aa02..434c446e98 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.h +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.h @@ -77,4 +77,7 @@ public: void DynaRunTable31(UGeckoInstruction _inst) override; void DynaRunTable59(UGeckoInstruction _inst) override; void DynaRunTable63(UGeckoInstruction _inst) override; + +private: + void CompileInstruction(PPCAnalyst::CodeOp& op); }; diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.cpp index ab69cc5283..d7fe49d435 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.cpp @@ -376,30 +376,31 @@ static GekkoOPTemplate table63_2[] = { {31, &JitIL::fmaddXX}, //"fnmaddx", OPTYPE_FPU, FL_RC_BIT_F}}, }; -namespace JitILTables +void JitIL::CompileInstruction(PPCAnalyst::CodeOp& op) { -void CompileInstruction(JitIL& jit, PPCAnalyst::CodeOp& op) -{ - (jit.*dynaOpTable[op.inst.OPCD])(op.inst); + (this->*dynaOpTable[op.inst.OPCD])(op.inst); + GekkoOPInfo* info = op.opinfo; if (info) { #ifdef OPLOG if (!strcmp(info->opname, OP_TO_LOG)) // "mcrfs" { - rsplocations.push_back(jit.js.compilerPC); + rsplocations.push_back(js.compilerPC); } #endif info->compileCount++; - info->lastUse = jit.js.compilerPC; + info->lastUse = js.compilerPC; } else { PanicAlert("Tried to compile illegal (or unknown) instruction %08x, at %08x", op.inst.hex, - jit.js.compilerPC); + js.compilerPC); } } +namespace JitILTables +{ void InitTables() { // once initialized, tables are read-only diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.h b/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.h index 89c0b766e4..a66cfa4188 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.h +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL_Tables.h @@ -13,6 +13,5 @@ struct CodeOp; namespace JitILTables { -void CompileInstruction(JitIL& jit, PPCAnalyst::CodeOp& op); void InitTables(); } diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index 50cd4f908f..dcf13f5672 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -846,7 +846,7 @@ void JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock* js.firstFPInstructionFound = true; } - JitArm64Tables::CompileInstruction(*this, ops[i]); + CompileInstruction(ops[i]); if (!MergeAllowedNextInstructions(1) || js.op[1].opinfo->type != OPTYPE_INTEGER) FlushCarry(); diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.h b/Source/Core/Core/PowerPC/JitArm64/Jit.h index bf2bdc4a47..7e006432a0 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.h +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.h @@ -172,29 +172,7 @@ private: const u8* slowmem_code; }; - // - std::map m_fault_to_handler; - std::map m_handler_to_loc; - Arm64GPRCache gpr; - Arm64FPRCache fpr; - - JitArm64BlockCache blocks{*this}; - - PPCAnalyst::CodeBuffer code_buffer; - - ARM64FloatEmitter m_float_emit; - - Arm64Gen::ARM64CodeBlock farcode; - u8* nearcode; // Backed up when we switch to far code. - - // Do we support cycle counter profiling? - bool m_supports_cycle_counter; - - bool m_enable_blr_optimization; - bool m_cleanup_after_stackfault = false; - u8* m_stack_base = nullptr; - u8* m_stack_pointer = nullptr; - u8* m_saved_stack_pointer = nullptr; + void CompileInstruction(PPCAnalyst::CodeOp& op); void EmitResetCycleCounters(); void EmitGetCycles(Arm64Gen::ARM64Reg reg); @@ -260,4 +238,28 @@ private: void reg_imm(u32 d, u32 a, u32 value, u32 (*do_op)(u32, u32), void (ARM64XEmitter::*op)(ARM64Reg, ARM64Reg, u64, ARM64Reg), bool Rc = false); + + // + std::map m_fault_to_handler; + std::map m_handler_to_loc; + Arm64GPRCache gpr; + Arm64FPRCache fpr; + + JitArm64BlockCache blocks{*this}; + + PPCAnalyst::CodeBuffer code_buffer; + + ARM64FloatEmitter m_float_emit; + + Arm64Gen::ARM64CodeBlock farcode; + u8* nearcode; // Backed up when we switch to far code. + + // Do we support cycle counter profiling? + bool m_supports_cycle_counter; + + bool m_enable_blr_optimization; + bool m_cleanup_after_stackfault = false; + u8* m_stack_base = nullptr; + u8* m_stack_pointer = nullptr; + u8* m_saved_stack_pointer = nullptr; }; diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp index 85c0072fbd..63565589da 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.cpp @@ -367,25 +367,26 @@ static GekkoOPTemplate table63_2[] = { {31, &JitArm64::fp_arith}, // fnmaddx }; -namespace JitArm64Tables +void JitArm64::CompileInstruction(PPCAnalyst::CodeOp& op) { -void CompileInstruction(JitArm64& jit, PPCAnalyst::CodeOp& op) -{ - (jit.*dynaOpTable[op.inst.OPCD])(op.inst); + (this->*dynaOpTable[op.inst.OPCD])(op.inst); + GekkoOPInfo* info = op.opinfo; if (info) { #ifdef OPLOG if (!strcmp(info->opname, OP_TO_LOG)) { ///"mcrfs" - rsplocations.push_back(jit.js.compilerPC); + rsplocations.push_back(js.compilerPC); } #endif info->compileCount++; - info->lastUse = jit.js.compilerPC; + info->lastUse = js.compilerPC; } } +namespace JitArm64Tables +{ void InitTables() { // once initialized, tables are read-only diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.h b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.h index e351c01feb..bf1987bf1f 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.h +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_Tables.h @@ -13,6 +13,5 @@ struct CodeOp; namespace JitArm64Tables { -void CompileInstruction(JitArm64& jit, PPCAnalyst::CodeOp& op); void InitTables(); }