From 73dce169c0cc1a48fe935ecd42a83f9bdb6f61b8 Mon Sep 17 00:00:00 2001 From: David Mason Date: Mon, 27 Aug 2018 21:27:03 -0700 Subject: [PATCH] re-enable com for local gc (dotnet/coreclr#19681) * re-enable com for local gc * Use RefCountedHandleCallbacks instead of new api Commit migrated from https://github.com/dotnet/coreclr/commit/00ab7387d849da889ebf6aac432ec989091bacec --- src/coreclr/src/gc/env/gcenv.ee.h | 2 +- src/coreclr/src/gc/objecthandle.cpp | 11 ++--------- src/coreclr/src/vm/gcenv.ee.cpp | 4 +--- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/coreclr/src/gc/env/gcenv.ee.h b/src/coreclr/src/gc/env/gcenv.ee.h index ebe3046..1fb840d 100644 --- a/src/coreclr/src/gc/env/gcenv.ee.h +++ b/src/coreclr/src/gc/env/gcenv.ee.h @@ -91,7 +91,7 @@ public: static bool AppDomainCanAccessHandleTable(uint32_t appDomainID); static uint32_t GetIndexOfAppDomainBeingUnloaded(); static uint32_t GetTotalNumSizedRefHandles(); - static bool GCToEEInterface::AppDomainIsRudeUnload(void *appDomain); + static bool AppDomainIsRudeUnload(void *appDomain); }; #endif // __GCENV_EE_H__ diff --git a/src/coreclr/src/gc/objecthandle.cpp b/src/coreclr/src/gc/objecthandle.cpp index 09460d2..d6ca8a5 100644 --- a/src/coreclr/src/gc/objecthandle.cpp +++ b/src/coreclr/src/gc/objecthandle.cpp @@ -21,12 +21,6 @@ #include "gchandletableimpl.h" -#ifndef BUILD_AS_STANDALONE -#ifdef FEATURE_COMINTEROP -#include "comcallablewrapper.h" -#endif // FEATURE_COMINTEROP -#endif // BUILD_AS_STANDALONE - HandleTableMap g_HandleTableMap; // Array of contexts used while scanning dependent handles for promotion. There are as many contexts as GC @@ -469,13 +463,12 @@ void CALLBACK ScanPointerForProfilerAndETW(_UNCHECKED_OBJECTREF *pObjRef, uintpt #endif break; -#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_REDHAWK) && !defined(BUILD_AS_STANDALONE) +#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_REDHAWK) case HNDTYPE_REFCOUNTED: rootFlags |= kEtwGCRootFlagsRefCounted; if (*pRef != NULL) { - ComCallWrapper* pWrap = ComCallWrapper::GetWrapperForObject((OBJECTREF)*pRef); - if (pWrap == NULL || !pWrap->IsWrapperActive()) + if (!GCToEEInterface::RefCountedHandleCallbacks(*pRef)) rootFlags |= kEtwGCRootFlagsWeakRef; } break; diff --git a/src/coreclr/src/vm/gcenv.ee.cpp b/src/coreclr/src/vm/gcenv.ee.cpp index cdc3a68..41daaff 100644 --- a/src/coreclr/src/vm/gcenv.ee.cpp +++ b/src/coreclr/src/vm/gcenv.ee.cpp @@ -256,9 +256,8 @@ bool GCToEEInterface::RefCountedHandleCallbacks(Object * pObject) #ifdef FEATURE_COMINTEROP //@todo optimize the access to the ref-count ComCallWrapper* pWrap = ComCallWrapper::GetWrapperForObject((OBJECTREF)pObject); - _ASSERTE(pWrap != NULL); - return !!pWrap->IsWrapperActive(); + return pWrap != NULL && pWrap->IsWrapperActive(); #else return false; #endif @@ -1476,4 +1475,3 @@ bool GCToEEInterface::AppDomainIsRudeUnload(void *appDomain) AppDomain *realPtr = static_cast(appDomain); return realPtr->IsRudeUnload() != FALSE; } - -- 2.7.4