Don't flush the icache from the start, also don't sleep. May help JIT slowdowns.

This commit is contained in:
Henrik Rydgard 2013-01-15 20:42:45 +01:00
parent 72333821bf
commit e34288070c
3 changed files with 27 additions and 10 deletions

View File

@ -157,15 +157,21 @@ const u8 *ARMXEmitter::AlignCodePage()
void ARMXEmitter::FlushIcache()
{
#ifdef __SYMBIAN32__
User::IMB_Range( startcode, code );
#elif defined(BLACKBERRY)
msync(startcode, code-startcode, MS_SYNC | MS_INVALIDATE_ICACHE);
#else
__builtin___clear_cache (startcode, code);
#endif
SLEEP(0);
FlushIcacheSection(lastCacheFlushEnd, code);
lastCacheFlushEnd = code;
}
void ARMXEmitter::FlushIcacheSection(u8 *start, u8 *end)
{
#ifdef __SYMBIAN32__
User::IMB_Range( start, end);
#elif defined(BLACKBERRY)
msync(start, end - start, MS_SYNC | MS_INVALIDATE_ICACHE);
#else
__builtin___clear_cache (start, end);
#endif
}
void ARMXEmitter::SetCC(CCFlags cond)
{
condition = cond << 28;

View File

@ -331,6 +331,7 @@ class ARMXEmitter
friend struct OpArg; // for Write8 etc
private:
u8 *code, *startcode;
u8 *lastCacheFlushEnd;
u32 condition;
void WriteStoreOp(u32 op, ARMReg dest, ARMReg src, Operand2 op2);
@ -346,8 +347,15 @@ protected:
inline void Write32(u32 value) {*(u32*)code = value; code+=4;}
public:
ARMXEmitter() { code = NULL; startcode = NULL; condition = CC_AL << 28;}
ARMXEmitter(u8 *code_ptr) { code = code_ptr; startcode = code_ptr; condition = CC_AL << 28;}
ARMXEmitter() : code(0), startcode(0), lastCacheFlushEnd(0) {
condition = CC_AL << 28;
}
ARMXEmitter(u8 *code_ptr) {
code = code_ptr;
lastCacheFlushEnd = code_ptr;
startcode = code_ptr;
condition = CC_AL << 28;
}
virtual ~ARMXEmitter() {}
void SetCodePtr(u8 *ptr);
@ -356,6 +364,7 @@ public:
const u8 *AlignCodePage();
const u8 *GetCodePtr() const;
void FlushIcache();
void FlushIcacheSection(u8 *start, u8 *end);
u8 *GetWritableCodePtr();
void SetCC(CCFlags cond = CC_AL);

View File

@ -286,6 +286,7 @@ void ArmJitBlockCache::LinkBlockExits(int i)
{
ARMXEmitter emit(b.exitPtrs[e]);
emit.B(blocks[destinationBlock].checkedEntry);
emit.FlushIcache();
b.linkStatus[e] = true;
}
}
@ -358,6 +359,7 @@ void ArmJitBlockCache::DestroyBlock(int block_num, bool invalidate)
emit.ARMABI_MOVI2R(R0, b.originalAddress);
emit.STR(R10, R0, offsetof(MIPSState, pc));
emit.B(MIPSComp::jit->dispatcher);
emit.FlushIcache();
}
void ArmJitBlockCache::InvalidateICache(u32 address, const u32 length)