Browse Source

[common, hle/kernel] Remove LTO_NOINLINE and remove redundant usage of TLS

Signed-off-by: lizzie <lizzie@eden-emu.dev>
pull/2908/head
lizzie 3 months ago
parent
commit
5934f652a5
No known key found for this signature in database GPG Key ID: 287378CADCAB13
  1. 4
      src/common/common_funcs.h
  2. 20
      src/core/hle/kernel/kernel.cpp

4
src/common/common_funcs.h

@ -39,12 +39,8 @@
#define Crash() exit(1)
#endif
#define LTO_NOINLINE __attribute__((noinline))
#else // _MSC_VER
#define LTO_NOINLINE
// Locale Cross-Compatibility
#define locale_t _locale_t

20
src/core/hle/kernel/kernel.cpp

@ -359,7 +359,7 @@ struct KernelCore::Impl {
static inline thread_local u8 host_thread_id = UINT8_MAX;
/// Sets the host thread ID for the caller.
LTO_NOINLINE u32 SetHostThreadId(std::size_t core_id) {
u32 SetHostThreadId(std::size_t core_id) {
// This should only be called during core init.
ASSERT(host_thread_id == UINT8_MAX);
@ -370,19 +370,19 @@ struct KernelCore::Impl {
}
/// Gets the host thread ID for the caller
LTO_NOINLINE u32 GetHostThreadId() const {
u32 GetHostThreadId() const {
return host_thread_id;
}
// Gets the dummy KThread for the caller, allocating a new one if this is the first time
LTO_NOINLINE KThread* GetHostDummyThread(KThread* existing_thread) {
const auto initialize{[](KThread* thread) LTO_NOINLINE {
KThread* GetHostDummyThread(KThread* existing_thread) {
const auto initialize{[](KThread* thread) {
ASSERT(KThread::InitializeDummyThread(thread, nullptr).IsSuccess());
return thread;
}};
thread_local KThread raw_thread{system.Kernel()};
thread_local KThread* thread = existing_thread ? existing_thread : initialize(&raw_thread);
KThread raw_thread{system.Kernel()};
KThread* thread = existing_thread ? existing_thread : initialize(&raw_thread);
return thread;
}
@ -410,11 +410,11 @@ struct KernelCore::Impl {
static inline thread_local bool is_phantom_mode_for_singlecore{false};
LTO_NOINLINE bool IsPhantomModeForSingleCore() const {
bool IsPhantomModeForSingleCore() const {
return is_phantom_mode_for_singlecore;
}
LTO_NOINLINE void SetIsPhantomModeForSingleCore(bool value) {
void SetIsPhantomModeForSingleCore(bool value) {
ASSERT(!is_multicore);
is_phantom_mode_for_singlecore = value;
}
@ -425,14 +425,14 @@ struct KernelCore::Impl {
static inline thread_local KThread* current_thread{nullptr};
LTO_NOINLINE KThread* GetCurrentEmuThread() {
KThread* GetCurrentEmuThread() {
if (!current_thread) {
current_thread = GetHostDummyThread(nullptr);
}
return current_thread;
}
LTO_NOINLINE void SetCurrentEmuThread(KThread* thread) {
void SetCurrentEmuThread(KThread* thread) {
current_thread = thread;
}

Loading…
Cancel
Save