mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-01 12:08:12 +00:00
LV2: Minor optimization regarding signal flag
This commit is contained in:
parent
dc851a729e
commit
2eebbd307d
@ -4860,9 +4860,9 @@ bool spu_thread::stop_and_signal(u32 code)
|
||||
}
|
||||
}
|
||||
|
||||
while (auto old = state.fetch_sub(cpu_flag::signal))
|
||||
while (auto old = +state)
|
||||
{
|
||||
if (old & cpu_flag::signal)
|
||||
if (old & cpu_flag::signal && state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -348,9 +348,9 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout)
|
||||
return CELL_EPERM;
|
||||
}
|
||||
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -451,9 +451,9 @@ error_code sys_event_queue_receive(ppu_thread& ppu, u32 equeue_id, vm::ptr<sys_e
|
||||
}
|
||||
|
||||
// If cancelled, gpr[3] will be non-zero. Other registers must contain event data.
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -191,9 +191,9 @@ error_code sys_event_flag_wait(ppu_thread& ppu, u32 id, u64 bitptn, u32 mode, vm
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -400,9 +400,9 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -184,9 +184,9 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout)
|
||||
return not_an_error(ppu.gpr[3]);
|
||||
}
|
||||
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -175,9 +175,9 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout)
|
||||
|
||||
ppu.gpr[3] = CELL_OK;
|
||||
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -150,9 +150,9 @@ error_code sys_rwlock_rlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout)
|
||||
|
||||
ppu.gpr[3] = CELL_OK;
|
||||
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -378,9 +378,9 @@ error_code sys_rwlock_wlock(ppu_thread& ppu, u32 rw_lock_id, u64 timeout)
|
||||
|
||||
ppu.gpr[3] = CELL_OK;
|
||||
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -147,9 +147,9 @@ error_code sys_semaphore_wait(ppu_thread& ppu, u32 sem_id, u64 timeout)
|
||||
|
||||
ppu.gpr[3] = CELL_OK;
|
||||
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -1408,11 +1408,9 @@ error_code sys_spu_thread_group_join(ppu_thread& ppu, u32 id, vm::ptr<u32> cause
|
||||
lv2_obj::sleep(ppu);
|
||||
lock.unlock();
|
||||
|
||||
while (true)
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
const auto state = ppu.state.fetch_sub(cpu_flag::signal);
|
||||
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -860,9 +860,9 @@ error_code sys_usbd_receive_event(ppu_thread& ppu, u32 handle, vm::ptr<u64> arg1
|
||||
usbh.sq.emplace_back(&ppu);
|
||||
}
|
||||
|
||||
while (auto state = ppu.state.fetch_sub(cpu_flag::signal))
|
||||
while (auto state = +ppu.state)
|
||||
{
|
||||
if (state & cpu_flag::signal)
|
||||
if (state & cpu_flag::signal && ppu.state.test_and_reset(cpu_flag::signal))
|
||||
{
|
||||
sys_usbd.trace("Received event(queued): arg1=0x%x arg2=0x%x arg3=0x%x", ppu.gpr[4], ppu.gpr[5], ppu.gpr[6]);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user