kern: KAutoObject doesn't need (virtual) destructor

This commit is contained in:
Michael Scire 2021-09-17 15:08:13 -07:00
parent a5aed96b80
commit 53aa04303a
29 changed files with 7 additions and 43 deletions

View file

@ -31,7 +31,6 @@ namespace ams::kern::arch::arm64 {
MESOSPHERE_AUTOOBJECT_TRAITS(KDebug, KSynchronizationObject); MESOSPHERE_AUTOOBJECT_TRAITS(KDebug, KSynchronizationObject);
public: public:
explicit KDebug() { /* ... */ } explicit KDebug() { /* ... */ }
virtual ~KDebug() { /* ... */ }
static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ }
public: public:

View file

@ -30,8 +30,6 @@ namespace ams::kern {
/* ... */ /* ... */
} }
virtual ~KAlpha() { /* ... */ }
/* virtual void Finalize() override; */ /* virtual void Finalize() override; */
virtual bool IsInitialized() const override { return false /* TODO */; } virtual bool IsInitialized() const override { return false /* TODO */; }

View file

@ -75,7 +75,6 @@ namespace ams::kern {
static KAutoObject *Create(KAutoObject *ptr); static KAutoObject *Create(KAutoObject *ptr);
public: public:
constexpr ALWAYS_INLINE explicit KAutoObject() : m_next_closed_object(nullptr), m_ref_count(0) { MESOSPHERE_ASSERT_THIS(); } constexpr ALWAYS_INLINE explicit KAutoObject() : m_next_closed_object(nullptr), m_ref_count(0) { MESOSPHERE_ASSERT_THIS(); }
virtual ~KAutoObject() { MESOSPHERE_ASSERT_THIS(); }
/* Destroy is responsible for destroying the auto object's resources when ref_count hits zero. */ /* Destroy is responsible for destroying the auto object's resources when ref_count hits zero. */
virtual void Destroy() { MESOSPHERE_ASSERT_THIS(); } virtual void Destroy() { MESOSPHERE_ASSERT_THIS(); }
@ -139,8 +138,10 @@ namespace ams::kern {
private: private:
friend class KAutoObjectWithListContainer; friend class KAutoObjectWithListContainer;
private: private:
util::IntrusiveRedBlackTreeNode list_node; util::IntrusiveRedBlackTreeNode m_list_node;
public: public:
constexpr ALWAYS_INLINE KAutoObjectWithList() : m_list_node() { /* ... */ }
static ALWAYS_INLINE int Compare(const KAutoObjectWithList &lhs, const KAutoObjectWithList &rhs) { static ALWAYS_INLINE int Compare(const KAutoObjectWithList &lhs, const KAutoObjectWithList &rhs) {
const u64 lid = lhs.GetId(); const u64 lid = lhs.GetId();
const u64 rid = rhs.GetId(); const u64 rid = rhs.GetId();

View file

@ -24,7 +24,7 @@ namespace ams::kern {
NON_COPYABLE(KAutoObjectWithListContainer); NON_COPYABLE(KAutoObjectWithListContainer);
NON_MOVEABLE(KAutoObjectWithListContainer); NON_MOVEABLE(KAutoObjectWithListContainer);
public: public:
using ListType = util::IntrusiveRedBlackTreeMemberTraits<&KAutoObjectWithList::list_node>::TreeType<KAutoObjectWithList>; using ListType = util::IntrusiveRedBlackTreeMemberTraits<&KAutoObjectWithList::m_list_node>::TreeType<KAutoObjectWithList>;
public: public:
class ListAccessor : public KScopedLightLock { class ListAccessor : public KScopedLightLock {
private: private:

View file

@ -37,8 +37,6 @@ namespace ams::kern {
/* ... */ /* ... */
} }
virtual ~KBeta() { /* ... */ }
/* virtual void Finalize() override; */ /* virtual void Finalize() override; */
virtual bool IsInitialized() const override { return false /* TODO */; } virtual bool IsInitialized() const override { return false /* TODO */; }

View file

@ -34,7 +34,6 @@ namespace ams::kern {
KPort *m_parent; KPort *m_parent;
public: public:
constexpr KClientPort() : m_num_sessions(), m_peak_sessions(), m_max_sessions(), m_parent() { /* ... */ } constexpr KClientPort() : m_num_sessions(), m_peak_sessions(), m_max_sessions(), m_parent() { /* ... */ }
virtual ~KClientPort() { /* ... */ }
void Initialize(KPort *parent, s32 max_sessions); void Initialize(KPort *parent, s32 max_sessions);
void OnSessionFinalized(); void OnSessionFinalized();

View file

@ -21,13 +21,12 @@ namespace ams::kern {
class KSession; class KSession;
class KClientSession final : public KAutoObjectWithSlabHeapAndContainer<KClientSession, KAutoObjectWithList> { class KClientSession final : public KAutoObject {
MESOSPHERE_AUTOOBJECT_TRAITS(KClientSession, KAutoObject); MESOSPHERE_AUTOOBJECT_TRAITS(KClientSession, KAutoObject);
private: private:
KSession *m_parent; KSession *m_parent;
public: public:
constexpr KClientSession() : m_parent() { /* ... */ } constexpr KClientSession() : m_parent() { /* ... */ }
virtual ~KClientSession() { /* ... */ }
void Initialize(KSession *parent) { void Initialize(KSession *parent) {
/* Set member variables. */ /* Set member variables. */

View file

@ -35,8 +35,6 @@ namespace ams::kern {
/* ... */ /* ... */
} }
virtual ~KCodeMemory() { /* ... */ }
Result Initialize(KProcessAddress address, size_t size); Result Initialize(KProcessAddress address, size_t size);
virtual void Finalize() override; virtual void Finalize() override;

View file

@ -33,7 +33,6 @@ namespace ams::kern {
KProcess::State m_old_process_state; KProcess::State m_old_process_state;
public: public:
explicit KDebugBase() { /* ... */ } explicit KDebugBase() { /* ... */ }
virtual ~KDebugBase() { /* ... */ }
protected: protected:
bool Is64Bit() const; bool Is64Bit() const;
public: public:

View file

@ -31,7 +31,6 @@ namespace ams::kern {
bool m_is_initialized; bool m_is_initialized;
public: public:
constexpr KDeviceAddressSpace() : m_lock(), m_table(), m_space_address(), m_space_size(), m_is_initialized() { /* ... */ } constexpr KDeviceAddressSpace() : m_lock(), m_table(), m_space_address(), m_space_size(), m_is_initialized() { /* ... */ }
virtual ~KDeviceAddressSpace() { /* ... */ }
Result Initialize(u64 address, u64 size); Result Initialize(u64 address, u64 size);
virtual void Finalize() override; virtual void Finalize() override;

View file

@ -36,8 +36,6 @@ namespace ams::kern {
/* ... */ /* ... */
} }
virtual ~KEvent() { /* ... */ }
void Initialize(); void Initialize();
virtual void Finalize() override; virtual void Finalize() override;

View file

@ -32,7 +32,6 @@ namespace ams::kern {
bool m_is_initialized; bool m_is_initialized;
public: public:
constexpr KInterruptEvent() : m_interrupt_id(-1), m_core_id(-1), m_is_initialized(false) { /* ... */ } constexpr KInterruptEvent() : m_interrupt_id(-1), m_core_id(-1), m_is_initialized(false) { /* ... */ }
virtual ~KInterruptEvent() { /* ... */ }
Result Initialize(int32_t interrupt_name, ams::svc::InterruptType type); Result Initialize(int32_t interrupt_name, ams::svc::InterruptType type);
virtual void Finalize() override; virtual void Finalize() override;

View file

@ -21,13 +21,12 @@ namespace ams::kern {
class KLightSession; class KLightSession;
class KLightClientSession final : public KAutoObjectWithSlabHeapAndContainer<KLightClientSession, KAutoObjectWithList> { class KLightClientSession final : public KAutoObject {
MESOSPHERE_AUTOOBJECT_TRAITS(KLightClientSession, KAutoObject); MESOSPHERE_AUTOOBJECT_TRAITS(KLightClientSession, KAutoObject);
private: private:
KLightSession *m_parent; KLightSession *m_parent;
public: public:
constexpr KLightClientSession() : m_parent() { /* ... */ } constexpr KLightClientSession() : m_parent() { /* ... */ }
virtual ~KLightClientSession() { /* ... */ }
void Initialize(KLightSession *parent) { void Initialize(KLightSession *parent) {
/* Set member variables. */ /* Set member variables. */

View file

@ -23,7 +23,7 @@ namespace ams::kern {
class KLightSession; class KLightSession;
class KLightServerSession final : public KAutoObjectWithSlabHeapAndContainer<KLightServerSession, KAutoObjectWithList>, public util::IntrusiveListBaseNode<KLightServerSession> { class KLightServerSession final : public KAutoObject, public util::IntrusiveListBaseNode<KLightServerSession> {
MESOSPHERE_AUTOOBJECT_TRAITS(KLightServerSession, KAutoObject); MESOSPHERE_AUTOOBJECT_TRAITS(KLightServerSession, KAutoObject);
private: private:
KLightSession *m_parent; KLightSession *m_parent;
@ -33,7 +33,6 @@ namespace ams::kern {
KThread *m_server_thread; KThread *m_server_thread;
public: public:
constexpr KLightServerSession() : m_parent(), m_request_queue(), m_server_queue(), m_current_request(), m_server_thread() { /* ... */ } constexpr KLightServerSession() : m_parent(), m_request_queue(), m_server_queue(), m_current_request(), m_server_thread() { /* ... */ }
virtual ~KLightServerSession() { /* ... */ }
void Initialize(KLightSession *parent) { void Initialize(KLightSession *parent) {
/* Set member variables. */ /* Set member variables. */

View file

@ -52,8 +52,6 @@ namespace ams::kern {
/* ... */ /* ... */
} }
virtual ~KLightSession() { /* ... */ }
void Initialize(KClientPort *client_port, uintptr_t name); void Initialize(KClientPort *client_port, uintptr_t name);
virtual void Finalize() override; virtual void Finalize() override;

View file

@ -42,7 +42,6 @@ namespace ams::kern {
bool m_is_light; bool m_is_light;
public: public:
constexpr KPort() : m_server(), m_client(), m_name(), m_state(State::Invalid), m_is_light() { /* ... */ } constexpr KPort() : m_server(), m_client(), m_name(), m_state(State::Invalid), m_is_light() { /* ... */ }
virtual ~KPort() { /* ... */ }
static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ }

View file

@ -143,7 +143,6 @@ namespace ams::kern {
} }
public: public:
KProcess() { /* ... */ } KProcess() { /* ... */ }
virtual ~KProcess() { /* ... */ }
Result Initialize(const ams::svc::CreateProcessParameter &params, const KPageGroup &pg, const u32 *caps, s32 num_caps, KResourceLimit *res_limit, KMemoryManager::Pool pool, bool immortal); Result Initialize(const ams::svc::CreateProcessParameter &params, const KPageGroup &pg, const u32 *caps, s32 num_caps, KResourceLimit *res_limit, KMemoryManager::Pool pool, bool immortal);
Result Initialize(const ams::svc::CreateProcessParameter &params, svc::KUserPointer<const u32 *> caps, s32 num_caps, KResourceLimit *res_limit, KMemoryManager::Pool pool); Result Initialize(const ams::svc::CreateProcessParameter &params, svc::KUserPointer<const u32 *> caps, s32 num_caps, KResourceLimit *res_limit, KMemoryManager::Pool pool);

View file

@ -28,7 +28,6 @@ namespace ams::kern {
KEvent *m_parent; KEvent *m_parent;
public: public:
constexpr explicit KReadableEvent() : KSynchronizationObject(), m_is_signaled(), m_parent() { MESOSPHERE_ASSERT_THIS(); } constexpr explicit KReadableEvent() : KSynchronizationObject(), m_is_signaled(), m_parent() { MESOSPHERE_ASSERT_THIS(); }
virtual ~KReadableEvent() { MESOSPHERE_ASSERT_THIS(); }
constexpr void Initialize(KEvent *parent) { constexpr void Initialize(KEvent *parent) {
MESOSPHERE_ASSERT_THIS(); MESOSPHERE_ASSERT_THIS();

View file

@ -34,7 +34,6 @@ namespace ams::kern {
KLightConditionVariable m_cond_var; KLightConditionVariable m_cond_var;
public: public:
constexpr ALWAYS_INLINE KResourceLimit() : m_limit_values(), m_current_values(), m_current_hints(), m_peak_values(), m_lock(), m_waiter_count(), m_cond_var() { /* ... */ } constexpr ALWAYS_INLINE KResourceLimit() : m_limit_values(), m_current_values(), m_current_hints(), m_peak_values(), m_lock(), m_waiter_count(), m_cond_var() { /* ... */ }
virtual ~KResourceLimit() { /* ... */ }
static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ } static void PostDestroy(uintptr_t arg) { MESOSPHERE_UNUSED(arg); /* ... */ }

View file

@ -35,7 +35,6 @@ namespace ams::kern {
KPort *m_parent; KPort *m_parent;
public: public:
constexpr KServerPort() : m_session_list(), m_light_session_list(), m_parent() { /* ... */ } constexpr KServerPort() : m_session_list(), m_light_session_list(), m_parent() { /* ... */ }
virtual ~KServerPort() { /* ... */ }
void Initialize(KPort *parent); void Initialize(KPort *parent);
void EnqueueSession(KServerSession *session); void EnqueueSession(KServerSession *session);

View file

@ -34,7 +34,6 @@ namespace ams::kern {
KLightLock m_lock; KLightLock m_lock;
public: public:
constexpr KServerSession() : m_parent(), m_request_list(), m_current_request(), m_lock() { /* ... */ } constexpr KServerSession() : m_parent(), m_request_list(), m_current_request(), m_lock() { /* ... */ }
virtual ~KServerSession() { /* ... */ }
virtual void Destroy() override; virtual void Destroy() override;

View file

@ -57,8 +57,6 @@ namespace ams::kern {
/* ... */ /* ... */
} }
virtual ~KSession() { /* ... */ }
void Initialize(KClientPort *client_port, uintptr_t name); void Initialize(KClientPort *client_port, uintptr_t name);
virtual void Finalize() override; virtual void Finalize() override;

View file

@ -131,7 +131,6 @@ namespace ams::kern {
size_t m_size; size_t m_size;
public: public:
constexpr KSessionRequest() : m_mappings(), m_thread(), m_server(), m_event(), m_address(), m_size() { /* ... */ } constexpr KSessionRequest() : m_mappings(), m_thread(), m_server(), m_event(), m_address(), m_size() { /* ... */ }
virtual ~KSessionRequest() { /* ... */ }
static KSessionRequest *Create() { static KSessionRequest *Create() {
KSessionRequest *req = KSessionRequest::Allocate(); KSessionRequest *req = KSessionRequest::Allocate();

View file

@ -41,8 +41,6 @@ namespace ams::kern {
/* ... */ /* ... */
} }
virtual ~KSharedMemory() { /* ... */ }
Result Initialize(KProcess *owner, size_t size, ams::svc::MemoryPermission own_perm, ams::svc::MemoryPermission rem_perm); Result Initialize(KProcess *owner, size_t size, ams::svc::MemoryPermission own_perm, ams::svc::MemoryPermission rem_perm);
virtual void Finalize() override; virtual void Finalize() override;

View file

@ -33,7 +33,6 @@ namespace ams::kern {
ThreadListNode *m_thread_list_tail; ThreadListNode *m_thread_list_tail;
protected: protected:
constexpr ALWAYS_INLINE explicit KSynchronizationObject() : KAutoObjectWithList(), m_thread_list_head(), m_thread_list_tail() { MESOSPHERE_ASSERT_THIS(); } constexpr ALWAYS_INLINE explicit KSynchronizationObject() : KAutoObjectWithList(), m_thread_list_head(), m_thread_list_tail() { MESOSPHERE_ASSERT_THIS(); }
virtual ~KSynchronizationObject() { MESOSPHERE_ASSERT_THIS(); }
virtual void OnFinalizeSynchronizationObject() { MESOSPHERE_ASSERT_THIS(); } virtual void OnFinalizeSynchronizationObject() { MESOSPHERE_ASSERT_THIS(); }

View file

@ -239,10 +239,7 @@ namespace ams::kern {
public: public:
constexpr KThread() : m_wait_result(svc::ResultNoSynchronizationObject()), m_debug_exception_result(ResultSuccess()) { /* ... */ } constexpr KThread() : m_wait_result(svc::ResultNoSynchronizationObject()), m_debug_exception_result(ResultSuccess()) { /* ... */ }
virtual ~KThread() { /* ... */ }
Result Initialize(KThreadFunction func, uintptr_t arg, void *kern_stack_top, KProcessAddress user_stack_top, s32 prio, s32 virt_core, KProcess *owner, ThreadType type); Result Initialize(KThreadFunction func, uintptr_t arg, void *kern_stack_top, KProcessAddress user_stack_top, s32 prio, s32 virt_core, KProcess *owner, ThreadType type);
private: private:
static Result InitializeThread(KThread *thread, KThreadFunction func, uintptr_t arg, KProcessAddress user_stack_top, s32 prio, s32 virt_core, KProcess *owner, ThreadType type); static Result InitializeThread(KThread *thread, KThreadFunction func, uintptr_t arg, KProcessAddress user_stack_top, s32 prio, s32 virt_core, KProcess *owner, ThreadType type);
public: public:

View file

@ -35,8 +35,6 @@ namespace ams::kern {
/* ... */ /* ... */
} }
virtual ~KTransferMemory() { /* ... */ }
Result Initialize(KProcessAddress addr, size_t size, ams::svc::MemoryPermission own_perm); Result Initialize(KProcessAddress addr, size_t size, ams::svc::MemoryPermission own_perm);
virtual void Finalize() override; virtual void Finalize() override;

View file

@ -28,7 +28,6 @@ namespace ams::kern {
KEvent *m_parent; KEvent *m_parent;
public: public:
constexpr explicit KWritableEvent() : m_parent(nullptr) { /* ... */ } constexpr explicit KWritableEvent() : m_parent(nullptr) { /* ... */ }
virtual ~KWritableEvent() { /* ... */ }
virtual void Destroy() override; virtual void Destroy() override;

View file

@ -74,7 +74,6 @@ namespace ams::kern {
}; };
public: public:
constexpr KAutoObjectWithSlabHeapAndContainer() : Base() { /* ... */ } constexpr KAutoObjectWithSlabHeapAndContainer() : Base() { /* ... */ }
virtual ~KAutoObjectWithSlabHeapAndContainer() { /* ... */ }
virtual void Destroy() override { virtual void Destroy() override {
const bool is_initialized = this->IsInitialized(); const bool is_initialized = this->IsInitialized();