From c2587abcea76b8daec96f18fe51a43512c579605 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 16 Dec 2016 22:01:06 +0100 Subject: [PATCH] mVU: always call perf before leaving the compilation function I misses some early return in my first tentative. Now VTune shows me properly the time in VU recompiler. Note: It seem some block overlap (likely due to the branching mess). But it is still way better than no data --- pcsx2/x86/microVU_Compile.inl | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pcsx2/x86/microVU_Compile.inl b/pcsx2/x86/microVU_Compile.inl index edf3db83b0..6b4da0b317 100644 --- a/pcsx2/x86/microVU_Compile.inl +++ b/pcsx2/x86/microVU_Compile.inl @@ -629,7 +629,7 @@ void* mVUcompile(microVU& mVU, u32 startPC, uptr pState) { if (isEvilBlock) { mVUsetupRange(mVU, xPC, false); normJumpCompile(mVU, mFC, true); - return thisPtr; + goto perf_and_return; } else if (!mVUinfo.isBdelay) { incPC(1); @@ -638,18 +638,18 @@ void* mVUcompile(microVU& mVU, u32 startPC, uptr pState) { mVUsetupRange(mVU, xPC, false); mVUdebugPrintBlocks(mVU, true); incPC(-3); // Go back to branch opcode - + switch (mVUlow.branch) { - case 1: case 2: normBranch(mVU, mFC); return thisPtr; // B/BAL - case 9: case 10: normJump (mVU, mFC); return thisPtr; // JR/JALR - case 3: condBranch(mVU, mFC, Jcc_Equal); return thisPtr; // IBEQ - case 4: condBranch(mVU, mFC, Jcc_GreaterOrEqual); return thisPtr; // IBGEZ - case 5: condBranch(mVU, mFC, Jcc_Greater); return thisPtr; // IBGTZ - case 6: condBranch(mVU, mFC, Jcc_LessOrEqual); return thisPtr; // IBLEQ - case 7: condBranch(mVU, mFC, Jcc_Less); return thisPtr; // IBLTZ - case 8: condBranch(mVU, mFC, Jcc_NotEqual); return thisPtr; // IBNEQ + case 1: case 2: normBranch(mVU, mFC); goto perf_and_return; // B/BAL + case 9: case 10: normJump (mVU, mFC); goto perf_and_return; // JR/JALR + case 3: condBranch(mVU, mFC, Jcc_Equal); goto perf_and_return; // IBEQ + case 4: condBranch(mVU, mFC, Jcc_GreaterOrEqual); goto perf_and_return; // IBGEZ + case 5: condBranch(mVU, mFC, Jcc_Greater); goto perf_and_return; // IBGTZ + case 6: condBranch(mVU, mFC, Jcc_LessOrEqual); goto perf_and_return; // IBLEQ + case 7: condBranch(mVU, mFC, Jcc_Less); goto perf_and_return; // IBLTZ + case 8: condBranch(mVU, mFC, Jcc_NotEqual); goto perf_and_return; // IBNEQ } - + } } if ((x == endCount) && (x!=1)) { Console.Error("microVU%d: Possible infinite compiling loop!", mVU.index); } @@ -658,6 +658,8 @@ void* mVUcompile(microVU& mVU, u32 startPC, uptr pState) { mVUsetupRange(mVU, xPC-8, false); mVUendProgram(mVU, &mFC, 1); +perf_and_return: + Perf::vu.map((uptr)thisPtr, x86Ptr - thisPtr, startPC); return thisPtr;