Remove GetHandleTableForHandle and add CreateDuplicateHandle.
authorAditya Mandaleeka <adityam@microsoft.com>
Wed, 12 Apr 2017 00:58:14 +0000 (17:58 -0700)
committerAditya Mandaleeka <adityam@microsoft.com>
Wed, 12 Apr 2017 01:29:32 +0000 (18:29 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/ea22d55fc0392cf858d4c1c17d504523a1e18732

src/coreclr/src/gc/gchandletable.cpp
src/coreclr/src/gc/gchandletableimpl.h
src/coreclr/src/gc/gcinterface.h
src/coreclr/src/vm/threads.cpp

index 77c1ad1..a2303c2 100644 (file)
@@ -28,11 +28,6 @@ void* GCHandleTable::GetHandleContext(OBJECTHANDLE handle)
     return (void*)((uintptr_t)::HndGetHandleTableADIndex(::HndGetHandleTable(handle)).m_dwIndex);
 }
 
-void* GCHandleTable::GetHandleTableForHandle(OBJECTHANDLE handle)
-{
-    return (void*)::HndGetHandleTable(handle);
-}
-
 OBJECTHANDLE GCHandleTable::CreateHandleOfType(void* table, Object* object, int type)
 {
     return ::HndCreateHandle((HHANDLETABLE)table, type, ObjectToOBJECTREF(object));
@@ -56,6 +51,11 @@ OBJECTHANDLE GCHandleTable::CreateDependentHandle(void* table, Object* primary,
     return handle;
 }
 
+OBJECTHANDLE GCHandleTable::CreateDuplicateHandle(OBJECTHANDLE handle)
+{
+    return ::HndCreateHandle(HndGetHandleTable(handle), HNDTYPE_DEFAULT, ObjectFromHandle(handle));
+}
+
 void GCHandleTable::DestroyHandleOfType(OBJECTHANDLE handle, int type)
 {
     ::HndDestroyHandle(::HndGetHandleTable(handle), type, handle);
index df803a2..bfcab20 100644 (file)
@@ -16,8 +16,6 @@ public:
 
     virtual void* GetHandleContext(OBJECTHANDLE handle);
 
-    virtual void* GetHandleTableForHandle(OBJECTHANDLE handle);
-
     virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type);
 
     virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* table, Object* object, int type, void* pExtraInfo);
@@ -26,6 +24,8 @@ public:
 
     virtual OBJECTHANDLE CreateGlobalHandleOfType(Object* object, int type);
 
+    virtual OBJECTHANDLE CreateDuplicateHandle(OBJECTHANDLE handle);
+
     virtual void DestroyHandleOfType(OBJECTHANDLE handle, int type);
 
     virtual void DestroyHandleOfUnknownType(OBJECTHANDLE handle);
index 7c62a82..f2c4bdd 100644 (file)
@@ -411,8 +411,6 @@ public:
 
     virtual void* GetHandleContext(OBJECTHANDLE handle) = 0;
 
-    virtual void* GetHandleTableForHandle(OBJECTHANDLE handle) = 0;
-
     virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type) = 0;
 
     virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* table, Object* object, int type, void* pExtraInfo) = 0;
@@ -421,6 +419,8 @@ public:
 
     virtual OBJECTHANDLE CreateGlobalHandleOfType(Object* object, int type) = 0;
 
+    virtual OBJECTHANDLE CreateDuplicateHandle(OBJECTHANDLE handle) = 0;
+
     virtual void DestroyHandleOfType(OBJECTHANDLE handle, int type) = 0;
 
     virtual void DestroyHandleOfUnknownType(OBJECTHANDLE handle) = 0;
index 9af5aa4..a126d1c 100644 (file)
@@ -5075,11 +5075,10 @@ void Thread::SafeUpdateLastThrownObject(void)
         EX_TRY
         {
             IGCHandleTable *pHandleTable = GCHandleTableUtilities::GetGCHandleTable();
-            void* table = pHandleTable->GetHandleTableForHandle(hThrowable);
 
             // Creating a duplicate handle here ensures that the AD of the last thrown object
             // matches the domain of the current throwable.
-            OBJECTHANDLE duplicateHandle = pHandleTable->CreateHandleOfType(table, OBJECTREFToObject(ObjectFromHandle(hThrowable)), HNDTYPE_DEFAULT);
+            OBJECTHANDLE duplicateHandle = pHandleTable->CreateDuplicateHandle(hThrowable);
             SetLastThrownObjectHandle(duplicateHandle);
         }
         EX_CATCH