From 90265edfcdaf653e81519bc2cc1a05604287b4d1 Mon Sep 17 00:00:00 2001 From: elad Date: Tue, 4 Dec 2018 20:09:55 +0200 Subject: [PATCH] SPU MFC: avoid copying of the lockline onto the stack in putllc/putlluc (#5392) --- rpcs3/Emu/Cell/SPUThread.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index a2d8ff31bd..d6fdfc7f25 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -1021,8 +1021,7 @@ void spu_thread::do_putlluc(const spu_mfc_cmd& args) raddr = 0; } - auto& data = vm::_ref(addr); - const auto to_write = _ref(args.lsa & 0x3ff80); + const auto& to_write = _ref(args.lsa & 0x3ff80); // Store unconditionally if (LIKELY(g_use_rtm)) @@ -1042,6 +1041,7 @@ void spu_thread::do_putlluc(const spu_mfc_cmd& args) } else { + auto& data = vm::_ref(addr); auto& res = vm::reservation_lock(addr, 128); vm::_ref>(addr) += 0; @@ -1281,13 +1281,13 @@ bool spu_thread::process_mfc_cmd(spu_mfc_cmd args) { // Store conditionally const u32 addr = args.eal & -128u; - auto& data = vm::_ref(addr); - const auto to_write = _ref(args.lsa & 0x3ff80); bool result = false; if (raddr == addr && rtime == vm::reservation_acquire(raddr, 128)) { + const auto& to_write = _ref(args.lsa & 0x3ff80); + if (LIKELY(g_use_rtm)) { if (spu_putllc_tx(raddr, rtime, rdata.data(), to_write.data())) @@ -1298,7 +1298,7 @@ bool spu_thread::process_mfc_cmd(spu_mfc_cmd args) // Don't fallback to heavyweight lock, just give up } - else if (rdata == data) + else if (auto& data = vm::_ref(addr); rdata == data) { auto& res = vm::reservation_lock(raddr, 128);