From 94c5211ee6a522c3d29c9f64810d4bbab8225732 Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Thu, 22 Dec 2022 13:02:00 +0100 Subject: [PATCH] Rename `gchandle` to `MGCHandle` --- Source/Engine/Animations/Graph/AnimGraph.h | 2 +- Source/Engine/Scripting/DotNet/CoreCLR.h | 8 ++++---- Source/Engine/Scripting/DotNet/MonoApi.cpp | 16 ++++++++-------- Source/Engine/Scripting/ManagedCLR/MUtils.h | 8 ++++---- Source/Engine/Scripting/ScriptingObject.cpp | 12 ++++++------ Source/Engine/Scripting/ScriptingObject.h | 2 +- Source/Engine/Scripting/Types.h | 4 ++-- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Source/Engine/Animations/Graph/AnimGraph.h b/Source/Engine/Animations/Graph/AnimGraph.h index 69855a2ba..7e98e298e 100644 --- a/Source/Engine/Animations/Graph/AnimGraph.h +++ b/Source/Engine/Animations/Graph/AnimGraph.h @@ -516,7 +516,7 @@ public: /// /// The GC handle to the managed instance of the node object. /// - gchandle Handle; + MGCHandle Handle; }; struct CurveData diff --git a/Source/Engine/Scripting/DotNet/CoreCLR.h b/Source/Engine/Scripting/DotNet/CoreCLR.h index 031279488..bd6c7ecb3 100644 --- a/Source/Engine/Scripting/DotNet/CoreCLR.h +++ b/Source/Engine/Scripting/DotNet/CoreCLR.h @@ -50,10 +50,10 @@ public: static const char* GetClassFullname(void* klass); static void* Allocate(int size); static void Free(void* ptr); - static gchandle NewGCHandle(void* obj, bool pinned); - static gchandle NewGCHandleWeakref(void* obj, bool track_resurrection); - static void* GetGCHandleTarget(const gchandle& gchandle); - static void FreeGCHandle(const gchandle& gchandle); + static MGCHandle NewGCHandle(void* obj, bool pinned); + static MGCHandle NewGCHandleWeakref(void* obj, bool track_resurrection); + static void* GetGCHandleTarget(const MGCHandle& MGCHandle); + static void FreeGCHandle(const MGCHandle& MGCHandle); static bool HasCustomAttribute(void* klass, void* attribClass); static bool HasCustomAttribute(void* klass); diff --git a/Source/Engine/Scripting/DotNet/MonoApi.cpp b/Source/Engine/Scripting/DotNet/MonoApi.cpp index 05c03f17c..f01fac1d2 100644 --- a/Source/Engine/Scripting/DotNet/MonoApi.cpp +++ b/Source/Engine/Scripting/DotNet/MonoApi.cpp @@ -563,27 +563,27 @@ CoreCLRClass* GetOrCreateClass(void* type) return klass; } -gchandle CoreCLR::NewGCHandle(void* obj, bool pinned) +MGCHandle CoreCLR::NewGCHandle(void* obj, bool pinned) { static void* NewGCHandlePtr = CoreCLR::GetStaticMethodPointer(TEXT("NewGCHandle")); - return (gchandle)CoreCLR::CallStaticMethod(NewGCHandlePtr, obj, pinned); + return (MGCHandle)CoreCLR::CallStaticMethod(NewGCHandlePtr, obj, pinned); } -gchandle CoreCLR::NewGCHandleWeakref(void* obj, bool track_resurrection) +MGCHandle CoreCLR::NewGCHandleWeakref(void* obj, bool track_resurrection) { static void* NewGCHandleWeakrefPtr = CoreCLR::GetStaticMethodPointer(TEXT("NewGCHandleWeakref")); - return (gchandle)CoreCLR::CallStaticMethod(NewGCHandleWeakrefPtr, obj, track_resurrection); + return (MGCHandle)CoreCLR::CallStaticMethod(NewGCHandleWeakrefPtr, obj, track_resurrection); } -void* CoreCLR::GetGCHandleTarget(const gchandle& gchandle) +void* CoreCLR::GetGCHandleTarget(const MGCHandle& MGCHandle) { - return (void*)gchandle; + return (void*)MGCHandle; } -void CoreCLR::FreeGCHandle(const gchandle& gchandle) +void CoreCLR::FreeGCHandle(const MGCHandle& MGCHandle) { static void* FreeGCHandlePtr = CoreCLR::GetStaticMethodPointer(TEXT("FreeGCHandle")); - CoreCLR::CallStaticMethod(FreeGCHandlePtr, (void*)gchandle); + CoreCLR::CallStaticMethod(FreeGCHandlePtr, (void*)MGCHandle); } const char* CoreCLR::GetClassFullname(void* klass) diff --git a/Source/Engine/Scripting/ManagedCLR/MUtils.h b/Source/Engine/Scripting/ManagedCLR/MUtils.h index db2766dbe..01a6235ca 100644 --- a/Source/Engine/Scripting/ManagedCLR/MUtils.h +++ b/Source/Engine/Scripting/ManagedCLR/MUtils.h @@ -622,7 +622,7 @@ namespace MUtils } #endif - FORCE_INLINE gchandle NewGCHandle(MonoObject* obj, bool pinned) + FORCE_INLINE MGCHandle NewGCHandle(MonoObject* obj, bool pinned) { #if USE_NETCORE return CoreCLR::NewGCHandle(obj, pinned); @@ -631,7 +631,7 @@ namespace MUtils #endif } - FORCE_INLINE gchandle NewGCHandleWeakref(MonoObject* obj, bool track_resurrection) + FORCE_INLINE MGCHandle NewGCHandleWeakref(MonoObject* obj, bool track_resurrection) { #if USE_NETCORE return CoreCLR::NewGCHandleWeakref(obj, track_resurrection); @@ -640,7 +640,7 @@ namespace MUtils #endif } - FORCE_INLINE MonoObject* GetGCHandleTarget(const gchandle& handle) + FORCE_INLINE MonoObject* GetGCHandleTarget(const MGCHandle& handle) { #if USE_NETCORE return (MonoObject*)CoreCLR::GetGCHandleTarget(handle); @@ -649,7 +649,7 @@ namespace MUtils #endif } - FORCE_INLINE void FreeGCHandle(const gchandle& handle) + FORCE_INLINE void FreeGCHandle(const MGCHandle& handle) { #if USE_NETCORE CoreCLR::FreeGCHandle(handle); diff --git a/Source/Engine/Scripting/ScriptingObject.cpp b/Source/Engine/Scripting/ScriptingObject.cpp index 0dd46fe81..0400b5b2e 100644 --- a/Source/Engine/Scripting/ScriptingObject.cpp +++ b/Source/Engine/Scripting/ScriptingObject.cpp @@ -69,9 +69,9 @@ ScriptingObject* ScriptingObject::NewObject(const ScriptingTypeHandle& typeHandl MObject* ScriptingObject::GetManagedInstance() const { #if USE_NETCORE - const gchandle handle = Platform::AtomicRead((int64*)&_gcHandle); + const MGCHandle handle = Platform::AtomicRead((int64*)&_gcHandle); #elif USE_MONO - const gchandle handle = Platform::AtomicRead((int32*)&_gcHandle); + const MGCHandle handle = Platform::AtomicRead((int32*)&_gcHandle); #endif #if USE_MONO return handle ? MUtils::GetGCHandleTarget(handle) : nullptr; @@ -242,7 +242,7 @@ bool ScriptingObject::CreateManaged() // Prevent from object GC destruction #if USE_NETCORE - auto handle = (gchandle)managedInstance; + auto handle = (MGCHandle)managedInstance; auto oldHandle = Platform::InterlockedCompareExchange((int64*)&_gcHandle, *(int64*)&handle, 0); if (*(uint64*)&oldHandle != 0) #else @@ -459,7 +459,7 @@ bool ManagedScriptingObject::CreateManaged() // Cache the GC handle to the object (used to track the target object because it can be moved in a memory) #if USE_NETCORE - auto handle = (gchandle)managedInstance; + auto handle = (MGCHandle)managedInstance; auto oldHandle = Platform::InterlockedCompareExchange((int64*)&_gcHandle, *(int64*)&handle, 0); if (*(uint64*)&oldHandle != 0) #else @@ -645,7 +645,7 @@ public: { // Managed #if USE_NETCORE - managedScriptingObject->_gcHandle = (gchandle)managedInstance; + managedScriptingObject->_gcHandle = (MGCHandle)managedInstance; #else managedScriptingObject->_gcHandle = MUtils::NewGCHandleWeakref(managedInstance, false); #endif @@ -654,7 +654,7 @@ public: { // Persistent #if USE_NETCORE - obj->_gcHandle = (gchandle)managedInstance; + obj->_gcHandle = (MGCHandle)managedInstance; #else obj->_gcHandle = MUtils::NewGCHandle(managedInstance, false); #endif diff --git a/Source/Engine/Scripting/ScriptingObject.h b/Source/Engine/Scripting/ScriptingObject.h index 4b51d83a9..ea4409c3a 100644 --- a/Source/Engine/Scripting/ScriptingObject.h +++ b/Source/Engine/Scripting/ScriptingObject.h @@ -21,7 +21,7 @@ public: protected: - gchandle _gcHandle; + MGCHandle _gcHandle; ScriptingTypeHandle _type; Guid _id; diff --git a/Source/Engine/Scripting/Types.h b/Source/Engine/Scripting/Types.h index db3a37e4b..f6251d184 100644 --- a/Source/Engine/Scripting/Types.h +++ b/Source/Engine/Scripting/Types.h @@ -55,9 +55,9 @@ struct _MonoThread {}; #endif #if USE_NETCORE -typedef unsigned long long gchandle; +typedef unsigned long long MGCHandle; #else -typedef uint32 gchandle; +typedef uint32 MGCHandle; #endif // Mono types declarations