Clear jit cache when changing breakpoints.

For now, only when paused.  I don't think clearing the cache while
running is an awesome idea.
This commit is contained in:
Unknown W. Brackets committed 2013-01-18 20:12:53 -08:00
1 parent a9293c8923
commit beac991a9e
8 files changed
+38 -3

No files matched your search

+18
View File
@@ -19,6 +19,7 @@
#include "Breakpoints.h"
#include "SymbolMap.h"
#include "FixedSizeUnorderedSet.h"
#include "../MIPS/JitCommon/JitCommon.h"
#include <cstdio>
#define MAX_BREAKPOINTS 16
@@ -73,6 +74,7 @@ void CBreakPoints::RemoveBreakPoint(u32 _iAddress)
if (m_iBreakPoints[i].iAddress == _iAddress)
{
m_iBreakPoints.remove(m_iBreakPoints[i]);
InvalidateJit(_iAddress);
break;
}
}
@@ -81,6 +83,7 @@ void CBreakPoints::RemoveBreakPoint(u32 _iAddress)
void CBreakPoints::ClearAllBreakPoints()
{
m_iBreakPoints.clear();
InvalidateJit();
}
MemCheck *CBreakPoints::GetMemCheck(u32 address)
@@ -123,5 +126,20 @@ void CBreakPoints::AddBreakPoint(u32 _iAddress, bool temp)
pt.iAddress = _iAddress;
m_iBreakPoints.insert(pt);
InvalidateJit(_iAddress);
}
}
void CBreakPoints::InvalidateJit(u32 _iAddress)
{
// Don't want to clear cache while running, I think?
if (MIPSComp::jit && coreState == CORE_STEPPING)
MIPSComp::jit->ClearCacheAt(_iAddress);
}
void CBreakPoints::InvalidateJit()
{
// Don't want to clear cache while running, I think?
if (MIPSComp::jit && coreState == CORE_STEPPING)
MIPSComp::jit->ClearCache();
}
+3
View File
@@ -80,6 +80,9 @@ public:
static void RemoveBreakPoint(u32 _iAddress);
static void ClearAllBreakPoints();
static void InvalidateJit(u32 _iAddress);
static void InvalidateJit();
};
+6
View File
@@ -76,6 +76,12 @@ void Jit::ClearCache()
GenerateFixedCode();
}
void Jit::ClearCacheAt(u32 em_address)
{
// TODO: Properly.
ClearCache();
}
void Jit::CompileAt(u32 addr)
{
u32 op = Memory::Read_Instruction(addr);
+1
View File
@@ -89,6 +89,7 @@ public:
ArmJitBlockCache *GetBlockCache() { return &blocks; }
void ClearCache();
void ClearCacheAt(u32 em_address);
private:
void GenerateFixedCode();
+6
View File
@@ -61,6 +61,12 @@ void Jit::ClearCache()
ClearCodeSpace();
}
void Jit::ClearCacheAt(u32 em_address)
{
// TODO: Properly.
ClearCache();
}
void Jit::CompileAt(u32 addr)
{
u32 op = Memory::Read_Instruction(addr);
+1
View File
@@ -95,6 +95,7 @@ public:
AsmRoutineManager &Asm() { return asm_; }
void ClearCache();
void ClearCacheAt(u32 em_address);
private:
void FlushAll();
+1 -1
View File
@@ -62,7 +62,7 @@ using namespace Gen;
bool JitBlock::ContainsAddress(u32 em_address)
{
// WARNING - THIS DOES NOT WORK WITH INLINING ENABLED.
// WARNING - THIS DOES NOT WORK WITH JIT INLINING ENABLED.
return (em_address >= originalAddress && em_address < originalAddress + 4 * originalSize);
}
+2 -2
View File
@@ -118,7 +118,7 @@ public:
int GetBlockNumberFromStartAddress(u32 em_address);
// slower, but can get numbers from within blocks, not just the first instruction.
// WARNING! WILL NOT WORK WITH INLINING ENABLED (not yet a feature but will be soon)
// WARNING! WILL NOT WORK WITH JIT INLINING ENABLED (not yet a feature but will be soon)
// Returns a list of block numbers - only one block can start at a particular address, but they CAN overlap.
// This one is slow so should only be used for one-shots from the debugger UI, not for anything during runtime.
void GetBlockNumbersFromAddress(u32 em_address, std::vector<int> *block_numbers);
@@ -126,7 +126,7 @@ public:
u32 GetOriginalFirstOp(int block_num);
CompiledCode GetCompiledCodeFromBlock(int block_num);
// DOES NOT WORK CORRECTLY WITH INLINING
// DOES NOT WORK CORRECTLY WITH JIT INLINING
void InvalidateICache(u32 address, const u32 length);
void DestroyBlock(int block_num, bool invalidate);