re-enable com for local gc (#19681)
authorDavid Mason <davmason@microsoft.com>
Tue, 28 Aug 2018 04:27:03 +0000 (21:27 -0700)
committerJan Kotas <jkotas@microsoft.com>
Tue, 28 Aug 2018 04:27:03 +0000 (21:27 -0700)
* re-enable com for local gc

* Use RefCountedHandleCallbacks instead of new api

src/gc/env/gcenv.ee.h
src/gc/objecthandle.cpp
src/vm/gcenv.ee.cpp

index ebe3046..1fb840d 100644 (file)
@@ -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__
index 09460d2..d6ca8a5 100644 (file)
 
 #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;
index cdc3a68..41daaff 100644 (file)
@@ -256,9 +256,8 @@ bool GCToEEInterface::RefCountedHandleCallbacks(Object * pObject)
 #ifdef FEATURE_COMINTEROP
     //<REVISIT_TODO>@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 *>(appDomain);
     return realPtr->IsRudeUnload() != FALSE;
 }
-