PatchEngine: Apply speedhack per PC, not only per block entry.

This makes speedhacks indepdent of block assembly / inlining / conditional continue.
This commit is contained in:
degasus 2017-01-28 12:36:13 +01:00
parent 04c3db8bfa
commit c2822ef7d3
3 changed files with 9 additions and 13 deletions

View File

@ -668,9 +668,6 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
fpr.Start();
js.downcountAmount = 0;
if (!SConfig::GetInstance().bEnableDebugging)
js.downcountAmount += PatchEngine::GetSpeedhackCycles(code_block.m_address);
js.skipInstructions = 0;
js.carryFlagSet = false;
js.carryFlagInverted = false;
@ -728,6 +725,9 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
js.revertGprLoad = -1;
js.revertFprLoad = -1;
if (!SConfig::GetInstance().bEnableDebugging)
js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC);
if (i == (code_block.m_num_instructions - 1))
{
if (Profiler::g_ProfileBlocks)

View File

@ -582,8 +582,6 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
ibuild.Reset();
js.downcountAmount = 0;
if (!SConfig::GetInstance().bEnableDebugging)
js.downcountAmount += PatchEngine::GetSpeedhackCycles(code_block.m_address);
// Translate instructions
for (u32 i = 0; i < code_block.m_num_instructions; i++)
@ -594,6 +592,9 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
const GekkoOPInfo* opinfo = GetOpInfo(ops[i].inst);
js.downcountAmount += opinfo->numCycles;
if (!SConfig::GetInstance().bEnableDebugging)
js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC);
if (i == (code_block.m_num_instructions - 1))
js.isLastInstruction = true;

View File

@ -481,9 +481,6 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB
gpr.Start(js.gpa);
fpr.Start(js.fpa);
if (!SConfig::GetInstance().bEnableDebugging)
js.downcountAmount += PatchEngine::GetSpeedhackCycles(em_address);
// Translate instructions
for (u32 i = 0; i < code_block.m_num_instructions; i++)
{
@ -493,12 +490,10 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB
js.instructionsLeft = (code_block.m_num_instructions - 1) - i;
const GekkoOPInfo* opinfo = ops[i].opinfo;
js.downcountAmount += opinfo->numCycles;
js.isLastInstruction = i == (code_block.m_num_instructions - 1);
if (i == (code_block.m_num_instructions - 1))
{
// WARNING - cmp->branch merging will screw this up.
js.isLastInstruction = true;
}
if (!SConfig::GetInstance().bEnableDebugging)
js.downcountAmount += PatchEngine::GetSpeedhackCycles(js.compilerPC);
// Gather pipe writes using a non-immediate address are discovered by profiling.
bool gatherPipeIntCheck =