mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
cpu_type removed, system_type added
cpu_state -> cpu_flag vm::stack_allocator template improved ppu_cmd type changed to enum, cmd64 type added
This commit is contained in:
parent
009ac37a7d
commit
bdeccd889f
39 changed files with 449 additions and 492 deletions
|
@ -9,10 +9,8 @@ static struct defer_sleep_tag {} constexpr defer_sleep{};
|
|||
template<typename T> using sleep_queue = std::deque<T*>;
|
||||
|
||||
// Automatic object handling a thread pointer (T*) in the sleep queue
|
||||
// Sleep is called in the constructor (if not null)
|
||||
// Awake is called in the destructor (if not null)
|
||||
// Sleep queue is actually std::deque with pointers, be careful about the lifetime
|
||||
template<typename T, void(T::*Sleep)() = nullptr, void(T::*Awake)() = nullptr>
|
||||
template<typename T>
|
||||
class sleep_entry final
|
||||
{
|
||||
sleep_queue<T>& m_queue;
|
||||
|
@ -24,7 +22,6 @@ public:
|
|||
: m_queue(queue)
|
||||
, m_thread(entry)
|
||||
{
|
||||
if (Sleep) (m_thread.*Sleep)();
|
||||
}
|
||||
|
||||
// Constructor; calls enter()
|
||||
|
@ -38,7 +35,6 @@ public:
|
|||
~sleep_entry()
|
||||
{
|
||||
leave();
|
||||
if (Awake) (m_thread.*Awake)();
|
||||
}
|
||||
|
||||
// Add thread to the sleep queue
|
||||
|
|
|
@ -543,6 +543,62 @@ using any16 = any_pod<simple_t, sizeof(u16)>;
|
|||
using any32 = any_pod<simple_t, sizeof(u32)>;
|
||||
using any64 = any_pod<simple_t, sizeof(u64)>;
|
||||
|
||||
struct cmd64 : any64
|
||||
{
|
||||
struct pair_t
|
||||
{
|
||||
any32 arg1;
|
||||
any32 arg2;
|
||||
};
|
||||
|
||||
cmd64() = default;
|
||||
|
||||
template<typename T>
|
||||
cmd64(const T& value)
|
||||
: any64(value)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
cmd64(const T1& arg1, const T2& arg2)
|
||||
: any64(pair_t{arg1, arg2})
|
||||
{
|
||||
}
|
||||
|
||||
explicit operator bool() const
|
||||
{
|
||||
return as<u64>() != 0;
|
||||
}
|
||||
|
||||
// TODO: compatibility with std::pair/std::tuple?
|
||||
|
||||
template<typename T>
|
||||
decltype(auto) arg1()
|
||||
{
|
||||
return as<pair_t>().arg1.as<T>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
decltype(auto) arg1() const
|
||||
{
|
||||
return as<const pair_t>().arg1.as<const T>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
decltype(auto) arg2()
|
||||
{
|
||||
return as<pair_t>().arg2.as<T>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
decltype(auto) arg2() const
|
||||
{
|
||||
return as<const pair_t>().arg2.as<const T>();
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(sizeof(cmd64) == 8 && std::is_pod<cmd64>::value, "Incorrect cmd64 type");
|
||||
|
||||
// Allows to define integer convertible to multiple types
|
||||
template<typename T, T Value, typename T1 = void, typename... Ts>
|
||||
struct multicast : multicast<T, Value, Ts...>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue