Permalink
Browse files

CachedInterpreter: Clean up code buffer accesses in Jit()

Done similarly for the reasons Jit64 was done. Localizes indexing to one
place instead of repeatedly indexing the same place.
  • Loading branch information...
lioncash committed May 14, 2018
1 parent a16c0a6 commit f4affa3d1d4d944af5f31a26588818a16617a463
Showing with 13 additions and 12 deletions.
  1. +13 −12 Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp
@@ -198,16 +198,17 @@ void CachedInterpreter::Jit(u32 address)
js.downcountAmount = 0;
js.curBlock = b;
PPCAnalyst::CodeOp* ops = code_buffer.codebuffer;
b->checkedEntry = GetCodePtr();
b->normalEntry = GetCodePtr();
PPCAnalyst::CodeOp* const ops = code_buffer.codebuffer;
for (u32 i = 0; i < code_block.m_num_instructions; i++)
{
js.downcountAmount += ops[i].opinfo->numCycles;
PPCAnalyst::CodeOp& op = ops[i];
js.downcountAmount += op.opinfo->numCycles;
u32 function = HLE::GetFirstFunctionIndex(ops[i].address);
u32 function = HLE::GetFirstFunctionIndex(op.address);
if (function != 0)
{
HLE::HookType type = HLE::GetFunctionTypeByIndex(function);
@@ -216,7 +217,7 @@ void CachedInterpreter::Jit(u32 address)
HLE::HookFlag flags = HLE::GetFunctionFlagsByIndex(function);
if (HLE::IsEnabled(flags))
{
m_code.emplace_back(WritePC, ops[i].address);
m_code.emplace_back(WritePC, op.address);
m_code.emplace_back(Interpreter::HLEFunction, function);
if (type == HLE::HookType::Replace)
{
@@ -228,22 +229,22 @@ void CachedInterpreter::Jit(u32 address)
}
}
if (!ops[i].skip)
if (!op.skip)
{
bool check_fpu = (ops[i].opinfo->flags & FL_USE_FPU) && !js.firstFPInstructionFound;
bool endblock = (ops[i].opinfo->flags & FL_ENDBLOCK) != 0;
bool memcheck = (ops[i].opinfo->flags & FL_LOADSTORE) && jo.memcheck;
const bool check_fpu = (op.opinfo->flags & FL_USE_FPU) && !js.firstFPInstructionFound;
const bool endblock = (op.opinfo->flags & FL_ENDBLOCK) != 0;
const bool memcheck = (op.opinfo->flags & FL_LOADSTORE) && jo.memcheck;
if (check_fpu)
{
m_code.emplace_back(WritePC, ops[i].address);
m_code.emplace_back(WritePC, op.address);
m_code.emplace_back(CheckFPU, js.downcountAmount);
js.firstFPInstructionFound = true;
}
if (endblock || memcheck)
m_code.emplace_back(WritePC, ops[i].address);
m_code.emplace_back(PPCTables::GetInterpreterOp(ops[i].inst), ops[i].inst);
m_code.emplace_back(WritePC, op.address);
m_code.emplace_back(PPCTables::GetInterpreterOp(op.inst), op.inst);
if (memcheck)
m_code.emplace_back(CheckDSI, js.downcountAmount);
if (endblock)

0 comments on commit f4affa3

Please sign in to comment.