1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

event queue: Structure size efficiency

This commit is contained in:
Eladash 2021-05-08 20:08:25 +03:00 committed by Ivan
parent 7a4918e4a4
commit 31b55e0030
9 changed files with 23 additions and 23 deletions

View File

@ -11,13 +11,13 @@
LOG_CHANNEL(sys_event);
lv2_event_queue::lv2_event_queue(u32 protocol, s32 type, u64 name, u64 ipc_key, s32 size) noexcept
: protocol{protocol}
, id(idm::last_id())
, type(type)
lv2_event_queue::lv2_event_queue(u32 protocol, s32 type, s32 size, u64 name, u64 ipc_key) noexcept
: id(idm::last_id())
, protocol{static_cast<u8>(protocol)}
, type(static_cast<u8>(type))
, size(static_cast<u8>(size))
, name(name)
, key(ipc_key)
, size(size)
{
}
@ -127,7 +127,7 @@ error_code sys_event_queue_create(cpu_thread& cpu, vm::ptr<u32> equeue_id, vm::p
if (const auto error = lv2_obj::create<lv2_event_queue>(pshared, ipc_key, flags, [&]()
{
return std::make_shared<lv2_event_queue>(protocol, type, name, ipc_key, size);
return std::make_shared<lv2_event_queue>(protocol, type, size, name, ipc_key);
}))
{
return error;

View File

@ -80,18 +80,18 @@ struct lv2_event_queue final : public lv2_obj
{
static const u32 id_base = 0x8d000000;
const lv2_protocol protocol;
const u32 id;
const s32 type;
const lv2_protocol protocol;
const u8 type;
const u8 size;
const u64 name;
const u64 key;
const s32 size;
shared_mutex mutex;
std::deque<lv2_event> events;
std::deque<cpu_thread*> sq;
lv2_event_queue(u32 protocol, s32 type, u64 name, u64 ipc_key, s32 size) noexcept;
lv2_event_queue(u32 protocol, s32 type, s32 size, u64 name, u64 ipc_key) noexcept;
CellError send(lv2_event);

View File

@ -45,8 +45,8 @@ struct lv2_event_flag final : lv2_obj
atomic_t<u64> pattern;
std::deque<cpu_thread*> sq;
lv2_event_flag(u32 protocol, u64 key, s32 type, u64 name, u64 pattern)
: protocol{protocol}
lv2_event_flag(u32 protocol, u64 key, s32 type, u64 name, u64 pattern) noexcept
: protocol{static_cast<u8>(protocol)}
, key(key)
, type(type)
, name(name)

View File

@ -34,10 +34,10 @@ struct lv2_lwcond final : lv2_obj
atomic_t<u32> waiters{0};
std::deque<cpu_thread*> sq;
lv2_lwcond(u64 name, u32 lwid, u32 protocol, vm::ptr<sys_lwcond_t> control)
lv2_lwcond(u64 name, u32 lwid, u32 protocol, vm::ptr<sys_lwcond_t> control) noexcept
: name(std::bit_cast<be_t<u64>>(name))
, lwid(lwid)
, protocol{protocol}
, protocol{static_cast<u8>(protocol)}
, control(control)
{
}

View File

@ -64,8 +64,8 @@ struct lv2_lwmutex final : lv2_obj
std::deque<cpu_thread*> sq;
atomic_t<s32> lwcond_waiters{0};
lv2_lwmutex(u32 protocol, vm::ptr<sys_lwmutex_t> control, u64 name)
: protocol{protocol}
lv2_lwmutex(u32 protocol, vm::ptr<sys_lwmutex_t> control, u64 name) noexcept
: protocol{static_cast<u8>(protocol)}
, control(control)
, name(std::bit_cast<be_t<u64>>(name))
{

View File

@ -37,8 +37,8 @@ struct lv2_mutex final : lv2_obj
atomic_t<u32> lock_count{0}; // Recursive Locks
std::deque<cpu_thread*> sq;
lv2_mutex(u32 protocol, u32 recursive,u32 adaptive, u64 key, u64 name)
: protocol{protocol}
lv2_mutex(u32 protocol, u32 recursive,u32 adaptive, u64 key, u64 name) noexcept
: protocol{static_cast<u8>(protocol)}
, recursive(recursive)
, adaptive(adaptive)
, key(key)

View File

@ -32,8 +32,8 @@ struct lv2_rwlock final : lv2_obj
std::deque<cpu_thread*> rq;
std::deque<cpu_thread*> wq;
lv2_rwlock(u32 protocol, u64 key, u64 name)
: protocol{protocol}
lv2_rwlock(u32 protocol, u64 key, u64 name) noexcept
: protocol{static_cast<u8>(protocol)}
, key(key)
, name(name)
{

View File

@ -32,8 +32,8 @@ struct lv2_sema final : lv2_obj
atomic_t<s32> val;
std::deque<cpu_thread*> sq;
lv2_sema(u32 protocol, u64 key, u64 name, s32 max, s32 value)
: protocol{protocol}
lv2_sema(u32 protocol, u64 key, u64 name, s32 max, s32 value) noexcept
: protocol{static_cast<u8>(protocol)}
, key(key)
, name(name)
, max(max)

View File

@ -14,7 +14,7 @@
#include <thread>
// attr_protocol (waiting scheduling policy)
enum lv2_protocol : u32
enum lv2_protocol : u8
{
SYS_SYNC_FIFO = 0x1, // First In, First Out Order
SYS_SYNC_PRIORITY = 0x2, // Priority Order