diff --git a/Core/MIPS/IR/IRNativeCommon.cpp b/Core/MIPS/IR/IRNativeCommon.cpp index 6ce1e0f0d6..638265ad66 100644 --- a/Core/MIPS/IR/IRNativeCommon.cpp +++ b/Core/MIPS/IR/IRNativeCommon.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include "Common/Profiler/Profiler.h" #include "Common/StringUtils.h" #include "Common/TimeUtil.h" @@ -443,13 +444,27 @@ bool IRNativeJit::DescribeCodePtr(const u8 *ptr, std::string &name) { return false; int block_num = -1; + int block_offset = INT_MAX; for (int i = 0; i < blocks_.GetNumBlocks(); ++i) { const auto &b = blocks_.GetBlock(i); - // We allocate linearly. - if (b->GetTargetOffset() <= offset) + int b_start = b->GetTargetOffset(); + if (b_start > offset) + continue; + + int b_end = backend_->GetNativeBlock(i)->checkedOffset; + int b_offset = offset - b_start; + if (b_end > b_start && b_end >= offset) { + // For sure within the block. block_num = i; - if (b->GetTargetOffset() > offset) + block_offset = b_offset; break; + } + + if (b_offset < block_offset) { + // Possibly within the block, unless in some other block... + block_num = i; + block_offset = b_offset; + } } // Used by profiling tools that don't like spaces. @@ -466,9 +481,9 @@ bool IRNativeJit::DescribeCodePtr(const u8 *ptr, std::string &name) { // It helps to know which func this block is inside. const std::string label = g_symbolMap ? g_symbolMap->GetDescription(start) : ""; if (!label.empty()) - name = StringFromFormat("block%d_%08x_%s", block_num, start, label.c_str()); + name = StringFromFormat("block%d_%08x_%s_0x%x", block_num, start, label.c_str(), block_offset); else - name = StringFromFormat("block%d_%08x", block_num, start); + name = StringFromFormat("block%d_%08x_0x%x", block_num, start, block_offset); return true; } return false; diff --git a/Core/MIPS/x86/X64IRJit.cpp b/Core/MIPS/x86/X64IRJit.cpp index f70901eba8..b864343555 100644 --- a/Core/MIPS/x86/X64IRJit.cpp +++ b/Core/MIPS/x86/X64IRJit.cpp @@ -19,6 +19,7 @@ #if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64) #include +#include "Common/StringUtils.h" #include "Core/MemMap.h" #include "Core/MIPS/MIPSTables.h" #include "Core/MIPS/x86/X64IRJit.h" @@ -265,7 +266,31 @@ bool X64JitBackend::DescribeCodePtr(const u8 *ptr, std::string &name) const { } else if (ptr == applyRoundingMode_) { name = "applyRoundingMode"; } else if (ptr >= GetBasePtr() && ptr < GetBasePtr() + jitStartOffset_) { - name = "fixedCode"; + if (ptr == constants.noSignMask) { + name = "constants.noSignMask"; + } else if (ptr == constants.signBitAll) { + name = "constants.signBitAll"; + } else if (ptr == constants.positiveZeroes) { + name = "constants.positiveZeroes"; + } else if (ptr == constants.positiveInfinity) { + name = "constants.positiveInfinity"; + } else if (ptr == constants.positiveOnes) { + name = "constants.positiveOnes"; + } else if (ptr == constants.negativeOnes) { + name = "constants.negativeOnes"; + } else if (ptr == constants.qNAN) { + name = "constants.qNAN"; + } else if (ptr == constants.maxIntBelowAsFloat) { + name = "constants.maxIntBelowAsFloat"; + } else if ((const float *)ptr >= constants.mulTableVi2f && (const float *)ptr < constants.mulTableVi2f + 32) { + name = StringFromFormat("constants.mulTableVi2f[%d]", (int)((const float *)ptr - constants.mulTableVi2f)); + } else if ((const float *)ptr >= constants.mulTableVf2i && (const float *)ptr < constants.mulTableVf2i + 32) { + name = StringFromFormat("constants.mulTableVf2i[%d]", (int)((const float *)ptr - constants.mulTableVf2i)); + } else if ((const Float4Constant *)ptr >= constants.vec4InitValues && (const Float4Constant *)ptr < constants.vec4InitValues + 8) { + name = StringFromFormat("constants.vec4InitValues[%d]", (int)((const Float4Constant *)ptr - constants.vec4InitValues)); + } else { + name = "fixedCode"; + } } else { return IRNativeBackend::DescribeCodePtr(ptr, name); }