From f3576a9fdc0193ab7120a11d53a4c10dcad4f770 Mon Sep 17 00:00:00 2001 From: Aditya Mandaleeka Date: Tue, 11 Apr 2017 18:49:44 -0700 Subject: [PATCH] Rename overloaded "table" to "store" for VM side concept. Commit migrated from https://github.com/dotnet/coreclr/commit/ab43a5fbeccca1e4948dd140592361fe7c3335c3 --- src/coreclr/src/gc/gchandletable.cpp | 41 +++++++++++++++++++--------------- src/coreclr/src/gc/gchandletableimpl.h | 18 +++++++-------- src/coreclr/src/gc/gcinterface.h | 18 +++++++-------- src/coreclr/src/vm/appdomain.cpp | 28 +++++++++++------------ src/coreclr/src/vm/appdomain.hpp | 28 +++++++++++------------ src/coreclr/src/vm/exstate.cpp | 4 ++-- src/coreclr/src/vm/exstate.h | 2 +- 7 files changed, 72 insertions(+), 67 deletions(-) diff --git a/src/coreclr/src/gc/gchandletable.cpp b/src/coreclr/src/gc/gchandletable.cpp index 28852df..82ab269 100644 --- a/src/coreclr/src/gc/gchandletable.cpp +++ b/src/coreclr/src/gc/gchandletable.cpp @@ -23,14 +23,19 @@ void GCHandleTable::Shutdown() Ref_Shutdown(); } -void* GCHandleTable::GetGlobalHandleTable() +void* GCHandleTable::GetGlobalHandleStore() { return (void*)g_HandleTableMap.pBuckets[0]; } -void* GCHandleTable::GetNewHandleTable(void* context) +void* GCHandleTable::CreateHandleStore(void* context) { - return (void*)::Ref_CreateHandleTableBucket(ADIndex((uintptr_t)context)); +#ifndef FEATURE_REDHAWK + return (void*)::Ref_CreateHandleTableBucket(ADIndex((DWORD)(uintptr_t)context)); +#else + assert("CreateHandleStore is not implemented when FEATURE_REDHAWK is defined!"); + return nullptr; +#endif } void* GCHandleTable::GetHandleContext(OBJECTHANDLE handle) @@ -38,30 +43,30 @@ void* GCHandleTable::GetHandleContext(OBJECTHANDLE handle) return (void*)((uintptr_t)::HndGetHandleTableADIndex(::HndGetHandleTable(handle)).m_dwIndex); } -void GCHandleTable::DestroyHandleTable(void* table) +void GCHandleTable::DestroyHandleStore(void* store) { - Ref_DestroyHandleTableBucket((HandleTableBucket*) table); + Ref_DestroyHandleTableBucket((HandleTableBucket*) store); } -void GCHandleTable::UprootHandleTable(void* table) +void GCHandleTable::UprootHandleStore(void* store) { - Ref_RemoveHandleTableBucket((HandleTableBucket*) table); + Ref_RemoveHandleTableBucket((HandleTableBucket*) store); } -bool GCHandleTable::ContainsHandle(void* table, OBJECTHANDLE handle) +bool GCHandleTable::ContainsHandle(void* store, OBJECTHANDLE handle) { - return ((HandleTableBucket*)table)->Contains(handle); + return ((HandleTableBucket*)store)->Contains(handle); } -OBJECTHANDLE GCHandleTable::CreateHandleOfType(void* table, Object* object, int type) +OBJECTHANDLE GCHandleTable::CreateHandleOfType(void* store, Object* object, int type) { - HHANDLETABLE handletable = ((HandleTableBucket*)table)->pTable[GetCurrentThreadHomeHeapNumber()]; + HHANDLETABLE handletable = ((HandleTableBucket*)store)->pTable[GetCurrentThreadHomeHeapNumber()]; return ::HndCreateHandle(handletable, type, ObjectToOBJECTREF(object)); } -OBJECTHANDLE GCHandleTable::CreateHandleOfType(void* table, Object* object, int type, int heapToAffinitizeTo) +OBJECTHANDLE GCHandleTable::CreateHandleOfType(void* store, Object* object, int type, int heapToAffinitizeTo) { - HHANDLETABLE handletable = ((HandleTableBucket*)table)->pTable[heapToAffinitizeTo]; + HHANDLETABLE handletable = ((HandleTableBucket*)store)->pTable[heapToAffinitizeTo]; return ::HndCreateHandle(handletable, type, ObjectToOBJECTREF(object)); } @@ -70,15 +75,15 @@ OBJECTHANDLE GCHandleTable::CreateGlobalHandleOfType(Object* object, int type) return ::HndCreateHandle(g_HandleTableMap.pBuckets[0]->pTable[GetCurrentThreadHomeHeapNumber()], type, ObjectToOBJECTREF(object)); } -OBJECTHANDLE GCHandleTable::CreateHandleWithExtraInfo(void* table, Object* object, int type, void* pExtraInfo) +OBJECTHANDLE GCHandleTable::CreateHandleWithExtraInfo(void* store, Object* object, int type, void* pExtraInfo) { - HHANDLETABLE handletable = ((HandleTableBucket*)table)->pTable[GetCurrentThreadHomeHeapNumber()]; + HHANDLETABLE handletable = ((HandleTableBucket*)store)->pTable[GetCurrentThreadHomeHeapNumber()]; return ::HndCreateHandle(handletable, type, ObjectToOBJECTREF(object), reinterpret_cast(pExtraInfo)); } -OBJECTHANDLE GCHandleTable::CreateDependentHandle(void* table, Object* primary, Object* secondary) +OBJECTHANDLE GCHandleTable::CreateDependentHandle(void* store, Object* primary, Object* secondary) { - HHANDLETABLE handletable = ((HandleTableBucket*)table)->pTable[GetCurrentThreadHomeHeapNumber()]; + HHANDLETABLE handletable = ((HandleTableBucket*)store)->pTable[GetCurrentThreadHomeHeapNumber()]; OBJECTHANDLE handle = ::HndCreateHandle(handletable, HNDTYPE_DEPENDENT, ObjectToOBJECTREF(primary)); ::SetDependentHandleSecondary(handle, ObjectToOBJECTREF(secondary)); @@ -87,7 +92,7 @@ OBJECTHANDLE GCHandleTable::CreateDependentHandle(void* table, Object* primary, OBJECTHANDLE GCHandleTable::CreateDuplicateHandle(OBJECTHANDLE handle) { - return ::HndCreateHandle(HndGetHandleTable(handle), HNDTYPE_DEFAULT, ObjectFromHandle(handle)); + return ::HndCreateHandle(HndGetHandleTable(handle), HNDTYPE_DEFAULT, ::HndFetchHandle(handle)); } void GCHandleTable::DestroyHandleOfType(OBJECTHANDLE handle, int type) diff --git a/src/coreclr/src/gc/gchandletableimpl.h b/src/coreclr/src/gc/gchandletableimpl.h index a45f983..af20f52 100644 --- a/src/coreclr/src/gc/gchandletableimpl.h +++ b/src/coreclr/src/gc/gchandletableimpl.h @@ -14,25 +14,25 @@ public: virtual void Shutdown(); - virtual void* GetGlobalHandleTable(); + virtual void* GetGlobalHandleStore(); - virtual void* GetNewHandleTable(void* context); + virtual void* CreateHandleStore(void* context); virtual void* GetHandleContext(OBJECTHANDLE handle); - virtual void DestroyHandleTable(void* table); + virtual void DestroyHandleStore(void* store); - virtual void UprootHandleTable(void* table); + virtual void UprootHandleStore(void* store); - virtual bool ContainsHandle(void* table, OBJECTHANDLE handle); + virtual bool ContainsHandle(void* store, OBJECTHANDLE handle); - virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type); + virtual OBJECTHANDLE CreateHandleOfType(void* store, Object* object, int type); - virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type, int heapToAffinitizeTo); + virtual OBJECTHANDLE CreateHandleOfType(void* store, Object* object, int type, int heapToAffinitizeTo); - virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* table, Object* object, int type, void* pExtraInfo); + virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* store, Object* object, int type, void* pExtraInfo); - virtual OBJECTHANDLE CreateDependentHandle(void* table, Object* primary, Object* secondary); + virtual OBJECTHANDLE CreateDependentHandle(void* store, Object* primary, Object* secondary); virtual OBJECTHANDLE CreateGlobalHandleOfType(Object* object, int type); diff --git a/src/coreclr/src/gc/gcinterface.h b/src/coreclr/src/gc/gcinterface.h index b2bfbb7..cac2ba7 100644 --- a/src/coreclr/src/gc/gcinterface.h +++ b/src/coreclr/src/gc/gcinterface.h @@ -411,23 +411,23 @@ public: virtual void* GetHandleContext(OBJECTHANDLE handle) = 0; - virtual void* GetGlobalHandleTable() = 0; + virtual void* GetGlobalHandleStore() = 0; - virtual void* GetNewHandleTable(void* context) = 0; + virtual void* CreateHandleStore(void* context) = 0; - virtual void DestroyHandleTable(void* table) = 0; + virtual void DestroyHandleStore(void* store) = 0; - virtual void UprootHandleTable(void* table) = 0; + virtual void UprootHandleStore(void* store) = 0; - virtual bool ContainsHandle(void* table, OBJECTHANDLE handle) = 0; + virtual bool ContainsHandle(void* store, OBJECTHANDLE handle) = 0; - virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type) = 0; + virtual OBJECTHANDLE CreateHandleOfType(void* store, Object* object, int type) = 0; - virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type, int heapToAffinitizeTo) = 0; + virtual OBJECTHANDLE CreateHandleOfType(void* store, Object* object, int type, int heapToAffinitizeTo) = 0; - virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* table, Object* object, int type, void* pExtraInfo) = 0; + virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* store, Object* object, int type, void* pExtraInfo) = 0; - virtual OBJECTHANDLE CreateDependentHandle(void* table, Object* primary, Object* secondary) = 0; + virtual OBJECTHANDLE CreateDependentHandle(void* store, Object* primary, Object* secondary) = 0; virtual OBJECTHANDLE CreateGlobalHandleOfType(Object* object, int type) = 0; diff --git a/src/coreclr/src/vm/appdomain.cpp b/src/coreclr/src/vm/appdomain.cpp index 34c1822..5bfb12f 100644 --- a/src/coreclr/src/vm/appdomain.cpp +++ b/src/coreclr/src/vm/appdomain.cpp @@ -740,10 +740,10 @@ BaseDomain::BaseDomain() m_pLargeHeapHandleTable = NULL; #ifndef CROSSGEN_COMPILE - // Note that m_gcHandleTable is overridden by app domains - m_gcHandleTable = GCHandleTableUtilities::GetGCHandleTable()->GetGlobalHandleTable(); + // Note that m_handleStore is overridden by app domains + m_handleStore = GCHandleTableUtilities::GetGCHandleTable()->GetGlobalHandleStore(); #else - m_gcHandleTable = NULL; + m_handleStore = NULL; #endif m_pMarshalingData = NULL; @@ -4042,7 +4042,7 @@ AppDomain::AppDomain() m_pUMEntryThunkCache = NULL; m_pAsyncPool = NULL; - m_gcHandleTable = NULL; + m_handleStore = NULL; m_ExposedObject = NULL; m_pComIPForExposedObject = NULL; @@ -4273,11 +4273,11 @@ void AppDomain::Init() // default domain cannot be unloaded. if (GetId().m_dwId == DefaultADID) { - m_gcHandleTable = GCHandleTableUtilities::GetGCHandleTable()->GetGlobalHandleTable(); + m_handleStore = GCHandleTableUtilities::GetGCHandleTable()->GetGlobalHandleStore(); } else { - m_gcHandleTable = GCHandleTableUtilities::GetGCHandleTable()->GetNewHandleTable((void*)(uintptr_t)m_dwIndex.m_dwIndex); + m_handleStore = GCHandleTableUtilities::GetGCHandleTable()->CreateHandleStore((void*)(uintptr_t)m_dwIndex.m_dwIndex); } #endif // CROSSGEN_COMPILE @@ -4578,10 +4578,10 @@ void AppDomain::Terminate() BaseDomain::Terminate(); - if (m_gcHandleTable) + if (m_handleStore) { - GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleTable(m_gcHandleTable); - m_gcHandleTable = NULL; + GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleStore(m_handleStore); + m_handleStore = NULL; } #ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING @@ -9198,7 +9198,7 @@ void AppDomain::ClearGCHandles() HandleAsyncPinHandles(); // Remove our handle table as a source of GC roots - GCHandleTableUtilities::GetGCHandleTable()->UprootHandleTable(m_gcHandleTable); + GCHandleTableUtilities::GetGCHandleTable()->UprootHandleStore(m_handleStore); } // When an AD is unloaded, we will release all objects in this AD. @@ -9215,14 +9215,14 @@ void AppDomain::HandleAsyncPinHandles() CONTRACTL_END; // TODO: Temporarily casting stuff here until Ref_RelocateAsyncPinHandles is moved to the interface. - HandleTableBucket *pBucket = (HandleTableBucket*)m_gcHandleTable; + HandleTableBucket *pBucket = (HandleTableBucket*)m_handleStore; // IO completion port picks IO job using FIFO. Here is how we know which AsyncPinHandle can be freed. // 1. We mark all non-pending AsyncPinHandle with READYTOCLEAN. // 2. We queue a dump Overlapped to the IO completion as a marker. // 3. When the Overlapped is picked up by completion port, we wait until all previous IO jobs are processed. // 4. Then we can delete all AsyncPinHandle marked with READYTOCLEAN. - HandleTableBucket *pBucketInDefault = (HandleTableBucket*)SystemDomain::System()->DefaultDomain()->m_gcHandleTable; + HandleTableBucket *pBucketInDefault = (HandleTableBucket*)SystemDomain::System()->DefaultDomain()->m_handleStore; // TODO: When this function is moved to the interface it will take void*s Ref_RelocateAsyncPinHandles(pBucket, pBucketInDefault); @@ -9255,7 +9255,7 @@ void AppDomain::ClearGCRoots() pThread->DeleteThreadStaticData(this); // @TODO: A pre-allocated AppDomainUnloaded exception might be better. - if (pHandleTable->ContainsHandle(m_gcHandleTable, pThread->m_LastThrownObjectHandle)) + if (pHandleTable->ContainsHandle(m_handleStore, pThread->m_LastThrownObjectHandle)) { // Never delete a handle to a preallocated exception object. if (!CLRException::IsPreallocatedExceptionHandle(pThread->m_LastThrownObjectHandle)) @@ -9267,7 +9267,7 @@ void AppDomain::ClearGCRoots() } // Clear out the exceptions objects held by a thread. - pThread->GetExceptionState()->ClearThrowablesForUnload(m_gcHandleTable); + pThread->GetExceptionState()->ClearThrowablesForUnload(m_handleStore); } //delete them while we still have the runtime suspended diff --git a/src/coreclr/src/vm/appdomain.hpp b/src/coreclr/src/vm/appdomain.hpp index d74bd7e..898e50f 100644 --- a/src/coreclr/src/vm/appdomain.hpp +++ b/src/coreclr/src/vm/appdomain.hpp @@ -1246,39 +1246,39 @@ public: WRAPPER_NO_CONTRACT; IGCHandleTable *pHandleTable = GCHandleTableUtilities::GetGCHandleTable(); - return pHandleTable->CreateHandleOfType(m_gcHandleTable, OBJECTREFToObject(object), type); + return pHandleTable->CreateHandleOfType(m_handleStore, OBJECTREFToObject(object), type); } OBJECTHANDLE CreateHandle(OBJECTREF object) { WRAPPER_NO_CONTRACT; CONDITIONAL_CONTRACT_VIOLATION(ModeViolation, object == NULL) - return ::CreateHandle(m_gcHandleTable, object); + return ::CreateHandle(m_handleStore, object); } OBJECTHANDLE CreateWeakHandle(OBJECTREF object) { WRAPPER_NO_CONTRACT; - return ::CreateWeakHandle(m_gcHandleTable, object); + return ::CreateWeakHandle(m_handleStore, object); } OBJECTHANDLE CreateShortWeakHandle(OBJECTREF object) { WRAPPER_NO_CONTRACT; - return ::CreateShortWeakHandle(m_gcHandleTable, object); + return ::CreateShortWeakHandle(m_handleStore, object); } OBJECTHANDLE CreateLongWeakHandle(OBJECTREF object) { WRAPPER_NO_CONTRACT; CONDITIONAL_CONTRACT_VIOLATION(ModeViolation, object == NULL) - return ::CreateLongWeakHandle(m_gcHandleTable, object); + return ::CreateLongWeakHandle(m_handleStore, object); } OBJECTHANDLE CreateStrongHandle(OBJECTREF object) { WRAPPER_NO_CONTRACT; - return ::CreateStrongHandle(m_gcHandleTable, object); + return ::CreateStrongHandle(m_handleStore, object); } OBJECTHANDLE CreatePinningHandle(OBJECTREF object) @@ -1288,7 +1288,7 @@ public: if(IsAppDomain()) object->TryAssignAppDomain((AppDomain*)this,TRUE); #endif - return ::CreatePinningHandle(m_gcHandleTable, object); + return ::CreatePinningHandle(m_handleStore, object); } OBJECTHANDLE CreateSizedRefHandle(OBJECTREF object) @@ -1297,11 +1297,11 @@ public: OBJECTHANDLE h; if (GCHeapUtilities::IsServerHeap()) { - h = ::CreateSizedRefHandle(m_gcHandleTable, object, m_dwSizedRefHandles % m_iNumberOfProcessors); + h = ::CreateSizedRefHandle(m_handleStore, object, m_dwSizedRefHandles % m_iNumberOfProcessors); } else { - h = ::CreateSizedRefHandle(m_gcHandleTable, object); + h = ::CreateSizedRefHandle(m_handleStore, object); } InterlockedIncrement((LONG*)&m_dwSizedRefHandles); @@ -1312,7 +1312,7 @@ public: OBJECTHANDLE CreateRefcountedHandle(OBJECTREF object) { WRAPPER_NO_CONTRACT; - return ::CreateRefcountedHandle(m_gcHandleTable, object); + return ::CreateRefcountedHandle(m_handleStore, object); } OBJECTHANDLE CreateWinRTWeakHandle(OBJECTREF object, IWeakReference* pWinRTWeakReference) @@ -1325,14 +1325,14 @@ public: } CONTRACTL_END; - return ::CreateWinRTWeakHandle(m_gcHandleTable, object, pWinRTWeakReference); + return ::CreateWinRTWeakHandle(m_handleStore, object, pWinRTWeakReference); } #endif // FEATURE_COMINTEROP OBJECTHANDLE CreateVariableHandle(OBJECTREF object, UINT type) { WRAPPER_NO_CONTRACT; - return ::CreateVariableHandle(m_gcHandleTable, object, type); + return ::CreateVariableHandle(m_handleStore, object, type); } OBJECTHANDLE CreateDependentHandle(OBJECTREF primary, OBJECTREF secondary) @@ -1346,7 +1346,7 @@ public: CONTRACTL_END; IGCHandleTable *pHandleTable = GCHandleTableUtilities::GetGCHandleTable(); - return pHandleTable->CreateDependentHandle(m_gcHandleTable, OBJECTREFToObject(primary), OBJECTREFToObject(secondary)); + return pHandleTable->CreateDependentHandle(m_handleStore, OBJECTREFToObject(primary), OBJECTREFToObject(secondary)); } #endif // DACCESS_COMPILE && !CROSSGEN_COMPILE @@ -1402,7 +1402,7 @@ protected: CLRPrivBinderCoreCLR *m_pTPABinderContext; // Reference to the binding context that holds TPA list details - void* m_gcHandleTable; + void* m_handleStore; // The large heap handle table. LargeHeapHandleTable *m_pLargeHeapHandleTable; diff --git a/src/coreclr/src/vm/exstate.cpp b/src/coreclr/src/vm/exstate.cpp index 6cca98f..c598412 100644 --- a/src/coreclr/src/vm/exstate.cpp +++ b/src/coreclr/src/vm/exstate.cpp @@ -102,7 +102,7 @@ void ThreadExceptionState::FreeAllStackTraces() } } -void ThreadExceptionState::ClearThrowablesForUnload(void* handleTable) +void ThreadExceptionState::ClearThrowablesForUnload(void* handleStore) { WRAPPER_NO_CONTRACT; @@ -118,7 +118,7 @@ void ThreadExceptionState::ClearThrowablesForUnload(void* handleTable) pNode != NULL; pNode = pNode->m_pPrevNestedInfo) { - if (pHandleTable->ContainsHandle(handleTable, pNode->m_hThrowable)) + if (pHandleTable->ContainsHandle(handleStore, pNode->m_hThrowable)) { pNode->DestroyExceptionHandle(); } diff --git a/src/coreclr/src/vm/exstate.h b/src/coreclr/src/vm/exstate.h index 79a8f57..104c76c 100644 --- a/src/coreclr/src/vm/exstate.h +++ b/src/coreclr/src/vm/exstate.h @@ -56,7 +56,7 @@ class ThreadExceptionState public: void FreeAllStackTraces(); - void ClearThrowablesForUnload(void* handleTable); + void ClearThrowablesForUnload(void* handleStore); #ifdef _DEBUG typedef enum -- 2.7.4