diff --git a/src/core/cpu_code_cache.cpp b/src/core/cpu_code_cache.cpp index d8947f539..613308398 100644 --- a/src/core/cpu_code_cache.cpp +++ b/src/core/cpu_code_cache.cpp @@ -450,7 +450,6 @@ void ExecuteRecompiler() #endif const u32 pc = g_state.regs.pc; - g_state.current_instruction_pc = pc; s_single_block_asm_dispatcher(s_fast_map[pc >> 16][pc >> 2]); } @@ -802,8 +801,10 @@ void FastCompileBlockFunction() if (block) { s_single_block_asm_dispatcher(block->host_code); + return; } - else if (g_settings.gpu_pgxp_enable) + + if (g_settings.gpu_pgxp_enable) { if (g_settings.gpu_pgxp_cpu) InterpretUncachedBlock(); diff --git a/src/core/cpu_recompiler_code_generator.cpp b/src/core/cpu_recompiler_code_generator.cpp index eec108cb9..7379565e1 100644 --- a/src/core/cpu_recompiler_code_generator.cpp +++ b/src/core/cpu_recompiler_code_generator.cpp @@ -1165,6 +1165,7 @@ bool CodeGenerator::Compile_Fallback(const CodeBlockInstruction& cbi) m_register_cache.WriteLoadDelayToCPU(true); } + EmitStoreCPUStructField(offsetof(State, current_instruction_pc), Value::FromConstantU32(cbi.pc)); EmitStoreCPUStructField(offsetof(State, current_instruction.bits), Value::FromConstantU32(cbi.instruction.bits)); // emit the function call @@ -2341,7 +2342,6 @@ bool CodeGenerator::Compile_Branch(const CodeBlockInstruction& cbi) &return_to_dispatcher); // we're committed at this point :D - EmitStoreCPUStructField(offsetof(State, current_instruction_pc), branch_target); EmitEndBlock(true, false); const void* jump_pointer = GetCurrentCodePointer(); @@ -2368,22 +2368,15 @@ bool CodeGenerator::Compile_Branch(const CodeBlockInstruction& cbi) if (condition != Condition::Always) { WriteNewPC(next_pc, true); - EmitStoreCPUStructField(offsetof(State, current_instruction_pc), next_pc); } else { WriteNewPC(branch_target, true); - EmitStoreCPUStructField(offsetof(State, current_instruction_pc), branch_target); } EmitConditionalBranch(Condition::GreaterEqual, false, pending_ticks.GetHostRegister(), downcount, &return_to_dispatcher); - if (condition != Condition::Always) - EmitStoreCPUStructField(offsetof(State, current_instruction_pc), next_pc); - else - EmitStoreCPUStructField(offsetof(State, current_instruction_pc), branch_target); - EmitEndBlock(true, false); const void* jump_pointer = GetCurrentCodePointer(); diff --git a/src/core/cpu_recompiler_code_generator_aarch32.cpp b/src/core/cpu_recompiler_code_generator_aarch32.cpp index 178803175..be0fb37f1 100644 --- a/src/core/cpu_recompiler_code_generator_aarch32.cpp +++ b/src/core/cpu_recompiler_code_generator_aarch32.cpp @@ -2089,9 +2089,6 @@ CodeCache::DispatcherFunction CodeGenerator::CompileDispatcher() m_emit->lsr(a32::r1, a32::r0, 16); m_emit->ldr(a32::r1, a32::MemOperand(a32::r2, a32::r1, a32::LSL, 2)); - // current_instruction_pc <- pc (r0) - m_emit->str(a32::r0, a32::MemOperand(GetHostReg32(RCPUPTR), offsetof(State, current_instruction_pc))); - // blr(r1[pc]) (fast_map[pc >> 2]) m_emit->ldr(a32::r0, a32::MemOperand(a32::r1, a32::r0)); m_emit->blx(a32::r0); diff --git a/src/core/cpu_recompiler_code_generator_aarch64.cpp b/src/core/cpu_recompiler_code_generator_aarch64.cpp index 1e356e0d4..f7ce1b17b 100644 --- a/src/core/cpu_recompiler_code_generator_aarch64.cpp +++ b/src/core/cpu_recompiler_code_generator_aarch64.cpp @@ -2290,13 +2290,10 @@ CodeCache::DispatcherFunction CodeGenerator::CompileDispatcher() // x9 <- s_fast_map[pc >> 16] EmitLoadGlobalAddress(10, CodeCache::GetFastMapPointer()); m_emit->lsr(a64::w9, a64::w8, 16); + m_emit->lsr(a64::w8, a64::w8, 2); m_emit->ldr(a64::x9, a64::MemOperand(a64::x10, a64::x9, a64::LSL, 3)); - // current_instruction_pc <- pc (w8) - m_emit->str(a64::w8, a64::MemOperand(GetHostReg64(RCPUPTR), offsetof(State, current_instruction_pc))); - // blr(x9[pc * 2]) (fast_map[pc >> 2]) - m_emit->lsr(a64::w8, a64::w8, 2); m_emit->ldr(a64::x8, a64::MemOperand(a64::x9, a64::x8, a64::LSL, 3)); m_emit->blr(a64::x8); diff --git a/src/core/cpu_recompiler_code_generator_x64.cpp b/src/core/cpu_recompiler_code_generator_x64.cpp index 647de1409..b261158ad 100644 --- a/src/core/cpu_recompiler_code_generator_x64.cpp +++ b/src/core/cpu_recompiler_code_generator_x64.cpp @@ -3073,9 +3073,6 @@ CodeCache::DispatcherFunction CodeGenerator::CompileDispatcher() // eax <- pc m_emit->mov(m_emit->eax, m_emit->dword[m_emit->rbp + offsetof(State, regs.pc)]); - // current_instruction_pc <- pc (eax) - m_emit->mov(m_emit->dword[m_emit->rbp + offsetof(State, current_instruction_pc)], m_emit->eax); - // rcx <- s_fast_map[pc >> 16] EmitLoadGlobalAddress(Xbyak::Operand::RBX, CodeCache::GetFastMapPointer()); m_emit->mov(m_emit->ecx, m_emit->eax);