mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
PPU: Detect lwmutex reservation pattern and optimize it
This commit is contained in:
parent
82b1a2bd7a
commit
86702186f2
1 changed files with 9 additions and 1 deletions
|
@ -2640,7 +2640,15 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value)
|
|||
return false;
|
||||
}())
|
||||
{
|
||||
res.notify_all(-128);
|
||||
// Test a common pattern in lwmutex
|
||||
constexpr u64 mutex_free = u64{static_cast<u32>(0 - 1)} << 32;
|
||||
const bool may_be_lwmutex_related = sizeof(T) == 8 ?
|
||||
(new_data == mutex_free && old_data == u64{ppu.id} << 32) : (old_data == mutex_free && new_data == u64{ppu.id} << 32);
|
||||
|
||||
if (!may_be_lwmutex_related)
|
||||
{
|
||||
res.notify_all(-128);
|
||||
}
|
||||
|
||||
if (addr == ppu.last_faddr)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue