From 6ee9dc120cfdbaf298cc1a62e30b355c0c3098b4 Mon Sep 17 00:00:00 2001 From: Aditya Mandaleeka Date: Wed, 19 Apr 2017 15:18:57 -0700 Subject: [PATCH] Move ResetOBJECTHANDLE and the associated holder to the VM side. Commit migrated from https://github.com/dotnet/coreclr/commit/fc5385ef9ce5303bc22638ac36e9ba04ed4a9c21 --- src/coreclr/src/gc/objecthandle.h | 11 ----------- src/coreclr/src/vm/gchandleutilities.h | 6 ++++++ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/coreclr/src/gc/objecthandle.h b/src/coreclr/src/gc/objecthandle.h index c320dcc..b3e4b58 100644 --- a/src/coreclr/src/gc/objecthandle.h +++ b/src/coreclr/src/gc/objecthandle.h @@ -80,17 +80,6 @@ void GCHandleValidatePinnedObject(OBJECTREF obj); int GetCurrentThreadHomeHeapNumber(); -inline void ResetOBJECTHANDLE(OBJECTHANDLE handle) -{ - WRAPPER_NO_CONTRACT; - - HndAssignHandle(handle, NULL); -} - -#ifndef FEATURE_REDHAWK -typedef Holder,ResetOBJECTHANDLE> ObjectInHandleHolder; -#endif - /* * Table maintenance routines */ diff --git a/src/coreclr/src/vm/gchandleutilities.h b/src/coreclr/src/vm/gchandleutilities.h index 41b6317..64e13a6 100644 --- a/src/coreclr/src/vm/gchandleutilities.h +++ b/src/coreclr/src/vm/gchandleutilities.h @@ -196,6 +196,11 @@ inline void* InterlockedCompareExchangeObjectInHandle(OBJECTHANDLE handle, OBJEC return GCHandleUtilities::GetGCHandleManager()->CompareAndSwapObjectInHandle(handle, OBJECTREFToObject(object), OBJECTREFToObject(comparandObject)); } +inline void ResetOBJECTHANDLE(OBJECTHANDLE handle) +{ + GCHandleUtilities::GetGCHandleManager()->StoreObjectInHandle(handle, NULL); +} + // Handle destruction convenience functions inline void DestroyHandle(OBJECTHANDLE handle) @@ -336,6 +341,7 @@ typedef Wrapper, DestroyRefcountedHandle> typedef Holder, DestroyLongWeakHandle> LongWeakHandleHolder; typedef Holder, DestroyGlobalStrongHandle> GlobalStrongHandleHolder; typedef Holder, DestroyGlobalShortWeakHandle> GlobalShortWeakHandleHolder; +typedef Holder, ResetOBJECTHANDLE> ObjectInHandleHolder; class RCOBJECTHANDLEHolder : public RefCountedOHWrapper { -- 2.7.4