diff --git a/src/backend_x64/a32_interface.cpp b/src/backend_x64/a32_interface.cpp index ad332bc1..8ea058ce 100644 --- a/src/backend_x64/a32_interface.cpp +++ b/src/backend_x64/a32_interface.cpp @@ -60,7 +60,13 @@ struct Jit::Impl { bool invalidate_entire_cache = false; void Execute() { - block_of_code.RunCode(&jit_state); + const u32 new_rsb_ptr = (jit_state.rsb_ptr - 1) & A32JitState::RSBPtrMask; + if (jit_state.GetUniqueHash() == jit_state.rsb_location_descriptors[new_rsb_ptr]) { + jit_state.rsb_ptr = new_rsb_ptr; + block_of_code.RunCodeFrom(&jit_state, reinterpret_cast(jit_state.rsb_codeptrs[new_rsb_ptr])); + } else { + block_of_code.RunCode(&jit_state); + } } std::string Disassemble(const IR::LocationDescriptor& descriptor) { diff --git a/src/backend_x64/a64_interface.cpp b/src/backend_x64/a64_interface.cpp index 149366c4..233700f4 100644 --- a/src/backend_x64/a64_interface.cpp +++ b/src/backend_x64/a64_interface.cpp @@ -50,7 +50,14 @@ public: jit_state.halt_requested = false; // TODO: Check code alignment - block_of_code.RunCode(&jit_state); + + const u32 new_rsb_ptr = (jit_state.rsb_ptr - 1) & A64JitState::RSBPtrMask; + if (jit_state.GetUniqueHash() == jit_state.rsb_location_descriptors[new_rsb_ptr]) { + jit_state.rsb_ptr = new_rsb_ptr; + block_of_code.RunCodeFrom(&jit_state, reinterpret_cast(jit_state.rsb_codeptrs[new_rsb_ptr])); + } else { + block_of_code.RunCode(&jit_state); + } PerformRequestedCacheInvalidation(); }