mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-21 01:40:22 +00:00
Debugger enhancements:
* Added JIT breakpoints functionality * Added a menu option to disable the JIT block cache * Enabled single stepping in JIT mode as a run-time option (automatically enabled when the debugger is used) * Enabled the missing JIT Off menu options * Removed the JIT Unlimited Cache hack git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5833 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
8e4ef9b9e5
commit
f158ca82af
15 changed files with 139 additions and 200 deletions
|
@ -31,7 +31,7 @@
|
|||
|
||||
SCoreStartupParameter::SCoreStartupParameter()
|
||||
: hInstance(0), hMainWindow(0),
|
||||
bJITUnlimitedCache(false), bJITBlockLinking(false),
|
||||
bJITNoBlockCache(false), bJITBlockLinking(false),
|
||||
bJITOff(false),
|
||||
bJITLoadStoreOff(false), bJITLoadStorelXzOff(false),
|
||||
bJITLoadStorelwzOff(false), bJITLoadStorelbzxOff(false),
|
||||
|
|
|
@ -50,7 +50,7 @@ struct SCoreStartupParameter
|
|||
int iCPUCore;
|
||||
|
||||
// JIT (shared between JIT and JITIL)
|
||||
bool bJITUnlimitedCache, bJITBlockLinking;
|
||||
bool bJITNoBlockCache, bJITBlockLinking;
|
||||
bool bJITOff;
|
||||
bool bJITLoadStoreOff, bJITLoadStorelXzOff, bJITLoadStorelwzOff, bJITLoadStorelbzxOff;
|
||||
bool bJITLoadStoreFloatingOff;
|
||||
|
|
|
@ -79,7 +79,7 @@ using namespace PowerPC;
|
|||
// Other considerations
|
||||
//
|
||||
// Many instructions have shorter forms for EAX. However, I believe their performance boost
|
||||
// will be as small to be negligble, so I haven't dirtied up the code with that. AMD recommends it in their
|
||||
// will be as small to be negligible, so I haven't dirtied up the code with that. AMD recommends it in their
|
||||
// optimization manuals, though.
|
||||
//
|
||||
// We support block linking. Reserve space at the exits of every block for a full 5-byte jmp. Save 16-bit offsets
|
||||
|
@ -97,7 +97,7 @@ using namespace PowerPC;
|
|||
|
||||
// TODO: SERIOUS synchronization problem with the video plugin setting tokens and breakpoints in dual core mode!!!
|
||||
// Somewhat fixed by disabling idle skipping when certain interrupts are enabled
|
||||
// This is no permantent reliable fix
|
||||
// This is no permanent reliable fix
|
||||
// TODO: Zeldas go whacko when you hang the gfx thread
|
||||
|
||||
// Idea - Accurate exception handling
|
||||
|
@ -175,12 +175,15 @@ void Jit64::Init()
|
|||
where this cause problems, so I'm enabling this by default, since I seem to get perhaps as much as 20% more
|
||||
fps with this option enabled. If you suspect that this option cause problems you can also disable it from the
|
||||
debugging window. */
|
||||
#ifdef JIT_SINGLESTEP
|
||||
jo.enableBlocklink = false;
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = false;
|
||||
#else
|
||||
jo.enableBlocklink = true;
|
||||
#endif
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging)
|
||||
{
|
||||
jo.enableBlocklink = false;
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
jo.enableBlocklink = true;
|
||||
}
|
||||
#ifdef _M_X64
|
||||
jo.enableFastMem = SConfig::GetInstance().m_LocalCoreStartupParameter.bUseFastMem;
|
||||
#else
|
||||
|
@ -195,11 +198,11 @@ void Jit64::Init()
|
|||
gpr.SetEmitter(this);
|
||||
fpr.SetEmitter(this);
|
||||
|
||||
// Custom settings
|
||||
if (Core::g_CoreStartupParameter.bJITUnlimitedCache)
|
||||
CODE_SIZE = 1024*1024*8*8;
|
||||
if (Core::g_CoreStartupParameter.bJITBlockLinking)
|
||||
{ jo.enableBlocklink = false; SuccessAlert("Your game was started without JIT Block Linking"); }
|
||||
{
|
||||
jo.enableBlocklink = false;
|
||||
SuccessAlert("Your game was started without JIT Block Linking");
|
||||
}
|
||||
|
||||
trampolines.Init();
|
||||
AllocCodeSpace(CODE_SIZE);
|
||||
|
@ -228,8 +231,6 @@ void Jit64::Shutdown()
|
|||
// This is only called by Default() in this file. It will execute an instruction with the interpreter functions.
|
||||
void Jit64::WriteCallInterpreter(UGeckoInstruction inst)
|
||||
{
|
||||
|
||||
|
||||
gpr.Flush(FLUSH_ALL);
|
||||
fpr.Flush(FLUSH_ALL);
|
||||
if (js.isLastInstruction)
|
||||
|
@ -298,7 +299,6 @@ static void ImHere()
|
|||
return;
|
||||
}
|
||||
DEBUG_LOG(DYNA_REC, "I'm here - PC = %08x , LR = %08x", PC, LR);
|
||||
//printf("I'm here - PC = %08x , LR = %08x", PC, LR);
|
||||
been_here[PC] = 1;
|
||||
}
|
||||
|
||||
|
@ -366,16 +366,8 @@ void STACKALIGN Jit64::Run()
|
|||
|
||||
void Jit64::SingleStep()
|
||||
{
|
||||
#ifndef JIT_NO_CACHE
|
||||
CoreTiming::SetMaximumSlice(1);
|
||||
#endif
|
||||
|
||||
CompiledCode pExecAddr = (CompiledCode)asm_routines.enterCode;
|
||||
pExecAddr();
|
||||
|
||||
#ifndef JIT_NO_CACHE
|
||||
CoreTiming::ResetSliceLength();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Jit64::Trace(PPCAnalyst::CodeBuffer *code_buf, u32 em_address)
|
||||
|
@ -404,31 +396,15 @@ void Jit64::Trace(PPCAnalyst::CodeBuffer *code_buf, u32 em_address)
|
|||
char ppcInst[256];
|
||||
DisassembleGekko(op.inst.hex, em_address, ppcInst, 256);
|
||||
|
||||
NOTICE_LOG(DYNA_REC, "JIT64 PC: %08x Cycles: %04d CR: %08x CRfast: %02x%02x%02x%02x%02x%02x%02x%02x FPSCR: %08x MSR: %08x LR: %08x %s %s %s", em_address, js.st.numCycles, PowerPC::ppcState.cr, PowerPC::ppcState.cr_fast[0], PowerPC::ppcState.cr_fast[1], PowerPC::ppcState.cr_fast[2], PowerPC::ppcState.cr_fast[3], PowerPC::ppcState.cr_fast[4], PowerPC::ppcState.cr_fast[5], PowerPC::ppcState.cr_fast[6], PowerPC::ppcState.cr_fast[7], PowerPC::ppcState.fpscr, PowerPC::ppcState.msr, PowerPC::ppcState.spr[8], regs, fregs, ppcInst);
|
||||
NOTICE_LOG(DYNA_REC, "JIT64 PC: %08x SRR0: %08x SRR1: %08x CRfast: %02x%02x%02x%02x%02x%02x%02x%02x FPSCR: %08x MSR: %08x LR: %08x %s %s %08x %s", PC, SRR0, SRR1, PowerPC::ppcState.cr_fast[0], PowerPC::ppcState.cr_fast[1], PowerPC::ppcState.cr_fast[2], PowerPC::ppcState.cr_fast[3], PowerPC::ppcState.cr_fast[4], PowerPC::ppcState.cr_fast[5], PowerPC::ppcState.cr_fast[6], PowerPC::ppcState.cr_fast[7], PowerPC::ppcState.fpscr, PowerPC::ppcState.msr, PowerPC::ppcState.spr[8], regs, fregs, op.inst.hex, ppcInst);
|
||||
}
|
||||
|
||||
void STACKALIGN Jit64::Jit(u32 em_address)
|
||||
{
|
||||
if (GetSpaceLeft() < 0x10000 || blocks.IsFull())
|
||||
if (GetSpaceLeft() < 0x10000 || blocks.IsFull() || Core::g_CoreStartupParameter.bJITNoBlockCache)
|
||||
{
|
||||
WARN_LOG(DYNA_REC, "JIT cache full - clearing.")
|
||||
if (Core::g_CoreStartupParameter.bJITUnlimitedCache)
|
||||
{
|
||||
ERROR_LOG(DYNA_REC, "What? JIT cache still full - clearing.");
|
||||
PanicAlert("What? JIT cache still full - clearing.");
|
||||
}
|
||||
ClearCache();
|
||||
}
|
||||
#ifdef JIT_NO_CACHE
|
||||
ClearCache();
|
||||
if (PowerPC::breakpoints.IsAddressBreakPoint(em_address))
|
||||
{
|
||||
PowerPC::Pause();
|
||||
if (PowerPC::breakpoints.IsTempBreakPoint(em_address))
|
||||
PowerPC::breakpoints.Remove(em_address);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
int block_num = blocks.AllocateBlock(em_address);
|
||||
JitBlock *b = blocks.GetBlock(block_num);
|
||||
blocks.FinalizeBlock(block_num, jo.enableBlocklink, DoJit(em_address, &code_buffer, b));
|
||||
|
@ -439,15 +415,17 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
{
|
||||
int blockSize = code_buf->GetSize();
|
||||
|
||||
#ifdef JIT_SINGLESTEP
|
||||
blockSize = 1;
|
||||
Trace(code_buf, em_address);
|
||||
#endif
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging)
|
||||
{
|
||||
// Comment out the following to disable breakpoints (speed-up)
|
||||
blockSize = 1;
|
||||
Trace(code_buf, em_address);
|
||||
}
|
||||
|
||||
if (em_address == 0)
|
||||
PanicAlert("ERROR : Trying to compile at 0. LR=%08x", LR);
|
||||
|
||||
int size;
|
||||
int size = 0;
|
||||
js.isLastInstruction = false;
|
||||
js.blockStart = em_address;
|
||||
js.fifoBytesThisBlock = 0;
|
||||
|
@ -458,9 +436,6 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
//Analyze the block, collect all instructions it is made of (including inlining,
|
||||
//if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
|
||||
u32 nextPC = PPCAnalyst::Flatten(em_address, &size, &js.st, &js.gpa, &js.fpa, code_buf, blockSize);
|
||||
#ifndef JIT_SINGLESTEP
|
||||
(void)nextPC;
|
||||
#endif
|
||||
|
||||
PPCAnalyst::CodeOp *ops = code_buf->codebuffer;
|
||||
|
||||
|
@ -511,10 +486,10 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
//TODO
|
||||
#endif
|
||||
// get start tic
|
||||
PROFILER_QUERY_PERFORMACE_COUNTER(&b->ticStart);
|
||||
PROFILER_QUERY_PERFORMANCE_COUNTER(&b->ticStart);
|
||||
}
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST) || defined(NAN_CHECK)
|
||||
// should help logged stacktraces become more accurate
|
||||
// should help logged stack-traces become more accurate
|
||||
MOV(32, M(&PC), Imm32(js.blockStart));
|
||||
#endif
|
||||
|
||||
|
@ -523,19 +498,14 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
gpr.Start(js.gpa);
|
||||
fpr.Start(js.fpa);
|
||||
|
||||
#ifdef JIT_SINGLESTEP
|
||||
js.downcountAmount = js.st.numCycles;
|
||||
#else
|
||||
js.downcountAmount = js.st.numCycles + PatchEngine::GetSpeedhackCycles(em_address);
|
||||
#endif
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging)
|
||||
js.downcountAmount = js.st.numCycles + PatchEngine::GetSpeedhackCycles(em_address);
|
||||
|
||||
js.blockSize = size;
|
||||
// Translate instructions
|
||||
for (int i = 0; i < (int)size; i++)
|
||||
{
|
||||
// gpr.Flush(FLUSH_ALL);
|
||||
// if (PPCTables::UsesFPU(_inst))
|
||||
// fpr.Flush(FLUSH_ALL);
|
||||
js.compilerPC = ops[i].address;
|
||||
js.op = &ops[i];
|
||||
js.instructionNumber = i;
|
||||
|
@ -548,7 +518,7 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
// CAUTION!!! push on stack regs you use, do your stuff, then pop
|
||||
PROFILER_VPUSH;
|
||||
// get end tic
|
||||
PROFILER_QUERY_PERFORMACE_COUNTER(&b->ticStop);
|
||||
PROFILER_QUERY_PERFORMANCE_COUNTER(&b->ticStop);
|
||||
// tic counter += (end tic - start tic)
|
||||
PROFILER_ADD_DIFF_LARGE_INTEGER(&b->ticCounter, &b->ticStop, &b->ticStart);
|
||||
PROFILER_VPOP;
|
||||
|
@ -582,12 +552,12 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
if (js.cancel)
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef JIT_SINGLESTEP
|
||||
gpr.Flush(FLUSH_ALL);
|
||||
fpr.Flush(FLUSH_ALL);
|
||||
WriteExit(nextPC, 0);
|
||||
#endif
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging)
|
||||
{
|
||||
gpr.Flush(FLUSH_ALL);
|
||||
fpr.Flush(FLUSH_ALL);
|
||||
WriteExit(nextPC, 0);
|
||||
}
|
||||
|
||||
b->flags = js.block_flags;
|
||||
b->codeSize = (u32)(GetCodePtr() - normalEntry);
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
|
||||
// Settings
|
||||
// ----------
|
||||
#define JIT_OFF_OPTIONS // Compile with JIT off options
|
||||
|
||||
#ifndef _JIT64_H
|
||||
#define _JIT64_H
|
||||
|
||||
|
|
|
@ -78,6 +78,17 @@ void Jit64AsmRoutineManager::Generate()
|
|||
// The result of slice decrementation should be in flags if somebody jumped here
|
||||
// IMPORTANT - We jump on negative, not carry!!!
|
||||
FixupBranch bail = J_CC(CC_BE);
|
||||
|
||||
if (Core::g_CoreStartupParameter.bEnableDebugging)
|
||||
{
|
||||
ABI_CallFunction(reinterpret_cast<void *>(&PowerPC::CheckBreakPoints));
|
||||
TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF));
|
||||
FixupBranch noBreakpoint = J_CC(CC_Z);
|
||||
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
||||
RET();
|
||||
SetJumpTarget(noBreakpoint);
|
||||
}
|
||||
|
||||
SetJumpTarget(skipToRealDispatch);
|
||||
|
||||
dispatcherNoCheck = GetCodePtr();
|
||||
|
@ -114,11 +125,6 @@ void Jit64AsmRoutineManager::Generate()
|
|||
MOV(32, R(ABI_PARAM1), M(&PowerPC::ppcState.pc));
|
||||
CALL((void *)&Jit);
|
||||
#endif
|
||||
#ifdef JIT_NO_CACHE
|
||||
TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF));
|
||||
FixupBranch notRunning = J_CC(CC_NZ);
|
||||
#endif
|
||||
|
||||
JMP(dispatcherNoCheck); // no point in special casing this
|
||||
|
||||
//FP blocks test for FPU available, jump here if false
|
||||
|
@ -131,9 +137,6 @@ void Jit64AsmRoutineManager::Generate()
|
|||
MOV(32, M(&PC), R(EAX));
|
||||
JMP(dispatcher);
|
||||
|
||||
#ifdef JIT_NO_CACHE
|
||||
SetJumpTarget(notRunning);
|
||||
#endif
|
||||
SetJumpTarget(bail);
|
||||
doTiming = GetCodePtr();
|
||||
|
||||
|
@ -195,8 +198,8 @@ void Jit64AsmRoutineManager::Generate()
|
|||
MOV(32, R(EAX), MComplex(RSI, EAX, SCALE_1, 0));
|
||||
#endif
|
||||
|
||||
SetJumpTarget(getinst);
|
||||
SetJumpTarget(getinst2);
|
||||
SetJumpTarget(getinst);
|
||||
#else
|
||||
#ifdef _M_IX86
|
||||
AND(32, R(EAX), Imm32(Memory::MEMVIEW32_MASK));
|
||||
|
|
|
@ -73,7 +73,7 @@ using namespace PowerPC;
|
|||
// Other considerations
|
||||
//
|
||||
// Many instructions have shorter forms for EAX. However, I believe their performance boost
|
||||
// will be as small to be negligble, so I haven't dirtied up the code with that. AMD recommends it in their
|
||||
// will be as small to be negligible, so I haven't dirtied up the code with that. AMD recommends it in their
|
||||
// optimization manuals, though.
|
||||
//
|
||||
// We support block linking. Reserve space at the exits of every block for a full 5-byte jmp. Save 16-bit offsets
|
||||
|
@ -91,7 +91,7 @@ using namespace PowerPC;
|
|||
|
||||
// TODO: SERIOUS synchronization problem with the video plugin setting tokens and breakpoints in dual core mode!!!
|
||||
// Somewhat fixed by disabling idle skipping when certain interrupts are enabled
|
||||
// This is no permantent reliable fix
|
||||
// This is no permanent reliable fix
|
||||
// TODO: Zeldas go whacko when you hang the gfx thread
|
||||
|
||||
// Idea - Accurate exception handling
|
||||
|
@ -163,16 +163,18 @@ namespace CPUCompare
|
|||
|
||||
void JitIL::Init()
|
||||
{
|
||||
if (Core::g_CoreStartupParameter.bJITUnlimitedCache)
|
||||
CODE_SIZE = 1024*1024*8*8;
|
||||
|
||||
jo.optimizeStack = true;
|
||||
#ifdef JIT_SINGLESTEP
|
||||
jo.enableBlocklink = false;
|
||||
Core::g_CoreStartupParameter.bSkipIdle = false;
|
||||
#else
|
||||
jo.enableBlocklink = true; // Speed boost, but not 100% safe
|
||||
#endif
|
||||
|
||||
if (Core::g_CoreStartupParameter.bEnableDebugging)
|
||||
{
|
||||
jo.enableBlocklink = false;
|
||||
Core::g_CoreStartupParameter.bSkipIdle = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
jo.enableBlocklink = true; // Speed boost, but not 100% safe
|
||||
}
|
||||
|
||||
#ifdef _M_X64
|
||||
jo.enableFastMem = false;
|
||||
#else
|
||||
|
@ -351,16 +353,8 @@ void STACKALIGN JitIL::Run()
|
|||
|
||||
void JitIL::SingleStep()
|
||||
{
|
||||
#ifndef JIT_NO_CACHE
|
||||
CoreTiming::SetMaximumSlice(1);
|
||||
#endif
|
||||
|
||||
CompiledCode pExecAddr = (CompiledCode)asm_routines.enterCode;
|
||||
pExecAddr();
|
||||
|
||||
#ifndef JIT_NO_CACHE
|
||||
CoreTiming::ResetSliceLength();
|
||||
#endif
|
||||
}
|
||||
|
||||
void JitIL::Trace(PPCAnalyst::CodeBuffer *code_buf, u32 em_address)
|
||||
|
@ -388,32 +382,16 @@ void JitIL::Trace(PPCAnalyst::CodeBuffer *code_buf, u32 em_address)
|
|||
const PPCAnalyst::CodeOp &op = code_buf->codebuffer[0];
|
||||
char ppcInst[256];
|
||||
DisassembleGekko(op.inst.hex, em_address, ppcInst, 256);
|
||||
|
||||
NOTICE_LOG(DYNA_REC, "JITIL PC: %08x Cycles: %04d CR: %08x CRfast: %02x%02x%02x%02x%02x%02x%02x%02x FPSCR: %08x MSR: %08x LR: %08x %s %s %s", em_address, js.st.numCycles, PowerPC::ppcState.cr, PowerPC::ppcState.cr_fast[0], PowerPC::ppcState.cr_fast[1], PowerPC::ppcState.cr_fast[2], PowerPC::ppcState.cr_fast[3], PowerPC::ppcState.cr_fast[4], PowerPC::ppcState.cr_fast[5], PowerPC::ppcState.cr_fast[6], PowerPC::ppcState.cr_fast[7], PowerPC::ppcState.fpscr, PowerPC::ppcState.msr, PowerPC::ppcState.spr[8], regs, fregs, ppcInst);
|
||||
|
||||
NOTICE_LOG(DYNA_REC, "JITIL PC: %08x SRR0: %08x SRR1: %08x CRfast: %02x%02x%02x%02x%02x%02x%02x%02x FPSCR: %08x MSR: %08x LR: %08x %s %s %08x %s", PC, SRR0, SRR1, PowerPC::ppcState.cr_fast[0], PowerPC::ppcState.cr_fast[1], PowerPC::ppcState.cr_fast[2], PowerPC::ppcState.cr_fast[3], PowerPC::ppcState.cr_fast[4], PowerPC::ppcState.cr_fast[5], PowerPC::ppcState.cr_fast[6], PowerPC::ppcState.cr_fast[7], PowerPC::ppcState.fpscr, PowerPC::ppcState.msr, PowerPC::ppcState.spr[8], regs, fregs, op.inst.hex, ppcInst);
|
||||
}
|
||||
|
||||
void STACKALIGN JitIL::Jit(u32 em_address)
|
||||
{
|
||||
if (GetSpaceLeft() < 0x10000 || blocks.IsFull())
|
||||
if (GetSpaceLeft() < 0x10000 || blocks.IsFull() || Core::g_CoreStartupParameter.bJITNoBlockCache)
|
||||
{
|
||||
INFO_LOG(DYNA_REC, "JIT cache full - clearing.")
|
||||
if (Core::g_CoreStartupParameter.bJITUnlimitedCache)
|
||||
{
|
||||
ERROR_LOG(DYNA_REC, "What? JIT cache still full - clearing.");
|
||||
PanicAlert("What? JIT cache still full - clearing.");
|
||||
}
|
||||
ClearCache();
|
||||
}
|
||||
#ifdef JIT_NO_CACHE
|
||||
ClearCache();
|
||||
if (PowerPC::breakpoints.IsAddressBreakPoint(em_address))
|
||||
{
|
||||
PowerPC::Pause();
|
||||
if (PowerPC::breakpoints.IsTempBreakPoint(em_address))
|
||||
PowerPC::breakpoints.Remove(em_address);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
int block_num = blocks.AllocateBlock(em_address);
|
||||
JitBlock *b = blocks.GetBlock(block_num);
|
||||
blocks.FinalizeBlock(block_num, jo.enableBlocklink, DoJit(em_address, &code_buffer, b));
|
||||
|
@ -423,10 +401,12 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
{
|
||||
int blockSize = code_buf->GetSize();
|
||||
|
||||
#ifdef JIT_SINGLESTEP
|
||||
blockSize = 1;
|
||||
Trace(code_buf, em_address);
|
||||
#endif
|
||||
if (Core::g_CoreStartupParameter.bEnableDebugging)
|
||||
{
|
||||
// Comment out the following to disable breakpoints (speed-up)
|
||||
blockSize = 1;
|
||||
Trace(code_buf, em_address);
|
||||
}
|
||||
|
||||
if (em_address == 0)
|
||||
PanicAlert("ERROR : Trying to compile at 0. LR=%08x", LR);
|
||||
|
@ -475,11 +455,12 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
|
|||
// instruction processed by the JIT routines)
|
||||
ibuild.Reset();
|
||||
|
||||
#ifdef JIT_SINGLESTEP
|
||||
|
||||
js.downcountAmount = js.st.numCycles;
|
||||
#else
|
||||
js.downcountAmount = js.st.numCycles + PatchEngine::GetSpeedhackCycles(em_address);
|
||||
#endif
|
||||
|
||||
if (!Core::g_CoreStartupParameter.bEnableDebugging)
|
||||
js.downcountAmount += PatchEngine::GetSpeedhackCycles(em_address);
|
||||
|
||||
// Translate instructions
|
||||
for (int i = 0; i < (int)size; i++)
|
||||
{
|
||||
|
|
|
@ -80,6 +80,17 @@ void JitILAsmRoutineManager::Generate()
|
|||
|
||||
//The result of slice decrement should be in flags if somebody jumped here
|
||||
FixupBranch bail = J_CC(CC_BE);
|
||||
|
||||
if (Core::g_CoreStartupParameter.bEnableDebugging)
|
||||
{
|
||||
ABI_CallFunction(reinterpret_cast<void *>(&PowerPC::CheckBreakPoints));
|
||||
TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF));
|
||||
FixupBranch noBreakpoint = J_CC(CC_Z);
|
||||
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
||||
RET();
|
||||
SetJumpTarget(noBreakpoint);
|
||||
}
|
||||
|
||||
SetJumpTarget(skipToRealDispatch);
|
||||
|
||||
dispatcherNoCheck = GetCodePtr();
|
||||
|
@ -116,11 +127,6 @@ void JitILAsmRoutineManager::Generate()
|
|||
MOV(32, R(ABI_PARAM1), M(&PowerPC::ppcState.pc));
|
||||
CALL((void *)&Jit);
|
||||
#endif
|
||||
#ifdef JIT_NO_CACHE
|
||||
TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF));
|
||||
FixupBranch notRunning = J_CC(CC_NZ);
|
||||
#endif
|
||||
|
||||
JMP(dispatcherNoCheck); // no point in special casing this
|
||||
|
||||
//FP blocks test for FPU available, jump here if false
|
||||
|
@ -133,10 +139,6 @@ void JitILAsmRoutineManager::Generate()
|
|||
MOV(32, M(&PC), R(EAX));
|
||||
JMP(dispatcher);
|
||||
|
||||
#ifdef JIT_NO_CACHE
|
||||
SetJumpTarget(notRunning);
|
||||
#endif
|
||||
|
||||
SetJumpTarget(bail);
|
||||
doTiming = GetCodePtr();
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#ifndef _JITBASE_H
|
||||
#define _JITBASE_H
|
||||
|
||||
//#define JIT_SINGLESTEP // Enables single stepping
|
||||
//#define JIT_NO_CACHE // Disables the block cache and enables breakpoints
|
||||
//#define JIT_LOG_X86 // Enables logging of the generated x86 code
|
||||
//#define JIT_LOG_GPR // Enables logging of the PPC general purpose regs
|
||||
//#define JIT_LOG_FPR // Enables logging of the PPC floating point regs
|
||||
|
|
|
@ -72,11 +72,6 @@ bool JitBlock::ContainsAddress(u32 em_address)
|
|||
void JitBlockCache::Init()
|
||||
{
|
||||
MAX_NUM_BLOCKS = 65536*2;
|
||||
if (Core::g_CoreStartupParameter.bJITUnlimitedCache)
|
||||
{
|
||||
SuccessAlert("Your game was started with an unlimited JIT cache");
|
||||
MAX_NUM_BLOCKS = 65536*8;
|
||||
}
|
||||
|
||||
#if defined USE_OPROFILE && USE_OPROFILE
|
||||
agent = op_open_agent();
|
||||
|
|
|
@ -375,6 +375,16 @@ void CheckExceptions()
|
|||
}
|
||||
}
|
||||
|
||||
void CheckBreakPoints()
|
||||
{
|
||||
if (PowerPC::breakpoints.IsAddressBreakPoint(PC))
|
||||
{
|
||||
PowerPC::Pause();
|
||||
if (PowerPC::breakpoints.IsTempBreakPoint(PC))
|
||||
PowerPC::breakpoints.Remove(PC);
|
||||
}
|
||||
}
|
||||
|
||||
void OnIdle(u32 _uThreadAddr)
|
||||
{
|
||||
u32 nextThread = Memory::Read_U32(_uThreadAddr);
|
||||
|
|
|
@ -58,11 +58,11 @@ struct GC_ALIGNED64(PowerPCState)
|
|||
// Exception management.
|
||||
u32 Exceptions;
|
||||
|
||||
u32 sr[16]; // Segment registers. Unused.
|
||||
u32 sr[16]; // Segment registers.
|
||||
|
||||
u32 DebugCount;
|
||||
|
||||
// special purpose registers - controlls quantizers, DMA, and lots of other misc extensions.
|
||||
// special purpose registers - controls quantizers, DMA, and lots of other misc extensions.
|
||||
// also for power management, but we don't care about that.
|
||||
u32 spr[1024];
|
||||
|
||||
|
@ -95,6 +95,7 @@ void SetMode(CoreMode _coreType);
|
|||
|
||||
void SingleStep();
|
||||
void CheckExceptions();
|
||||
void CheckBreakPoints();
|
||||
void RunLoop();
|
||||
void Start();
|
||||
void Pause();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue