[Project64] Record function end location

This commit is contained in:
zilmar 2017-01-10 18:01:59 +11:00
parent 5febae4ec9
commit ec380bfe0d
6 changed files with 9 additions and 3 deletions

View File

@ -1571,7 +1571,7 @@ const char * CArmOps::ArmRegName(ArmReg Reg)
case Arm_R9: return "r9";
case Arm_R10: return "r10";
case Arm_R11: return "r11";
case Arm_R12: return "ip";
case Arm_R12: return "r12";
case ArmRegSP: return "sp";
case ArmRegLR: return "lr";
case ArmRegPC: return "pc";

View File

@ -769,13 +769,14 @@ bool CCodeBlock::Compile()
}
}
m_RecompilerOps->CompileExitCode();
m_CompiledLocationEnd = *g_RecompPos;
uint32_t PAddr;
g_TransVaddr->TranslateVaddr(VAddrFirst(), PAddr);
MD5(g_MMU->Rdram() + PAddr, (VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash);
#if defined(ANDROID) && (defined(__arm__) || defined(_M_ARM))
__clear_cache_android((uint8_t *)((uint32_t)m_CompiledLocation & ~1), (uint8_t *)(*g_RecompPos));
__clear_cache_android((uint8_t *)((uint32_t)m_CompiledLocation & ~1), m_CompiledLocationEnd);
#endif
return true;
}

View File

@ -25,6 +25,7 @@ public:
uint32_t VAddrFirst() const { return m_VAddrFirst; }
uint32_t VAddrLast() const { return m_VAddrLast; }
uint8_t * CompiledLocation() const { return m_CompiledLocation; }
uint8_t * CompiledLocationEnd() const { return m_CompiledLocationEnd; }
int32_t NoOfSections() const { return (int32_t)m_Sections.size() - 1; }
const CCodeSection & EnterSection() const { return *m_EnterSection; }
const MD5Digest & Hash() const { return m_Hash; }
@ -58,6 +59,7 @@ private:
uint32_t m_VAddrFirst; // the address of the first opcode in the block
uint32_t m_VAddrLast; // the address of the first opcode in the block
uint8_t* m_CompiledLocation; // What address is this compiled at
uint8_t* m_CompiledLocationEnd; // What address is this compiled at
typedef std::map<uint32_t, CCodeSection *> SectionMap;
typedef std::list<CCodeSection *> SectionList;

View File

@ -17,6 +17,7 @@ CCompiledFunc::CCompiledFunc( const CCodeBlock & CodeBlock ) :
m_MaxPC(CodeBlock.VAddrLast()),
m_Hash(CodeBlock.Hash()),
m_Function((Func)CodeBlock.CompiledLocation()),
m_FunctionEnd(CodeBlock.CompiledLocationEnd()),
m_Next(NULL)
{
m_MemContents[0] = CodeBlock.MemContents(0);

View File

@ -23,6 +23,7 @@ public:
const uint32_t MinPC () const { return m_MinPC; }
const uint32_t MaxPC () const { return m_MaxPC; }
const Func Function () const { return m_Function; }
const uint8_t *FunctionEnd() const { return m_FunctionEnd; }
const MD5Digest& Hash () const { return m_Hash; }
CCompiledFunc* Next () const { return m_Next; }
@ -40,6 +41,7 @@ private:
uint32_t m_EnterPC; // The Entry PC
uint32_t m_MinPC; // The Lowest PC in the function
uint32_t m_MaxPC; // The Highest PC in the function
uint8_t * m_FunctionEnd; // Where the code bytes end
MD5Digest m_Hash;
//From querying the recompiler get information about the function

View File

@ -1006,7 +1006,7 @@ CCompiledFunc * CRecompiler::CompileCode()
WriteTrace(TraceRecompiler, TraceDebug, "info->Function() = %X", Func->Function());
std::string dumpline;
uint32_t start_address = (uint32_t)(Func->Function()) & ~1;
for (uint8_t * ptr = (uint8_t *)start_address; ptr < (uint8_t *)*g_RecompPos; ptr++)
for (uint8_t * ptr = (uint8_t *)start_address; ptr < CodeBlock.CompiledLocationEnd(); ptr++)
{
if (dumpline.empty())
{