diff --git a/src/coreclr/gc/gchandletable.cpp b/src/coreclr/gc/gchandletable.cpp index d503aca269b6cd..e70b38ebb6c339 100644 --- a/src/coreclr/gc/gchandletable.cpp +++ b/src/coreclr/gc/gchandletable.cpp @@ -17,12 +17,17 @@ IGCHandleManager* CreateGCHandleManager() void GCHandleStore::Uproot() { - Ref_RemoveHandleTableBucket(&_underlyingBucket); + // Dead path. The vtable slot is preserved for GC_INTERFACE_MAJOR_VERSION 5 + // ABI compatibility with external standalone GC implementations. + assert(!"Uproot is not in use"); } bool GCHandleStore::ContainsHandle(OBJECTHANDLE handle) { - return _underlyingBucket.Contains(handle); + // Dead path. The vtable slot is preserved for GC_INTERFACE_MAJOR_VERSION 5 + // ABI compatibility with external standalone GC implementations. + assert(!"ContainsHandle is not in use"); + return false; } // this is the number of handles we allocate in a handle table before we switch to the next table. @@ -129,25 +134,10 @@ IGCHandleStore* GCHandleManager::GetGlobalHandleStore() IGCHandleStore* GCHandleManager::CreateHandleStore() { -#ifndef FEATURE_NATIVEAOT - GCHandleStore* store = new (nothrow) GCHandleStore(); - if (store == nullptr) - { - return nullptr; - } - - bool success = ::Ref_InitializeHandleTableBucket(&store->_underlyingBucket); - if (!success) - { - delete store; - return nullptr; - } - - return store; -#else - assert(!"CreateHandleStore is not implemented when FEATURE_NATIVEAOT is defined!"); + // Dead path. The vtable slot is preserved for GC_INTERFACE_MAJOR_VERSION 5 + // ABI compatibility with external standalone GC implementations. + assert(!"CreateHandleStore is not in use"); return nullptr; -#endif } void GCHandleManager::DestroyHandleStore(IGCHandleStore* store) @@ -221,4 +211,3 @@ void GCHandleManager::TraceRefCountedHandles(HANDLESCANPROC callback, uintptr_t { ::Ref_TraceRefCountHandles(callback, param1, param2); } - diff --git a/src/coreclr/gc/objecthandle.cpp b/src/coreclr/gc/objecthandle.cpp index af7805107e5909..62803851d1d198 100644 --- a/src/coreclr/gc/objecthandle.cpp +++ b/src/coreclr/gc/objecthandle.cpp @@ -744,95 +744,6 @@ void Ref_Shutdown() } } -bool Ref_InitializeHandleTableBucket(HandleTableBucket* bucket) -{ - CONTRACTL - { - NOTHROW; - WRAPPER(GC_TRIGGERS); - INJECT_FAULT(return false); - } - CONTRACTL_END; - - HandleTableBucket *result = bucket; - HandleTableMap *walk = &g_HandleTableMap; - - HandleTableMap *last = NULL; - uint32_t offset = 0; - - result->pTable = NULL; - - // create handle table set for the bucket - int n_slots = getNumberOfSlots(); - - HandleTableBucketHolder bucketHolder(result, n_slots); - - result->pTable = new (nothrow) HHANDLETABLE[n_slots]; - if (!result->pTable) - { - return false; - } - - ZeroMemory(result->pTable, n_slots * sizeof(HHANDLETABLE)); - - for (int uCPUindex=0; uCPUindex < n_slots; uCPUindex++) { - result->pTable[uCPUindex] = HndCreateHandleTable(s_rgTypeFlags, ARRAY_SIZE(s_rgTypeFlags)); - if (!result->pTable[uCPUindex]) - return false; - } - - for (;;) { - // Do we have free slot - while (walk) { - for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++) { - if (walk->pBuckets[i] == 0) { - for (int uCPUindex=0; uCPUindex < n_slots; uCPUindex++) - HndSetHandleTableIndex(result->pTable[uCPUindex], i+offset); - - result->HandleTableIndex = i+offset; - if (Interlocked::CompareExchangePointer(&walk->pBuckets[i], result, NULL) == 0) { - // Get a free slot. - bucketHolder.SuppressRelease(); - return true; - } - } - } - last = walk; - offset = walk->dwMaxIndex; - walk = walk->pNext; - } - - // No free slot. - // Let's create a new node - HandleTableMap *newMap = new (nothrow) HandleTableMap; - if (!newMap) - { - return false; - } - - newMap->pBuckets = new (nothrow) HandleTableBucket * [ INITIAL_HANDLE_TABLE_ARRAY_SIZE ]; - if (!newMap->pBuckets) - { - delete newMap; - return false; - } - - newMap->dwMaxIndex = last->dwMaxIndex + INITIAL_HANDLE_TABLE_ARRAY_SIZE; - newMap->pNext = NULL; - ZeroMemory(newMap->pBuckets, - INITIAL_HANDLE_TABLE_ARRAY_SIZE * sizeof (HandleTableBucket *)); - - if (Interlocked::CompareExchangePointer(&last->pNext, newMap, NULL) != NULL) - { - // This thread loses. - delete [] newMap->pBuckets; - delete newMap; - } - walk = last->pNext; - offset = last->dwMaxIndex; - } -} - void Ref_RemoveHandleTableBucket(HandleTableBucket *pBucket) { LIMITED_METHOD_CONTRACT; diff --git a/src/coreclr/gc/objecthandle.h b/src/coreclr/gc/objecthandle.h index 27875c4cf5720b..414b24ebd3272d 100644 --- a/src/coreclr/gc/objecthandle.h +++ b/src/coreclr/gc/objecthandle.h @@ -81,7 +81,6 @@ int getNumberOfSlots(); */ bool Ref_Initialize(); void Ref_Shutdown(); -bool Ref_InitializeHandleTableBucket(HandleTableBucket* bucket); void Ref_RemoveHandleTableBucket(HandleTableBucket *pBucket); void Ref_DestroyHandleTableBucket(HandleTableBucket *pBucket);