Jit64: Move profiler to the end of th block.
Within Cleanup(), it is called at *every* end of the block. This generates bigger code, but it is the only way to handle blocks with multiple exit nodes.
This commit is contained in:
parent
958b75b707
commit
9080192a65
|
@ -371,6 +371,23 @@ bool Jit64::Cleanup()
|
||||||
did_something = true;
|
did_something = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Profiler::g_ProfileBlocks)
|
||||||
|
{
|
||||||
|
ABI_PushRegistersAndAdjustStack({}, 0);
|
||||||
|
// get end tic
|
||||||
|
MOV(64, R(ABI_PARAM1), Imm64(reinterpret_cast<u64>(&js.curBlock->profile_data.ticStop)));
|
||||||
|
ABI_CallFunction(QueryPerformanceCounter);
|
||||||
|
// tic counter += (end tic - start tic)
|
||||||
|
MOV(64, R(RSCRATCH2), Imm64(reinterpret_cast<u64>(&js.curBlock->profile_data)));
|
||||||
|
MOV(64, R(RSCRATCH), MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, ticStop)));
|
||||||
|
SUB(64, R(RSCRATCH), MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, ticStart)));
|
||||||
|
ADD(64, R(RSCRATCH), MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, ticCounter)));
|
||||||
|
ADD(64, MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, downcountCounter)),
|
||||||
|
Imm32(js.downcountAmount));
|
||||||
|
MOV(64, MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, ticCounter)), R(RSCRATCH));
|
||||||
|
ABI_PopRegistersAndAdjustStack({}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
return did_something;
|
return did_something;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,24 +747,6 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
|
||||||
|
|
||||||
if (i == (code_block.m_num_instructions - 1))
|
if (i == (code_block.m_num_instructions - 1))
|
||||||
{
|
{
|
||||||
if (Profiler::g_ProfileBlocks)
|
|
||||||
{
|
|
||||||
// TODO: Move this to WriteExit() calls.
|
|
||||||
BitSet32 registersInUse = CallerSavedRegistersInUse();
|
|
||||||
ABI_PushRegistersAndAdjustStack(registersInUse, 0);
|
|
||||||
// get end tic
|
|
||||||
MOV(64, R(ABI_PARAM1), Imm64(reinterpret_cast<u64>(&b->profile_data.ticStop)));
|
|
||||||
ABI_CallFunction(QueryPerformanceCounter);
|
|
||||||
// tic counter += (end tic - start tic)
|
|
||||||
MOV(64, R(RSCRATCH2), Imm64(reinterpret_cast<u64>(&b->profile_data)));
|
|
||||||
MOV(64, R(RSCRATCH), MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, ticStop)));
|
|
||||||
SUB(64, R(RSCRATCH), MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, ticStart)));
|
|
||||||
ADD(64, R(RSCRATCH), MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, ticCounter)));
|
|
||||||
ADD(64, MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, downcountCounter)),
|
|
||||||
Imm32(js.downcountAmount));
|
|
||||||
MOV(64, MDisp(RSCRATCH2, offsetof(JitBlock::ProfileData, ticCounter)), R(RSCRATCH));
|
|
||||||
ABI_PopRegistersAndAdjustStack(registersInUse, 0);
|
|
||||||
}
|
|
||||||
js.isLastInstruction = true;
|
js.isLastInstruction = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue