diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 639c2d0e0d..90f128bfa9 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -1,6 +1,3 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project -// SPDX-License-Identifier: GPL-3.0-or-later - // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -34,6 +31,12 @@ #ifdef _MSC_VER # define locale_t _locale_t // Locale Cross-Compatibility +#define LTO_NOINLINE __attribute__((noinline)) + +#else // _MSC_VER + +#define LTO_NOINLINE + #endif // _MSC_VER #define DECLARE_ENUM_FLAG_OPERATORS(type) \ diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 6986a98e35..d6e113d039 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -356,7 +356,7 @@ struct KernelCore::Impl { } /// Sets the host thread ID for the caller. - u32 SetHostThreadId(std::size_t core_id) { + LTO_NOINLINE u32 SetHostThreadId(std::size_t core_id) { // This should only be called during core init. ASSERT(tls_data.host_thread_id == UINT8_MAX); @@ -367,12 +367,12 @@ struct KernelCore::Impl { } /// Gets the host thread ID for the caller - u32 GetHostThreadId() const { + LTO_NOINLINE u32 GetHostThreadId() const { return tls_data.host_thread_id; } // Gets the dummy KThread for the caller, allocating a new one if this is the first time - KThread* GetHostDummyThread(KThread* existing_thread) { + LTO_NOINLINE KThread* GetHostDummyThread(KThread* existing_thread) { if (tls_data.thread == nullptr) { auto const initialize{[](KThread* thread) { ASSERT(KThread::InitializeDummyThread(thread, nullptr).IsSuccess()); @@ -406,10 +406,10 @@ struct KernelCore::Impl { } // Forces singlecore - bool IsPhantomModeForSingleCore() const { + LTO_NOINLINE bool IsPhantomModeForSingleCore() const { return tls_data.is_phantom_mode_for_singlecore; } - void SetIsPhantomModeForSingleCore(bool value) { + LTO_NOINLINE void SetIsPhantomModeForSingleCore(bool value) { ASSERT(!is_multicore); tls_data.is_phantom_mode_for_singlecore = value; } @@ -418,13 +418,13 @@ struct KernelCore::Impl { return is_shutting_down.load(std::memory_order_relaxed); } - KThread* GetCurrentEmuThread() { + LTO_NOINLINE KThread* GetCurrentEmuThread() { if (!tls_data.current_thread) tls_data.current_thread = GetHostDummyThread(nullptr); return tls_data.current_thread; } - void SetCurrentEmuThread(KThread* thread) { + LTO_NOINLINE void SetCurrentEmuThread(KThread* thread) { tls_data.current_thread = thread; }