From 436613401a981370bfa8c06637f2d2ebb89c803c Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 23 Oct 2021 21:13:26 -0700 Subject: [PATCH] kern: devirtualize several KAutoObject functions --- .../include/mesosphere/kern_k_auto_object.hpp | 4 +- .../mesosphere/kern_k_client_session.hpp | 1 - .../include/mesosphere/kern_k_code_memory.hpp | 4 +- .../kern_k_device_address_space.hpp | 4 +- .../include/mesosphere/kern_k_event.hpp | 6 +-- .../mesosphere/kern_k_interrupt_event.hpp | 4 +- .../include/mesosphere/kern_k_io_pool.hpp | 4 +- .../include/mesosphere/kern_k_io_region.hpp | 4 +- .../kern_k_light_client_session.hpp | 1 - .../kern_k_light_server_session.hpp | 1 - .../mesosphere/kern_k_light_session.hpp | 6 +-- .../include/mesosphere/kern_k_port.hpp | 2 + .../include/mesosphere/kern_k_process.hpp | 4 +- .../mesosphere/kern_k_resource_limit.hpp | 2 +- .../include/mesosphere/kern_k_session.hpp | 6 +-- .../mesosphere/kern_k_session_request.hpp | 29 +++++++------ .../mesosphere/kern_k_shared_memory.hpp | 4 +- .../kern_k_synchronization_object.hpp | 2 +- .../include/mesosphere/kern_k_thread.hpp | 7 +-- .../mesosphere/kern_k_transfer_memory.hpp | 6 +-- .../include/mesosphere/kern_slab_helpers.hpp | 43 +++++++++++++------ .../source/kern_k_code_memory.cpp | 3 -- .../source/kern_k_device_address_space.cpp | 3 -- .../libmesosphere/source/kern_k_event.cpp | 2 - .../source/kern_k_interrupt_event.cpp | 2 +- .../libmesosphere/source/kern_k_process.cpp | 2 +- .../source/kern_k_shared_memory.cpp | 3 -- .../source/kern_k_synchronization_object.cpp | 1 - .../libmesosphere/source/kern_k_thread.cpp | 2 +- .../source/kern_k_transfer_memory.cpp | 3 -- 30 files changed, 84 insertions(+), 81 deletions(-) diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp index 16f1399df..431bd32f7 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_auto_object.hpp @@ -139,7 +139,9 @@ namespace ams::kern { virtual void Destroy() { MESOSPHERE_ASSERT_THIS(); } /* Finalize is responsible for cleaning up resource, but does not destroy the object. */ - virtual void Finalize() { MESOSPHERE_ASSERT_THIS(); } + /* NOTE: This is a virtual function in official kernel, but because everything which uses it */ + /* is already using CRTP for slab heap, we have devirtualized it for performance gain. */ + /* virtual void Finalize() { MESOSPHERE_ASSERT_THIS(); } */ virtual KProcess *GetOwner() const { return nullptr; } diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_client_session.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_client_session.hpp index 1f190b4a3..e49ab8f04 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_client_session.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_client_session.hpp @@ -36,7 +36,6 @@ namespace ams::kern { } virtual void Destroy() override; - static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } constexpr KSession *GetParent() const { return m_parent; } diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_code_memory.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_code_memory.hpp index ebb4bf2ab..daf47e3d3 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_code_memory.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_code_memory.hpp @@ -36,14 +36,14 @@ namespace ams::kern { } Result Initialize(KProcessAddress address, size_t size); - virtual void Finalize() override; + void Finalize(); Result Map(KProcessAddress address, size_t size); Result Unmap(KProcessAddress address, size_t size); Result MapToOwner(KProcessAddress address, size_t size, ams::svc::MemoryPermission perm); Result UnmapFromOwner(KProcessAddress address, size_t size); - virtual bool IsInitialized() const override { return m_is_initialized; } + bool IsInitialized() const { return m_is_initialized; } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } KProcess *GetOwner() const { return m_owner; } diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_device_address_space.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_device_address_space.hpp index 6a9d4e536..8b85b58ca 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_device_address_space.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_device_address_space.hpp @@ -33,9 +33,9 @@ namespace ams::kern { explicit KDeviceAddressSpace() : m_is_initialized(false) { /* ... */ } Result Initialize(u64 address, u64 size); - virtual void Finalize() override; + void Finalize(); - virtual bool IsInitialized() const override { return m_is_initialized; } + bool IsInitialized() const { return m_is_initialized; } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } Result Attach(ams::svc::DeviceName device_name); diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_event.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_event.hpp index 55b3b12ee..702785e73 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_event.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_event.hpp @@ -39,10 +39,10 @@ namespace ams::kern { explicit KEvent() : m_readable_event(), m_owner(), m_initialized(), m_readable_event_destroyed() { /* ... */ } void Initialize(); - virtual void Finalize() override; + void Finalize(); - virtual bool IsInitialized() const override { return m_initialized; } - virtual uintptr_t GetPostDestroyArgument() const override { return reinterpret_cast(m_owner); } + bool IsInitialized() const { return m_initialized; } + uintptr_t GetPostDestroyArgument() const { return reinterpret_cast(m_owner); } static void PostDestroy(uintptr_t arg); diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_interrupt_event.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_interrupt_event.hpp index 595414ce1..7a8306908 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_interrupt_event.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_interrupt_event.hpp @@ -36,11 +36,11 @@ namespace ams::kern { explicit KInterruptEvent() : m_interrupt_id(-1), m_is_initialized(false) { /* ... */ } Result Initialize(int32_t interrupt_name, ams::svc::InterruptType type); - virtual void Finalize() override; + void Finalize(); virtual Result Reset() override; - virtual bool IsInitialized() const override { return m_is_initialized; } + bool IsInitialized() const { return m_is_initialized; } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_io_pool.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_io_pool.hpp index 4a0a52f6e..0e6e19258 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_io_pool.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_io_pool.hpp @@ -38,9 +38,9 @@ namespace ams::kern { } Result Initialize(ams::svc::IoPoolType pool_type); - virtual void Finalize() override; + void Finalize(); - virtual bool IsInitialized() const override { return m_is_initialized; } + bool IsInitialized() const { return m_is_initialized; } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } Result AddIoRegion(KIoRegion *region); diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_io_region.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_io_region.hpp index 2da4c328b..308b32a4d 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_io_region.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_io_region.hpp @@ -43,9 +43,9 @@ namespace ams::kern { explicit KIoRegion() : m_pool(nullptr), m_is_initialized(false) { /* ... */ } Result Initialize(KIoPool *pool, KPhysicalAddress phys_addr, size_t size, ams::svc::MemoryMapping mapping, ams::svc::MemoryPermission perm); - virtual void Finalize() override; + void Finalize(); - virtual bool IsInitialized() const override { return m_is_initialized; } + bool IsInitialized() const { return m_is_initialized; } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } Result Map(KProcessAddress address, size_t size, ams::svc::MemoryPermission map_perm); diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_light_client_session.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_light_client_session.hpp index 615dace1e..d20d10d6d 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_light_client_session.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_light_client_session.hpp @@ -34,7 +34,6 @@ namespace ams::kern { } virtual void Destroy() override; - static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } constexpr const KLightSession *GetParent() const { return m_parent; } diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_light_server_session.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_light_server_session.hpp index d6dd63369..b991672e0 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_light_server_session.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_light_server_session.hpp @@ -40,7 +40,6 @@ namespace ams::kern { } virtual void Destroy() override; - static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } constexpr const KLightSession *GetParent() const { return m_parent; } diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_light_session.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_light_session.hpp index 417e84ec7..8ba769ca2 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_light_session.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_light_session.hpp @@ -49,10 +49,10 @@ namespace ams::kern { explicit KLightSession() : m_state(State::Invalid), m_process(), m_initialized() { /* ... */ } void Initialize(KClientPort *client_port, uintptr_t name); - virtual void Finalize() override; + void Finalize(); - virtual bool IsInitialized() const override { return m_initialized; } - virtual uintptr_t GetPostDestroyArgument() const override { return reinterpret_cast(m_process); } + bool IsInitialized() const { return m_initialized; } + uintptr_t GetPostDestroyArgument() const { return reinterpret_cast(m_process); } static void PostDestroy(uintptr_t arg); diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_port.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_port.hpp index 1f3344159..ee545a9f5 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_port.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_port.hpp @@ -46,6 +46,8 @@ namespace ams::kern { static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } void Initialize(s32 max_sessions, bool is_light, uintptr_t name); + void Finalize() { /* ... */ } + void OnClientClosed(); void OnServerClosed(); diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_process.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_process.hpp index fac619bff..52fac88c0 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_process.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_process.hpp @@ -384,11 +384,11 @@ namespace ams::kern { } public: /* Overridden parent functions. */ - virtual bool IsInitialized() const override { return m_is_initialized; } + bool IsInitialized() const { return m_is_initialized; } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } - virtual void Finalize() override; + void Finalize(); virtual u64 GetId() const override final { return this->GetProcessId(); } diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_resource_limit.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_resource_limit.hpp index 5b21a5282..5a3426e9f 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_resource_limit.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_resource_limit.hpp @@ -46,7 +46,7 @@ namespace ams::kern { static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } void Initialize(); - virtual void Finalize() override; + void Finalize(); s64 GetLimitValue(ams::svc::LimitableResource which) const; s64 GetCurrentValue(ams::svc::LimitableResource which) const; diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_session.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_session.hpp index 9f0352a1d..3c3e544d5 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_session.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_session.hpp @@ -62,10 +62,10 @@ namespace ams::kern { explicit KSession() : m_atomic_state(util::ToUnderlying(State::Invalid)), m_initialized(false), m_process(nullptr) { /* ... */ } void Initialize(KClientPort *client_port, uintptr_t name); - virtual void Finalize() override; + void Finalize(); - virtual bool IsInitialized() const override { return m_initialized; } - virtual uintptr_t GetPostDestroyArgument() const override { return reinterpret_cast(m_process); } + bool IsInitialized() const { return m_initialized; } + uintptr_t GetPostDestroyArgument() const { return reinterpret_cast(m_process); } static void PostDestroy(uintptr_t arg); diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_session_request.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_session_request.hpp index f688586fa..07f9a7c5a 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_session_request.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_session_request.hpp @@ -169,20 +169,6 @@ namespace ams::kern { } } - virtual void Finalize() override { - m_mappings.Finalize(); - - if (m_thread) { - m_thread->Close(); - } - if (m_event) { - m_event->Close(); - } - if (m_server) { - m_server->Close(); - } - } - static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } constexpr ALWAYS_INLINE KThread *GetThread() const { return m_thread; } @@ -229,6 +215,21 @@ namespace ams::kern { constexpr ALWAYS_INLINE KProcessAddress GetExchangeServerAddress(size_t i) const { return m_mappings.GetExchangeServerAddress(i); } constexpr ALWAYS_INLINE size_t GetExchangeSize(size_t i) const { return m_mappings.GetExchangeSize(i); } constexpr ALWAYS_INLINE KMemoryState GetExchangeMemoryState(size_t i) const { return m_mappings.GetExchangeMemoryState(i); } + private: + /* NOTE: This is public and virtual in Nintendo's kernel. */ + void Finalize() { + m_mappings.Finalize(); + + if (m_thread) { + m_thread->Close(); + } + if (m_event) { + m_event->Close(); + } + if (m_server) { + m_server->Close(); + } + } }; } diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_shared_memory.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_shared_memory.hpp index 6eb0b7f03..cb90416a5 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_shared_memory.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_shared_memory.hpp @@ -42,9 +42,9 @@ namespace ams::kern { } Result Initialize(KProcess *owner, size_t size, ams::svc::MemoryPermission own_perm, ams::svc::MemoryPermission rem_perm); - virtual void Finalize() override; + void Finalize(); - virtual bool IsInitialized() const override { return m_is_initialized; } + bool IsInitialized() const { return m_is_initialized; } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } Result Map(KProcessPageTable *table, KProcessAddress address, size_t size, KProcess *process, ams::svc::MemoryPermission map_perm); diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_synchronization_object.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_synchronization_object.hpp index ce022a58b..037f4dd0d 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_synchronization_object.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_synchronization_object.hpp @@ -44,7 +44,7 @@ namespace ams::kern { public: static Result Wait(s32 *out_index, KSynchronizationObject **objects, const s32 num_objects, s64 timeout); public: - virtual void Finalize() override; + void Finalize(); virtual bool IsSignaled() const { AMS_INFINITE_LOOP(); } void DumpWaiters(); diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_thread.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_thread.hpp index 480626b9f..bac7d64f3 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_thread.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_thread.hpp @@ -612,12 +612,13 @@ namespace ams::kern { /* Overridden parent functions. */ virtual u64 GetId() const override final { return this->GetThreadId(); } - virtual bool IsInitialized() const override { return m_initialized; } - virtual uintptr_t GetPostDestroyArgument() const override { return reinterpret_cast(m_parent) | (m_resource_limit_release_hint ? 1 : 0); } + bool IsInitialized() const { return m_initialized; } + uintptr_t GetPostDestroyArgument() const { return reinterpret_cast(m_parent) | (m_resource_limit_release_hint ? 1 : 0); } static void PostDestroy(uintptr_t arg); - virtual void Finalize() override; + void Finalize(); + virtual bool IsSignaled() const override; virtual void OnTimer() override; virtual void DoWorkerTask() override; diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_transfer_memory.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_transfer_memory.hpp index 9303514bb..cd88f3abf 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_transfer_memory.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_transfer_memory.hpp @@ -36,10 +36,10 @@ namespace ams::kern { } Result Initialize(KProcessAddress addr, size_t size, ams::svc::MemoryPermission own_perm); - virtual void Finalize() override; + void Finalize(); - virtual bool IsInitialized() const override { return m_is_initialized; } - virtual uintptr_t GetPostDestroyArgument() const override { return reinterpret_cast(m_owner); } + bool IsInitialized() const { return m_is_initialized; } + uintptr_t GetPostDestroyArgument() const { return reinterpret_cast(m_owner); } static void PostDestroy(uintptr_t arg); Result Map(KProcessAddress address, size_t size, ams::svc::MemoryPermission map_perm); diff --git a/libraries/libmesosphere/include/mesosphere/kern_slab_helpers.hpp b/libraries/libmesosphere/include/mesosphere/kern_slab_helpers.hpp index 079055261..fd7fc8fc3 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_slab_helpers.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_slab_helpers.hpp @@ -64,9 +64,8 @@ namespace ams::kern { static size_t GetNumRemaining() { return s_slab_heap.GetNumRemaining(); } }; - template + template requires std::derived_from class KAutoObjectWithSlabHeapAndContainer : public Base { - static_assert(std::is_base_of::value); private: static constinit inline KSlabHeap s_slab_heap; static constinit inline KAutoObjectWithListContainer s_container; @@ -84,28 +83,44 @@ namespace ams::kern { ALWAYS_INLINE ListAccessor() : KAutoObjectWithListContainer::ListAccessor(s_container) { /* ... */ } ALWAYS_INLINE ~ListAccessor() { /* ... */ } }; + private: + static ALWAYS_INLINE bool IsInitialized(const Derived *obj) { + if constexpr (requires { { obj->IsInitialized() } -> std::same_as; }) { + return obj->IsInitialized(); + } else { + return true; + } + } + + static ALWAYS_INLINE uintptr_t GetPostDestroyArgument(const Derived *obj) { + if constexpr (requires { { obj->GetPostDestroyArgument() } -> std::same_as; }) { + return obj->GetPostDestroyArgument(); + } else { + return 0; + } + } public: constexpr explicit KAutoObjectWithSlabHeapAndContainer(util::ConstantInitializeTag) : Base(util::ConstantInitialize) { /* ... */ } explicit KAutoObjectWithSlabHeapAndContainer() { /* ... */ } - virtual void Destroy() override { - const bool is_initialized = this->IsInitialized(); - uintptr_t arg = 0; - if (is_initialized) { + /* NOTE: IsInitialized() and GetPostDestroyArgument() are virtual functions declared in this class, */ + /* in Nintendo's kernel. We fully devirtualize them, as Destroy() is the only user of them. */ + /* We also devirtualize KAutoObject::Finalize(), which is only used by this function in Nintendo's kernel. */ + virtual void Destroy() override final { + Derived * const derived = static_cast(this); + + if (IsInitialized(derived)) { s_container.Unregister(this); - arg = this->GetPostDestroyArgument(); - this->Finalize(); - } - Free(static_cast(this)); - if (is_initialized) { + const uintptr_t arg = GetPostDestroyArgument(derived); + derived->Finalize(); + Free(derived); Derived::PostDestroy(arg); + } else { + Free(derived); } } - virtual bool IsInitialized() const { return true; } - virtual uintptr_t GetPostDestroyArgument() const { return 0; } - size_t GetSlabIndex() const { return s_slab_heap.GetObjectIndex(static_cast(this)); } diff --git a/libraries/libmesosphere/source/kern_k_code_memory.cpp b/libraries/libmesosphere/source/kern_k_code_memory.cpp index bc58919cd..d4a7494c3 100644 --- a/libraries/libmesosphere/source/kern_k_code_memory.cpp +++ b/libraries/libmesosphere/source/kern_k_code_memory.cpp @@ -67,9 +67,6 @@ namespace ams::kern { /* Close our reference to our owner. */ m_owner->Close(); - - /* Perform inherited finalization. */ - KAutoObjectWithSlabHeapAndContainer::Finalize(); } Result KCodeMemory::Map(KProcessAddress address, size_t size) { diff --git a/libraries/libmesosphere/source/kern_k_device_address_space.cpp b/libraries/libmesosphere/source/kern_k_device_address_space.cpp index 78c677501..50ca490b5 100644 --- a/libraries/libmesosphere/source/kern_k_device_address_space.cpp +++ b/libraries/libmesosphere/source/kern_k_device_address_space.cpp @@ -43,9 +43,6 @@ namespace ams::kern { /* Finalize the table. */ m_table.Finalize(); - - /* Finalize base. */ - KAutoObjectWithSlabHeapAndContainer::Finalize(); } Result KDeviceAddressSpace::Attach(ams::svc::DeviceName device_name) { diff --git a/libraries/libmesosphere/source/kern_k_event.cpp b/libraries/libmesosphere/source/kern_k_event.cpp index f2e37d113..ccb3eee0c 100644 --- a/libraries/libmesosphere/source/kern_k_event.cpp +++ b/libraries/libmesosphere/source/kern_k_event.cpp @@ -36,8 +36,6 @@ namespace ams::kern { void KEvent::Finalize() { MESOSPHERE_ASSERT_THIS(); - - KAutoObjectWithSlabHeapAndContainer::Finalize(); } Result KEvent::Signal() { diff --git a/libraries/libmesosphere/source/kern_k_interrupt_event.cpp b/libraries/libmesosphere/source/kern_k_interrupt_event.cpp index b28edf340..56caafd9d 100644 --- a/libraries/libmesosphere/source/kern_k_interrupt_event.cpp +++ b/libraries/libmesosphere/source/kern_k_interrupt_event.cpp @@ -54,7 +54,7 @@ namespace ams::kern { g_interrupt_event_task_table[m_interrupt_id]->Unregister(m_interrupt_id, m_core_id); /* Perform inherited finalization. */ - KAutoObjectWithSlabHeapAndContainer::Finalize(); + KReadableEvent::Finalize(); } Result KInterruptEvent::Reset() { diff --git a/libraries/libmesosphere/source/kern_k_process.cpp b/libraries/libmesosphere/source/kern_k_process.cpp index 72e8b9867..9ddf09835 100644 --- a/libraries/libmesosphere/source/kern_k_process.cpp +++ b/libraries/libmesosphere/source/kern_k_process.cpp @@ -183,7 +183,7 @@ namespace ams::kern { MESOSPHERE_LOG("KProcess::Finalize() pid=%ld name=%-12s\n", m_process_id, m_name); /* Perform inherited finalization. */ - KAutoObjectWithSlabHeapAndContainer::Finalize(); + KSynchronizationObject::Finalize(); } Result KProcess::Initialize(const ams::svc::CreateProcessParameter ¶ms) { diff --git a/libraries/libmesosphere/source/kern_k_shared_memory.cpp b/libraries/libmesosphere/source/kern_k_shared_memory.cpp index 4733db760..e828f2f10 100644 --- a/libraries/libmesosphere/source/kern_k_shared_memory.cpp +++ b/libraries/libmesosphere/source/kern_k_shared_memory.cpp @@ -71,9 +71,6 @@ namespace ams::kern { /* Release the memory reservation. */ m_resource_limit->Release(ams::svc::LimitableResource_PhysicalMemoryMax, size); m_resource_limit->Close(); - - /* Perform inherited finalization. */ - KAutoObjectWithSlabHeapAndContainer::Finalize(); } Result KSharedMemory::Map(KProcessPageTable *table, KProcessAddress address, size_t size, KProcess *process, ams::svc::MemoryPermission map_perm) { diff --git a/libraries/libmesosphere/source/kern_k_synchronization_object.cpp b/libraries/libmesosphere/source/kern_k_synchronization_object.cpp index 3bb728079..68b747771 100644 --- a/libraries/libmesosphere/source/kern_k_synchronization_object.cpp +++ b/libraries/libmesosphere/source/kern_k_synchronization_object.cpp @@ -84,7 +84,6 @@ namespace ams::kern { #endif this->OnFinalizeSynchronizationObject(); - KAutoObject::Finalize(); } Result KSynchronizationObject::Wait(s32 *out_index, KSynchronizationObject **objects, const s32 num_objects, s64 timeout) { diff --git a/libraries/libmesosphere/source/kern_k_thread.cpp b/libraries/libmesosphere/source/kern_k_thread.cpp index 122852731..303b2268a 100644 --- a/libraries/libmesosphere/source/kern_k_thread.cpp +++ b/libraries/libmesosphere/source/kern_k_thread.cpp @@ -338,7 +338,7 @@ namespace ams::kern { } /* Perform inherited finalization. */ - KAutoObjectWithSlabHeapAndContainer::Finalize(); + KSynchronizationObject::Finalize(); } bool KThread::IsSignaled() const { diff --git a/libraries/libmesosphere/source/kern_k_transfer_memory.cpp b/libraries/libmesosphere/source/kern_k_transfer_memory.cpp index f63f18a15..caf2b53ac 100644 --- a/libraries/libmesosphere/source/kern_k_transfer_memory.cpp +++ b/libraries/libmesosphere/source/kern_k_transfer_memory.cpp @@ -56,9 +56,6 @@ namespace ams::kern { /* Close the page group. */ GetReference(m_page_group).Close(); GetReference(m_page_group).Finalize(); - - /* Perform inherited finalization. */ - KAutoObjectWithSlabHeapAndContainer::Finalize(); } void KTransferMemory::PostDestroy(uintptr_t arg) {