citra-emu
/
citra-canary
Archived
1
0
Fork 0

Explicitly instantiate constructors/destructors for Kernel objects

This should speed up compile times a bit, as well as enable more liberal
use of forward declarations. (Due to SharedPtr not trying to emit the
destructor anymore.)
This commit is contained in:
Yuri Kunde Schlesner 2015-01-31 22:56:59 -02:00
parent 12232e0b08
commit 7725256f64
17 changed files with 51 additions and 8 deletions

View File

@ -26,6 +26,7 @@ set(SRCS
hle/kernel/kernel.cpp hle/kernel/kernel.cpp
hle/kernel/mutex.cpp hle/kernel/mutex.cpp
hle/kernel/semaphore.cpp hle/kernel/semaphore.cpp
hle/kernel/session.cpp
hle/kernel/shared_memory.cpp hle/kernel/shared_memory.cpp
hle/kernel/timer.cpp hle/kernel/timer.cpp
hle/kernel/thread.cpp hle/kernel/thread.cpp

View File

@ -15,6 +15,9 @@
namespace Kernel { namespace Kernel {
AddressArbiter::AddressArbiter() {}
AddressArbiter::~AddressArbiter() {}
ResultVal<SharedPtr<AddressArbiter>> AddressArbiter::Create(std::string name) { ResultVal<SharedPtr<AddressArbiter>> AddressArbiter::Create(std::string name) {
SharedPtr<AddressArbiter> address_arbiter(new AddressArbiter); SharedPtr<AddressArbiter> address_arbiter(new AddressArbiter);
// TOOD(yuriks): Don't create Handle (see Thread::Create()) // TOOD(yuriks): Don't create Handle (see Thread::Create())

View File

@ -47,7 +47,8 @@ public:
ResultCode ArbitrateAddress(ArbitrationType type, VAddr address, s32 value, u64 nanoseconds); ResultCode ArbitrateAddress(ArbitrationType type, VAddr address, s32 value, u64 nanoseconds);
private: private:
AddressArbiter() = default; AddressArbiter();
~AddressArbiter() override;
}; };
} // namespace FileSys } // namespace FileSys

View File

@ -14,6 +14,9 @@
namespace Kernel { namespace Kernel {
Event::Event() {}
Event::~Event() {}
ResultVal<SharedPtr<Event>> Event::Create(ResetType reset_type, std::string name) { ResultVal<SharedPtr<Event>> Event::Create(ResetType reset_type, std::string name) {
SharedPtr<Event> evt(new Event); SharedPtr<Event> evt(new Event);
// TOOD(yuriks): Don't create Handle (see Thread::Create()) // TOOD(yuriks): Don't create Handle (see Thread::Create())

View File

@ -39,7 +39,8 @@ public:
void Clear(); void Clear();
private: private:
Event() = default; Event();
~Event() override;
}; };
} // namespace } // namespace

View File

@ -38,6 +38,9 @@ void ReleaseThreadMutexes(Thread* thread) {
thread->held_mutexes.clear(); thread->held_mutexes.clear();
} }
Mutex::Mutex() {}
Mutex::~Mutex() {}
ResultVal<SharedPtr<Mutex>> Mutex::Create(bool initial_locked, std::string name) { ResultVal<SharedPtr<Mutex>> Mutex::Create(bool initial_locked, std::string name) {
SharedPtr<Mutex> mutex(new Mutex); SharedPtr<Mutex> mutex(new Mutex);
// TOOD(yuriks): Don't create Handle (see Thread::Create()) // TOOD(yuriks): Don't create Handle (see Thread::Create())

View File

@ -47,7 +47,8 @@ public:
void Release(); void Release();
private: private:
Mutex() = default; Mutex();
~Mutex() override;
}; };
/** /**

View File

@ -10,6 +10,9 @@
namespace Kernel { namespace Kernel {
Semaphore::Semaphore() {}
Semaphore::~Semaphore() {}
ResultVal<SharedPtr<Semaphore>> Semaphore::Create(s32 initial_count, s32 max_count, ResultVal<SharedPtr<Semaphore>> Semaphore::Create(s32 initial_count, s32 max_count,
std::string name) { std::string name) {

View File

@ -47,7 +47,8 @@ public:
ResultVal<s32> Release(s32 release_count); ResultVal<s32> Release(s32 release_count);
private: private:
Semaphore() = default; Semaphore();
~Semaphore() override;
}; };
} // namespace } // namespace

View File

@ -0,0 +1,13 @@
// Copyright 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/kernel/session.h"
#include "core/hle/kernel/thread.h"
namespace Kernel {
Session::Session() {}
Session::~Session() {}
}

View File

@ -5,6 +5,7 @@
#pragma once #pragma once
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/mem_map.h"
namespace Kernel { namespace Kernel {
@ -43,6 +44,9 @@ inline static u32* GetCommandBuffer(const int offset=0) {
*/ */
class Session : public WaitObject { class Session : public WaitObject {
public: public:
Session();
~Session() override;
std::string GetTypeName() const override { return "Session"; } std::string GetTypeName() const override { return "Session"; }
static const HandleType HANDLE_TYPE = HandleType::Session; static const HandleType HANDLE_TYPE = HandleType::Session;

View File

@ -9,6 +9,9 @@
namespace Kernel { namespace Kernel {
SharedMemory::SharedMemory() {}
SharedMemory::~SharedMemory() {}
ResultVal<SharedPtr<SharedMemory>> SharedMemory::Create(std::string name) { ResultVal<SharedPtr<SharedMemory>> SharedMemory::Create(std::string name) {
SharedPtr<SharedMemory> shared_memory(new SharedMemory); SharedPtr<SharedMemory> shared_memory(new SharedMemory);

View File

@ -57,7 +57,8 @@ public:
std::string name; ///< Name of shared memory object (optional) std::string name; ///< Name of shared memory object (optional)
private: private:
SharedMemory() = default; SharedMemory();
~SharedMemory() override;
}; };
} // namespace } // namespace

View File

@ -40,8 +40,8 @@ static Thread* current_thread;
static const u32 INITIAL_THREAD_ID = 1; ///< The first available thread id at startup static const u32 INITIAL_THREAD_ID = 1; ///< The first available thread id at startup
static u32 next_thread_id; ///< The next available thread id static u32 next_thread_id; ///< The next available thread id
Thread::Thread() { Thread::Thread() {}
} Thread::~Thread() {}
Thread* GetCurrentThread() { Thread* GetCurrentThread() {
return current_thread; return current_thread;

View File

@ -128,6 +128,7 @@ public:
private: private:
Thread(); Thread();
~Thread() override;
/// Handle used as userdata to reference this object when inserting into the CoreTiming queue. /// Handle used as userdata to reference this object when inserting into the CoreTiming queue.
Handle callback_handle; Handle callback_handle;

View File

@ -17,6 +17,9 @@ static int timer_callback_event_type = -1;
// us to simply use a pool index or similar. // us to simply use a pool index or similar.
static Kernel::HandleTable timer_callback_handle_table; static Kernel::HandleTable timer_callback_handle_table;
Timer::Timer() {}
Timer::~Timer() {}
ResultVal<SharedPtr<Timer>> Timer::Create(ResetType reset_type, std::string name) { ResultVal<SharedPtr<Timer>> Timer::Create(ResetType reset_type, std::string name) {
SharedPtr<Timer> timer(new Timer); SharedPtr<Timer> timer(new Timer);
// TOOD(yuriks): Don't create Handle (see Thread::Create()) // TOOD(yuriks): Don't create Handle (see Thread::Create())

View File

@ -49,7 +49,8 @@ public:
void Clear(); void Clear();
private: private:
Timer() = default; Timer();
~Timer() override;
/// Handle used as userdata to reference this object when inserting into the CoreTiming queue. /// Handle used as userdata to reference this object when inserting into the CoreTiming queue.
Handle callback_handle; Handle callback_handle;