convert HandleStore::_underlyingBucket to a pointer (#19935)
authorDavid Mason <davmason@microsoft.com>
Sat, 15 Sep 2018 03:44:58 +0000 (20:44 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 15 Sep 2018 03:44:58 +0000 (20:44 -0700)
* convert HandleStore::_underlyingBucket to a pointer

* undo _underlyingBucket pointer change and delete Ref_CreateHandleTableBucket

* update comment

src/gc/gchandletable.cpp
src/gc/objecthandle.cpp
src/gc/objecthandle.h
src/vm/appdomain.cpp

index 7389706..ad3c6e2 100644 (file)
@@ -99,7 +99,9 @@ IGCHandleStore* GCHandleManager::CreateHandleStore(void* context)
 #ifndef FEATURE_REDHAWK
     GCHandleStore* store = new (nothrow) GCHandleStore();
     if (store == nullptr)
+    {
         return nullptr;
+    }
 
     bool success = ::Ref_InitializeHandleTableBucket(&store->_underlyingBucket, context);
     if (!success)
index d6ca8a5..347ba34 100644 (file)
@@ -689,21 +689,6 @@ void Ref_Shutdown()
 }
 
 #ifndef FEATURE_REDHAWK
-HandleTableBucket* Ref_CreateHandleTableBucket(void* context)
-{
-    HandleTableBucket* result = new (nothrow) HandleTableBucket();
-    if (result == nullptr)
-        return nullptr;
-
-    if (!Ref_InitializeHandleTableBucket(result, context))
-    {
-        delete result;
-        return nullptr;
-    }
-
-    return result;
-}
-
 bool Ref_InitializeHandleTableBucket(HandleTableBucket* bucket, void* context)
 {
     CONTRACTL
@@ -836,7 +821,6 @@ void Ref_DestroyHandleTableBucket(HandleTableBucket *pBucket)
         HndDestroyHandleTable(pBucket->pTable[uCPUindex]);
     }
     delete [] pBucket->pTable;
-    delete pBucket;
 }
 
 int getSlotNumber(ScanContext* sc)
index 6563d96..7c44b34 100644 (file)
@@ -78,7 +78,6 @@ int GetCurrentThreadHomeHeapNumber();
  */
 bool Ref_Initialize();
 void Ref_Shutdown();
-HandleTableBucket* Ref_CreateHandleTableBucket(void* context);
 bool Ref_InitializeHandleTableBucket(HandleTableBucket* bucket, void* context);
 BOOL Ref_HandleAsyncPinHandles(async_pin_enum_fn callback, void* context);
 void Ref_RelocateAsyncPinHandles(HandleTableBucket *pSource, HandleTableBucket *pTarget, void (*clearIfComplete)(Object*), void (*setHandle)(Object*, OBJECTHANDLE));
index 388aded..18478eb 100644 (file)
@@ -4137,7 +4137,7 @@ void AppDomain::Init()
 
 #ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING
     // NOTE: it's important that we initialize ARM data structures before calling
-    // Ref_CreateHandleTableBucket, this is because AD::Init() can race with GC
+    // IGCHandleManager::CreateHandleStore, this is because AD::Init() can race with GC
     // and once we add ourselves to the handle table map the GC can start walking
     // our handles and calling AD::RecordSurvivedBytes() which touches ARM data.
     if (GCHeapUtilities::IsServerHeap())