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.)
master
Yuri Kunde Schlesner 2015-01-31 22:56:59 +07:00
parent 12232e0b08
commit 7725256f64
17 changed files with 51 additions and 8 deletions

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

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

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

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

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

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

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

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

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

@ -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() {}
}

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

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

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

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

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

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

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