diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index f0ac586be2..6c316a2fa4 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -15,6 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include +#include #include "../../Core.h" #include "../../CoreTiming.h" #include "../MIPS.h" @@ -45,6 +47,15 @@ static u64 saved_flags; #endif +const bool USE_JIT_MISSMAP = false; +static std::map notJitOps; + +template +std::pair flip_pair(const std::pair &p) +{ + return std::pair(p.second, p.first); +} + void JitBreakpoint() { Core_EnableStepping(true); @@ -52,6 +63,36 @@ void JitBreakpoint() if (CBreakPoints::IsTempBreakPoint(currentMIPS->pc)) CBreakPoints::RemoveBreakPoint(currentMIPS->pc); + + // There's probably a better place for this. + if (USE_JIT_MISSMAP) + { + std::map notJitSorted; + std::transform(notJitOps.begin(), notJitOps.end(), std::inserter(notJitSorted, notJitSorted.begin()), flip_pair); + + std::string message; + char temp[256]; + int remaining = 15; + for (auto it = notJitSorted.rbegin(), end = notJitSorted.rend(); it != end && --remaining >= 0; ++it) + { + snprintf(temp, 256, " (%d), ", it->first); + message += it->second + temp; + } + + if (message.size() > 2) + message.resize(message.size() - 2); + + NOTICE_LOG(JIT, "Top ops compiled to interpreter: %s", message.c_str()); + } +} + +static void JitLogMiss(u32 op) +{ + if (USE_JIT_MISSMAP) + notJitOps[MIPSGetName(op)]++; + + MIPSInterpretFunc func = MIPSGetInterpretFunc(op); + func(op); } Jit::Jit(MIPSState *mips) : blocks(mips), mips_(mips) @@ -183,8 +224,13 @@ void Jit::Comp_Generic(u32 op) if (func) { MOV(32, M(&mips_->pc), Imm32(js.compilerPC)); - ABI_CallFunctionC((void *)func, op); + if (USE_JIT_MISSMAP) + ABI_CallFunctionC((void *)&JitLogMiss, op); + else + ABI_CallFunctionC((void *)func, op); } + else + _dbg_assert_msg_(JIT, 0, "Trying to compile instruction that can't be interpreted"); } void Jit::WriteExit(u32 destination, int exit_num)