From 73a0bc0d549d1c8e41261891dcc2974fb8024556 Mon Sep 17 00:00:00 2001 From: David Mason Date: Fri, 14 Sep 2018 20:44:58 -0700 Subject: [PATCH] convert HandleStore::_underlyingBucket to a pointer (#19935) * convert HandleStore::_underlyingBucket to a pointer * undo _underlyingBucket pointer change and delete Ref_CreateHandleTableBucket * update comment --- src/gc/gchandletable.cpp | 2 ++ src/gc/objecthandle.cpp | 16 ---------------- src/gc/objecthandle.h | 1 - src/vm/appdomain.cpp | 2 +- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/gc/gchandletable.cpp b/src/gc/gchandletable.cpp index 7389706..ad3c6e2 100644 --- a/src/gc/gchandletable.cpp +++ b/src/gc/gchandletable.cpp @@ -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) diff --git a/src/gc/objecthandle.cpp b/src/gc/objecthandle.cpp index d6ca8a5..347ba34 100644 --- a/src/gc/objecthandle.cpp +++ b/src/gc/objecthandle.cpp @@ -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) diff --git a/src/gc/objecthandle.h b/src/gc/objecthandle.h index 6563d96..7c44b34 100644 --- a/src/gc/objecthandle.h +++ b/src/gc/objecthandle.h @@ -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)); diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index 388aded..18478eb 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -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()) -- 2.7.4