From 4ae74b9b4e41682ec66082a3ee1cd484f8ddc1e3 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 2 Dec 2020 03:52:08 -0800 Subject: [PATCH] kern: session mapping getters are on the hotpath --- .../mesosphere/kern_k_session_request.hpp | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_session_request.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_session_request.hpp index 4d5e232d1..fa278f3af 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_session_request.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_session_request.hpp @@ -45,10 +45,10 @@ namespace ams::kern { this->state = st; } - constexpr KProcessAddress GetClientAddress() const { return this->client_address; } - constexpr KProcessAddress GetServerAddress() const { return this->server_address; } - constexpr size_t GetSize() const { return this->size; } - constexpr KMemoryState GetMemoryState() const { return this->state; } + constexpr ALWAYS_INLINE KProcessAddress GetClientAddress() const { return this->client_address; } + constexpr ALWAYS_INLINE KProcessAddress GetServerAddress() const { return this->server_address; } + constexpr ALWAYS_INLINE size_t GetSize() const { return this->size; } + constexpr ALWAYS_INLINE KMemoryState GetMemoryState() const { return this->state; } }; private: Mapping static_mappings[NumStaticMappings]; @@ -62,32 +62,32 @@ namespace ams::kern { void Initialize() { /* ... */ } void Finalize(); - constexpr size_t GetSendCount() const { return this->num_send; } - constexpr size_t GetReceiveCount() const { return this->num_recv; } - constexpr size_t GetExchangeCount() const { return this->num_exch; } + constexpr ALWAYS_INLINE size_t GetSendCount() const { return this->num_send; } + constexpr ALWAYS_INLINE size_t GetReceiveCount() const { return this->num_recv; } + constexpr ALWAYS_INLINE size_t GetExchangeCount() const { return this->num_exch; } Result PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state); Result PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state); Result PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state); - constexpr KProcessAddress GetSendClientAddress(size_t i) const { return GetSendMapping(i).GetClientAddress(); } - constexpr KProcessAddress GetSendServerAddress(size_t i) const { return GetSendMapping(i).GetServerAddress(); } - constexpr size_t GetSendSize(size_t i) const { return GetSendMapping(i).GetSize(); } - constexpr KMemoryState GetSendMemoryState(size_t i) const { return GetSendMapping(i).GetMemoryState(); } + constexpr ALWAYS_INLINE KProcessAddress GetSendClientAddress(size_t i) const { return GetSendMapping(i).GetClientAddress(); } + constexpr ALWAYS_INLINE KProcessAddress GetSendServerAddress(size_t i) const { return GetSendMapping(i).GetServerAddress(); } + constexpr ALWAYS_INLINE size_t GetSendSize(size_t i) const { return GetSendMapping(i).GetSize(); } + constexpr ALWAYS_INLINE KMemoryState GetSendMemoryState(size_t i) const { return GetSendMapping(i).GetMemoryState(); } - constexpr KProcessAddress GetReceiveClientAddress(size_t i) const { return GetReceiveMapping(i).GetClientAddress(); } - constexpr KProcessAddress GetReceiveServerAddress(size_t i) const { return GetReceiveMapping(i).GetServerAddress(); } - constexpr size_t GetReceiveSize(size_t i) const { return GetReceiveMapping(i).GetSize(); } - constexpr KMemoryState GetReceiveMemoryState(size_t i) const { return GetReceiveMapping(i).GetMemoryState(); } + constexpr ALWAYS_INLINE KProcessAddress GetReceiveClientAddress(size_t i) const { return GetReceiveMapping(i).GetClientAddress(); } + constexpr ALWAYS_INLINE KProcessAddress GetReceiveServerAddress(size_t i) const { return GetReceiveMapping(i).GetServerAddress(); } + constexpr ALWAYS_INLINE size_t GetReceiveSize(size_t i) const { return GetReceiveMapping(i).GetSize(); } + constexpr ALWAYS_INLINE KMemoryState GetReceiveMemoryState(size_t i) const { return GetReceiveMapping(i).GetMemoryState(); } - constexpr KProcessAddress GetExchangeClientAddress(size_t i) const { return GetExchangeMapping(i).GetClientAddress(); } - constexpr KProcessAddress GetExchangeServerAddress(size_t i) const { return GetExchangeMapping(i).GetServerAddress(); } - constexpr size_t GetExchangeSize(size_t i) const { return GetExchangeMapping(i).GetSize(); } - constexpr KMemoryState GetExchangeMemoryState(size_t i) const { return GetExchangeMapping(i).GetMemoryState(); } + constexpr ALWAYS_INLINE KProcessAddress GetExchangeClientAddress(size_t i) const { return GetExchangeMapping(i).GetClientAddress(); } + constexpr ALWAYS_INLINE KProcessAddress GetExchangeServerAddress(size_t i) const { return GetExchangeMapping(i).GetServerAddress(); } + constexpr ALWAYS_INLINE size_t GetExchangeSize(size_t i) const { return GetExchangeMapping(i).GetSize(); } + constexpr ALWAYS_INLINE KMemoryState GetExchangeMemoryState(size_t i) const { return GetExchangeMapping(i).GetMemoryState(); } private: Result PushMap(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state, size_t index); - constexpr const Mapping &GetSendMapping(size_t i) const { + constexpr ALWAYS_INLINE const Mapping &GetSendMapping(size_t i) const { MESOSPHERE_ASSERT(i < this->num_send); const size_t index = i; @@ -98,7 +98,7 @@ namespace ams::kern { } } - constexpr const Mapping &GetReceiveMapping(size_t i) const { + constexpr ALWAYS_INLINE const Mapping &GetReceiveMapping(size_t i) const { MESOSPHERE_ASSERT(i < this->num_recv); const size_t index = this->num_send + i; @@ -109,7 +109,7 @@ namespace ams::kern { } } - constexpr const Mapping &GetExchangeMapping(size_t i) const { + constexpr ALWAYS_INLINE const Mapping &GetExchangeMapping(size_t i) const { MESOSPHERE_ASSERT(i < this->num_exch); const size_t index = this->num_send + this->num_recv + i; @@ -176,50 +176,50 @@ namespace ams::kern { static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } - constexpr KThread *GetThread() const { return this->thread; } - constexpr KWritableEvent *GetEvent() const { return this->event; } - constexpr uintptr_t GetAddress() const { return this->address; } - constexpr size_t GetSize() const { return this->size; } - constexpr KProcess *GetServerProcess() const { return this->server; } + constexpr ALWAYS_INLINE KThread *GetThread() const { return this->thread; } + constexpr ALWAYS_INLINE KWritableEvent *GetEvent() const { return this->event; } + constexpr ALWAYS_INLINE uintptr_t GetAddress() const { return this->address; } + constexpr ALWAYS_INLINE size_t GetSize() const { return this->size; } + constexpr ALWAYS_INLINE KProcess *GetServerProcess() const { return this->server; } - void SetServerProcess(KProcess *process) { + void ALWAYS_INLINE SetServerProcess(KProcess *process) { this->server = process; this->server->Open(); } - constexpr void ClearThread() { this->thread = nullptr; } - constexpr void ClearEvent() { this->event = nullptr; } + constexpr ALWAYS_INLINE void ClearThread() { this->thread = nullptr; } + constexpr ALWAYS_INLINE void ClearEvent() { this->event = nullptr; } - constexpr size_t GetSendCount() const { return this->mappings.GetSendCount(); } - constexpr size_t GetReceiveCount() const { return this->mappings.GetReceiveCount(); } - constexpr size_t GetExchangeCount() const { return this->mappings.GetExchangeCount(); } + constexpr ALWAYS_INLINE size_t GetSendCount() const { return this->mappings.GetSendCount(); } + constexpr ALWAYS_INLINE size_t GetReceiveCount() const { return this->mappings.GetReceiveCount(); } + constexpr ALWAYS_INLINE size_t GetExchangeCount() const { return this->mappings.GetExchangeCount(); } - Result PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { + ALWAYS_INLINE Result PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { return this->mappings.PushSend(client, server, size, state); } - Result PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { + ALWAYS_INLINE Result PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { return this->mappings.PushReceive(client, server, size, state); } - Result PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { + ALWAYS_INLINE Result PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { return this->mappings.PushExchange(client, server, size, state); } - constexpr KProcessAddress GetSendClientAddress(size_t i) const { return this->mappings.GetSendClientAddress(i); } - constexpr KProcessAddress GetSendServerAddress(size_t i) const { return this->mappings.GetSendServerAddress(i); } - constexpr size_t GetSendSize(size_t i) const { return this->mappings.GetSendSize(i); } - constexpr KMemoryState GetSendMemoryState(size_t i) const { return this->mappings.GetSendMemoryState(i); } + constexpr ALWAYS_INLINE KProcessAddress GetSendClientAddress(size_t i) const { return this->mappings.GetSendClientAddress(i); } + constexpr ALWAYS_INLINE KProcessAddress GetSendServerAddress(size_t i) const { return this->mappings.GetSendServerAddress(i); } + constexpr ALWAYS_INLINE size_t GetSendSize(size_t i) const { return this->mappings.GetSendSize(i); } + constexpr ALWAYS_INLINE KMemoryState GetSendMemoryState(size_t i) const { return this->mappings.GetSendMemoryState(i); } - constexpr KProcessAddress GetReceiveClientAddress(size_t i) const { return this->mappings.GetReceiveClientAddress(i); } - constexpr KProcessAddress GetReceiveServerAddress(size_t i) const { return this->mappings.GetReceiveServerAddress(i); } - constexpr size_t GetReceiveSize(size_t i) const { return this->mappings.GetReceiveSize(i); } - constexpr KMemoryState GetReceiveMemoryState(size_t i) const { return this->mappings.GetReceiveMemoryState(i); } + constexpr ALWAYS_INLINE KProcessAddress GetReceiveClientAddress(size_t i) const { return this->mappings.GetReceiveClientAddress(i); } + constexpr ALWAYS_INLINE KProcessAddress GetReceiveServerAddress(size_t i) const { return this->mappings.GetReceiveServerAddress(i); } + constexpr ALWAYS_INLINE size_t GetReceiveSize(size_t i) const { return this->mappings.GetReceiveSize(i); } + constexpr ALWAYS_INLINE KMemoryState GetReceiveMemoryState(size_t i) const { return this->mappings.GetReceiveMemoryState(i); } - constexpr KProcessAddress GetExchangeClientAddress(size_t i) const { return this->mappings.GetExchangeClientAddress(i); } - constexpr KProcessAddress GetExchangeServerAddress(size_t i) const { return this->mappings.GetExchangeServerAddress(i); } - constexpr size_t GetExchangeSize(size_t i) const { return this->mappings.GetExchangeSize(i); } - constexpr KMemoryState GetExchangeMemoryState(size_t i) const { return this->mappings.GetExchangeMemoryState(i); } + constexpr ALWAYS_INLINE KProcessAddress GetExchangeClientAddress(size_t i) const { return this->mappings.GetExchangeClientAddress(i); } + constexpr ALWAYS_INLINE KProcessAddress GetExchangeServerAddress(size_t i) const { return this->mappings.GetExchangeServerAddress(i); } + constexpr ALWAYS_INLINE size_t GetExchangeSize(size_t i) const { return this->mappings.GetExchangeSize(i); } + constexpr ALWAYS_INLINE KMemoryState GetExchangeMemoryState(size_t i) const { return this->mappings.GetExchangeMemoryState(i); } }; }