From cc7d88d4a9bdbc3a47b9ab349874a9d1952d28a0 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 6 Mar 2025 09:08:00 +0100 Subject: [PATCH] Fix `Platform::`GetCacheLineSize` to be deprecated in favor of existing `CPUInfo.CacheLineSize` --- Source/Engine/Platform/Android/AndroidPlatform.cpp | 5 ----- Source/Engine/Platform/Android/AndroidPlatform.h | 1 - Source/Engine/Platform/Apple/ApplePlatform.cpp | 5 ----- Source/Engine/Platform/Apple/ApplePlatform.h | 1 - Source/Engine/Platform/Base/PlatformBase.cpp | 5 +++++ Source/Engine/Platform/Base/PlatformBase.h | 3 ++- Source/Engine/Platform/Linux/LinuxPlatform.cpp | 5 ----- Source/Engine/Platform/Linux/LinuxPlatform.h | 1 - Source/Engine/Platform/Win32/Win32Platform.cpp | 5 ----- Source/Engine/Platform/Win32/Win32Platform.h | 1 - 10 files changed, 7 insertions(+), 25 deletions(-) diff --git a/Source/Engine/Platform/Android/AndroidPlatform.cpp b/Source/Engine/Platform/Android/AndroidPlatform.cpp index 404cf5476..466e72e0c 100644 --- a/Source/Engine/Platform/Android/AndroidPlatform.cpp +++ b/Source/Engine/Platform/Android/AndroidPlatform.cpp @@ -710,11 +710,6 @@ CPUInfo AndroidPlatform::GetCPUInfo() return AndroidCpu; } -int32 AndroidPlatform::GetCacheLineSize() -{ - return AndroidCpu.CacheLineSize; -} - MemoryStats AndroidPlatform::GetMemoryStats() { const uint64 pageSize = getpagesize(); diff --git a/Source/Engine/Platform/Android/AndroidPlatform.h b/Source/Engine/Platform/Android/AndroidPlatform.h index 4d8955627..c300a0f2a 100644 --- a/Source/Engine/Platform/Android/AndroidPlatform.h +++ b/Source/Engine/Platform/Android/AndroidPlatform.h @@ -81,7 +81,6 @@ public: } static bool Is64BitPlatform(); static CPUInfo GetCPUInfo(); - static int32 GetCacheLineSize(); static MemoryStats GetMemoryStats(); static ProcessMemoryStats GetProcessMemoryStats(); static uint64 GetCurrentThreadID() diff --git a/Source/Engine/Platform/Apple/ApplePlatform.cpp b/Source/Engine/Platform/Apple/ApplePlatform.cpp index 4844c41aa..6d9b19296 100644 --- a/Source/Engine/Platform/Apple/ApplePlatform.cpp +++ b/Source/Engine/Platform/Apple/ApplePlatform.cpp @@ -134,11 +134,6 @@ CPUInfo ApplePlatform::GetCPUInfo() return Cpu; } -int32 ApplePlatform::GetCacheLineSize() -{ - return Cpu.CacheLineSize; -} - MemoryStats ApplePlatform::GetMemoryStats() { MemoryStats result; diff --git a/Source/Engine/Platform/Apple/ApplePlatform.h b/Source/Engine/Platform/Apple/ApplePlatform.h index 9f0fddebf..6f16c07e8 100644 --- a/Source/Engine/Platform/Apple/ApplePlatform.h +++ b/Source/Engine/Platform/Apple/ApplePlatform.h @@ -67,7 +67,6 @@ public: } static bool Is64BitPlatform(); static CPUInfo GetCPUInfo(); - static int32 GetCacheLineSize(); static MemoryStats GetMemoryStats(); static ProcessMemoryStats GetProcessMemoryStats(); static uint64 GetCurrentThreadID(); diff --git a/Source/Engine/Platform/Base/PlatformBase.cpp b/Source/Engine/Platform/Base/PlatformBase.cpp index c8de3c6cf..fffffa5d0 100644 --- a/Source/Engine/Platform/Base/PlatformBase.cpp +++ b/Source/Engine/Platform/Base/PlatformBase.cpp @@ -270,6 +270,11 @@ bool PlatformBase::Is64BitApp() #endif } +int32 PlatformBase::GetCacheLineSize() +{ + return Platform::GetCPUInfo().CacheLineSize; +} + void PlatformBase::Fatal(const StringView& msg, void* context, FatalErrorType error) { // Check if is already during fatal state diff --git a/Source/Engine/Platform/Base/PlatformBase.h b/Source/Engine/Platform/Base/PlatformBase.h index 670251d10..f6f56c4b7 100644 --- a/Source/Engine/Platform/Base/PlatformBase.h +++ b/Source/Engine/Platform/Base/PlatformBase.h @@ -380,9 +380,10 @@ public: /// /// Gets the CPU cache line size. + /// [Deprecated in v1.10] /// /// The cache line size. - API_PROPERTY() static int32 GetCacheLineSize() = delete; + API_PROPERTY() DEPRECATED("Use CPUInfo.CacheLineSize instead") static int32 GetCacheLineSize(); /// /// Gets the current memory stats. diff --git a/Source/Engine/Platform/Linux/LinuxPlatform.cpp b/Source/Engine/Platform/Linux/LinuxPlatform.cpp index 8c03fa164..354560c34 100644 --- a/Source/Engine/Platform/Linux/LinuxPlatform.cpp +++ b/Source/Engine/Platform/Linux/LinuxPlatform.cpp @@ -1767,11 +1767,6 @@ CPUInfo LinuxPlatform::GetCPUInfo() return UnixCpu; } -int32 LinuxPlatform::GetCacheLineSize() -{ - return UnixCpu.CacheLineSize; -} - MemoryStats LinuxPlatform::GetMemoryStats() { const uint64 pageSize = getpagesize(); diff --git a/Source/Engine/Platform/Linux/LinuxPlatform.h b/Source/Engine/Platform/Linux/LinuxPlatform.h index 10c81f436..864e27812 100644 --- a/Source/Engine/Platform/Linux/LinuxPlatform.h +++ b/Source/Engine/Platform/Linux/LinuxPlatform.h @@ -95,7 +95,6 @@ public: } static bool Is64BitPlatform(); static CPUInfo GetCPUInfo(); - static int32 GetCacheLineSize(); static MemoryStats GetMemoryStats(); static ProcessMemoryStats GetProcessMemoryStats(); static uint64 GetCurrentThreadID() diff --git a/Source/Engine/Platform/Win32/Win32Platform.cpp b/Source/Engine/Platform/Win32/Win32Platform.cpp index 49548eadf..eedd36c7a 100644 --- a/Source/Engine/Platform/Win32/Win32Platform.cpp +++ b/Source/Engine/Platform/Win32/Win32Platform.cpp @@ -310,11 +310,6 @@ CPUInfo Win32Platform::GetCPUInfo() return CpuInfo; } -int32 Win32Platform::GetCacheLineSize() -{ - return CpuInfo.CacheLineSize; -} - MemoryStats Win32Platform::GetMemoryStats() { MEMORYSTATUSEX statex; diff --git a/Source/Engine/Platform/Win32/Win32Platform.h b/Source/Engine/Platform/Win32/Win32Platform.h index 5d020a0fd..70b44876f 100644 --- a/Source/Engine/Platform/Win32/Win32Platform.h +++ b/Source/Engine/Platform/Win32/Win32Platform.h @@ -90,7 +90,6 @@ public: static void FreePages(void* ptr); static bool Is64BitPlatform(); static CPUInfo GetCPUInfo(); - static int32 GetCacheLineSize(); static MemoryStats GetMemoryStats(); static ProcessMemoryStats GetProcessMemoryStats(); static uint64 GetCurrentProcessId();