summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2017-08-12 22:46:50 +0200
committerdegasus <wickmarkus@web.de>2017-09-02 13:05:58 +0200
commit9080192a656d0ab70f079cdb9bd3cbb31b05a0d4 (patch)
treed5680a2db70cf8eba5a7d92d73303fc7708efa7c /Source/Core
parent958b75b707e78e3b5bcc7fa9b54ea5a1d87926de (diff)
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.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Jit64/Jit.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
index 875a3a298b..d046a639ad 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
@@ -371,6 +371,23 @@ bool Jit64::Cleanup()
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;
}
@@ -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 (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;
}