mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-23 02:42:09 +00:00
sm: save 0x1000 in data costs by not aligning server manager to 0x1000
This commit is contained in:
parent
2e1a93f1d1
commit
88ac85c423
1 changed files with 8 additions and 8 deletions
|
@ -42,7 +42,14 @@ namespace ams::tipc {
|
||||||
template<typename DeferralManagerType, size_t ThreadStackSize, typename... PortInfos>
|
template<typename DeferralManagerType, size_t ThreadStackSize, typename... PortInfos>
|
||||||
class ServerManagerImpl {
|
class ServerManagerImpl {
|
||||||
private:
|
private:
|
||||||
|
static constexpr inline size_t NumPorts = sizeof...(PortInfos);
|
||||||
|
static constexpr inline size_t MaxSessions = (PortInfos::MaxSessions + ...);
|
||||||
|
|
||||||
|
/* Verify that it's possible to service this many sessions, with our port manager count. */
|
||||||
|
static_assert(MaxSessions <= NumPorts * svc::ArgumentHandleCountMax);
|
||||||
|
|
||||||
static_assert(util::IsAligned(ThreadStackSize, os::ThreadStackAlignment));
|
static_assert(util::IsAligned(ThreadStackSize, os::ThreadStackAlignment));
|
||||||
|
alignas(os::ThreadStackAlignment) static constinit inline u8 s_port_stacks[ThreadStackSize * (NumPorts - 1)];
|
||||||
|
|
||||||
static constexpr inline bool IsDeferralSupported = !std::same_as<DeferralManagerType, DummyDeferralManager>;
|
static constexpr inline bool IsDeferralSupported = !std::same_as<DeferralManagerType, DummyDeferralManager>;
|
||||||
using ResumeKey = typename DeferralManagerType::Key;
|
using ResumeKey = typename DeferralManagerType::Key;
|
||||||
|
@ -67,12 +74,6 @@ namespace ams::tipc {
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr inline size_t NumPorts = sizeof...(PortInfos);
|
|
||||||
static constexpr inline size_t MaxSessions = (PortInfos::MaxSessions + ...);
|
|
||||||
|
|
||||||
/* Verify that it's possible to service this many sessions, with our port manager count. */
|
|
||||||
static_assert(MaxSessions <= NumPorts * svc::ArgumentHandleCountMax);
|
|
||||||
|
|
||||||
template<size_t Ix> requires (Ix < NumPorts)
|
template<size_t Ix> requires (Ix < NumPorts)
|
||||||
static constexpr inline size_t SessionsPerPortManager = (Ix == NumPorts - 1) ? ((MaxSessions / NumPorts) + MaxSessions % NumPorts)
|
static constexpr inline size_t SessionsPerPortManager = (Ix == NumPorts - 1) ? ((MaxSessions / NumPorts) + MaxSessions % NumPorts)
|
||||||
: ((MaxSessions / NumPorts));
|
: ((MaxSessions / NumPorts));
|
||||||
|
@ -353,7 +354,6 @@ namespace ams::tipc {
|
||||||
PortManagerTuple m_port_managers;
|
PortManagerTuple m_port_managers;
|
||||||
PortAllocatorTuple m_port_allocators;
|
PortAllocatorTuple m_port_allocators;
|
||||||
os::ThreadType m_port_threads[NumPorts - 1];
|
os::ThreadType m_port_threads[NumPorts - 1];
|
||||||
alignas(os::ThreadStackAlignment) u8 m_port_stacks[ThreadStackSize * (NumPorts - 1)];
|
|
||||||
private:
|
private:
|
||||||
template<size_t Ix>
|
template<size_t Ix>
|
||||||
ALWAYS_INLINE auto &GetPortManager() {
|
ALWAYS_INLINE auto &GetPortManager() {
|
||||||
|
@ -378,7 +378,7 @@ namespace ams::tipc {
|
||||||
template<size_t Ix>
|
template<size_t Ix>
|
||||||
void InitializePortThread(s32 priority) {
|
void InitializePortThread(s32 priority) {
|
||||||
/* Create the thread. */
|
/* Create the thread. */
|
||||||
R_ABORT_UNLESS(os::CreateThread(m_port_threads + Ix, &LoopAutoForPortThreadFunction<Ix>, this, m_port_stacks + Ix, ThreadStackSize, priority));
|
R_ABORT_UNLESS(os::CreateThread(m_port_threads + Ix, &LoopAutoForPortThreadFunction<Ix>, this, s_port_stacks + Ix, ThreadStackSize, priority));
|
||||||
|
|
||||||
/* Start the thread. */
|
/* Start the thread. */
|
||||||
os::StartThread(m_port_threads + Ix);
|
os::StartThread(m_port_threads + Ix);
|
||||||
|
|
Loading…
Reference in a new issue