diff options
author | Sean Gillespie <segilles@microsoft.com> | 2017-06-20 15:24:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-20 15:24:05 -0700 |
commit | e7725a6ff986879f8ff2fd9e09ab636545ba7bca (patch) | |
tree | be9fd2ac0a68a6d2545f469a611c23f7a5789702 /src/gc | |
parent | cf63336cbc2597801d62e399be6bdba8938d1034 (diff) | |
download | coreclr-e7725a6ff986879f8ff2fd9e09ab636545ba7bca.tar.gz coreclr-e7725a6ff986879f8ff2fd9e09ab636545ba7bca.tar.bz2 coreclr-e7725a6ff986879f8ff2fd9e09ab636545ba7bca.zip |
[Local GC] Move handle creation/deletion profiler callbacks out of the GC (#12314)
* [Local GC] Move handle creation and handle destruction profiler
callbacks out of the GC
* Remove dead code
* Move some handle-related code out of gcheaputilities.cpp and into gchandleutilities.cpp
* Address code review feedback, remove some more dead code and add some style fixes
* Refactor handle creation and destruction helpers to go through a common function
Diffstat (limited to 'src/gc')
-rw-r--r-- | src/gc/handletable.cpp | 129 | ||||
-rw-r--r-- | src/gc/handletable.h | 6 |
2 files changed, 0 insertions, 135 deletions
diff --git a/src/gc/handletable.cpp b/src/gc/handletable.cpp index 875e8943cf..8c6c835200 100644 --- a/src/gc/handletable.cpp +++ b/src/gc/handletable.cpp @@ -346,19 +346,6 @@ OBJECTHANDLE HndCreateHandle(HHANDLETABLE hTable, uint32_t uType, OBJECTREF obje // store the reference HndAssignHandle(handle, object); - -#if defined(ENABLE_PERF_COUNTERS) || defined(FEATURE_EVENT_TRACE) - g_dwHandles++; -#endif // ENABLE_PERF_COUNTERS || FEATURE_EVENT_TRACE - -#ifdef GC_PROFILING - { - BEGIN_PIN_PROFILER(CORProfilerTrackGC()); - g_profControlBlock.pProfInterface->HandleCreated((uintptr_t)handle, (ObjectID)OBJECTREF_TO_UNCHECKED_OBJECTREF(object)); - END_PIN_PROFILER(); - } -#endif //GC_PROFILING - STRESS_LOG2(LF_GC, LL_INFO1000, "CreateHandle: %p, type=%d\n", handle, uType); // return the result @@ -490,18 +477,6 @@ void HndDestroyHandle(HHANDLETABLE hTable, uint32_t uType, OBJECTHANDLE handle) // fetch the handle table pointer HandleTable *pTable = Table(hTable); -#ifdef GC_PROFILING - { - BEGIN_PIN_PROFILER(CORProfilerTrackGC()); - g_profControlBlock.pProfInterface->HandleDestroyed((uintptr_t)handle); - END_PIN_PROFILER(); - } -#endif //GC_PROFILING - -#if defined(ENABLE_PERF_COUNTERS) || defined(FEATURE_EVENT_TRACE) - g_dwHandles--; -#endif // ENABLE_PERF_COUNTERS || FEATURE_EVENT_TRACE - // sanity check the type index _ASSERTE(uType < pTable->uTypeCount); @@ -543,110 +518,6 @@ void HndDestroyHandleOfUnknownType(HHANDLETABLE hTable, OBJECTHANDLE handle) HndDestroyHandle(hTable, HandleFetchType(handle), handle); } - -/* - * HndCreateHandles - * - * Entrypoint for allocating handles in bulk. - * - */ -uint32_t HndCreateHandles(HHANDLETABLE hTable, uint32_t uType, OBJECTHANDLE *pHandles, uint32_t uCount) -{ - WRAPPER_NO_CONTRACT; - - // fetch the handle table pointer - HandleTable *pTable = Table(hTable); - - // sanity check the type index - _ASSERTE(uType < pTable->uTypeCount); - - // keep track of the number of handles we've allocated - uint32_t uSatisfied = 0; - - // if this is a large number of handles then bypass the cache - if (uCount > SMALL_ALLOC_COUNT) - { - CrstHolder ch(&pTable->Lock); - - // allocate handles in bulk from the main handle table - uSatisfied = TableAllocBulkHandles(pTable, uType, pHandles, uCount); - } - - // do we still need to get some handles? - if (uSatisfied < uCount) - { - // get some handles from the cache - uSatisfied += TableAllocHandlesFromCache(pTable, uType, pHandles + uSatisfied, uCount - uSatisfied); - } - -#if defined(ENABLE_PERF_COUNTERS) || defined(FEATURE_EVENT_TRACE) - g_dwHandles += uSatisfied; -#endif // ENABLE_PERF_COUNTERS || FEATURE_EVENT_TRACE - -#ifdef GC_PROFILING - { - BEGIN_PIN_PROFILER(CORProfilerTrackGC()); - for (uint32_t i = 0; i < uSatisfied; i++) - g_profControlBlock.pProfInterface->HandleCreated((uintptr_t)pHandles[i], 0); - END_PIN_PROFILER(); - } -#endif //GC_PROFILING - - // return the number of handles we allocated - return uSatisfied; -} - - -/* - * HndDestroyHandles - * - * Entrypoint for freeing handles in bulk. - * - */ -void HndDestroyHandles(HHANDLETABLE hTable, uint32_t uType, const OBJECTHANDLE *pHandles, uint32_t uCount) -{ - WRAPPER_NO_CONTRACT; - -#ifdef _DEBUG - ValidateAppDomainForHandle(pHandles[0]); -#endif - - // fetch the handle table pointer - HandleTable *pTable = Table(hTable); - - // sanity check the type index - _ASSERTE(uType < pTable->uTypeCount); - -#ifdef GC_PROFILING - { - BEGIN_PIN_PROFILER(CORProfilerTrackGC()); - for (uint32_t i = 0; i < uCount; i++) - g_profControlBlock.pProfInterface->HandleDestroyed((uintptr_t)pHandles[i]); - END_PIN_PROFILER(); - } -#endif - -#if defined(ENABLE_PERF_COUNTERS) || defined(FEATURE_EVENT_TRACE) - g_dwHandles -= uCount; -#endif // ENABLE_PERF_COUNTERS || FEATURE_EVENT_TRACE - - // is this a small number of handles? - if (uCount <= SMALL_ALLOC_COUNT) - { - // yes - free them via the handle cache - TableFreeHandlesToCache(pTable, uType, pHandles, uCount); - return; - } - - // acquire the handle manager lock - { - CrstHolder ch(&pTable->Lock); - - // free the unsorted handles in bulk to the main handle table - TableFreeBulkUnpreparedHandles(pTable, uType, pHandles, uCount); - } -} - /* * HndSetHandleExtraInfo * diff --git a/src/gc/handletable.h b/src/gc/handletable.h index ebf8c62c33..aff9f160c9 100644 --- a/src/gc/handletable.h +++ b/src/gc/handletable.h @@ -75,12 +75,6 @@ void HndDestroyHandle(HHANDLETABLE hTable, uint32_t uType, OBJECTHAND void HndDestroyHandleOfUnknownType(HHANDLETABLE hTable, OBJECTHANDLE handle); /* - * bulk handle allocation and deallocation - */ -uint32_t HndCreateHandles(HHANDLETABLE hTable, uint32_t uType, OBJECTHANDLE *pHandles, uint32_t uCount); -void HndDestroyHandles(HHANDLETABLE hTable, uint32_t uType, const OBJECTHANDLE *pHandles, uint32_t uCount); - -/* * owner data associated with handles */ void HndSetHandleExtraInfo(OBJECTHANDLE handle, uint32_t uType, uintptr_t lExtraInfo); |