From 0659827485afd86d15673b53bc55c36e52fabca8 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 24 Dec 2022 12:59:02 +0100 Subject: [PATCH] Jit64: Check for breakpoint without disabling block link Small optimization. By not calling WriteExit, the block linking system never finds out about the exit we're doing, saving us from having to disable block linking. --- Source/Core/Core/PowerPC/Jit64/Jit.cpp | 13 ++++++------- Source/Core/Core/PowerPC/Jit64/JitAsm.cpp | 2 ++ Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 4b94c5c076..3bd14acba6 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -799,11 +799,10 @@ void Jit64::Jit(u32 em_address, bool clear_cache_and_retry_on_failure) if (m_enable_debugging) { - // We can link blocks as long as we are not single stepping and there are no breakpoints here + // We can link blocks as long as we are not single stepping EnableBlockLink(); EnableOptimization(); - // Comment out the following to disable breakpoints (speed-up) if (!jo.profile_blocks) { if (CPU::IsStepping()) @@ -1099,10 +1098,6 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) if (m_enable_debugging && breakpoints.IsAddressBreakPoint(op.address) && !CPU::IsStepping()) { - // Turn off block linking if there are breakpoints so that the Step Over command does not - // link this block. - jo.enableBlocklink = false; - gpr.Flush(); fpr.Flush(); @@ -1114,7 +1109,11 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) TEST(32, MatR(RSCRATCH), Imm32(0xFFFFFFFF)); FixupBranch noBreakpoint = J_CC(CC_Z); - WriteExit(op.address); + Cleanup(); + MOV(32, PPCSTATE(npc), Imm32(op.address)); + SUB(32, PPCSTATE(downcount), Imm32(js.downcountAmount)); + JMP(asm_routines.dispatcher_exit, true); + SetJumpTarget(noBreakpoint); } diff --git a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp index a162caebe5..3dc98a317e 100644 --- a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp +++ b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp @@ -205,8 +205,10 @@ void Jit64AsmRoutineManager::Generate() J_CC(CC_Z, outerLoop); // Landing pad for drec space + dispatcher_exit = GetCodePtr(); if (enable_debugging) SetJumpTarget(dbg_exit); + ResetStack(*this); if (m_stack_top) { diff --git a/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h b/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h index d975408ed3..4fd58bc897 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitAsmCommon.h @@ -19,6 +19,7 @@ struct CommonAsmRoutinesBase const u8* dispatcher; const u8* dispatcher_no_timing_check; const u8* dispatcher_no_check; + const u8* dispatcher_exit; const u8* do_timing;