diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2018-12-01 10:31:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-01 10:31:35 +0100 |
commit | 4c461d754ff29d1ba37c145676c397062378d1c0 (patch) | |
tree | 3f31b4015f010054dae1b5bd2f2a516915d0fe74 /src/vm/loaderallocator.hpp | |
parent | 9fca919fdc8f20f80d923088620ec026196785bf (diff) | |
download | coreclr-4c461d754ff29d1ba37c145676c397062378d1c0.tar.gz coreclr-4c461d754ff29d1ba37c145676c397062378d1c0.tar.bz2 coreclr-4c461d754ff29d1ba37c145676c397062378d1c0.zip |
Enable COM interop for collectible classes (#20919)
* Enable COM interop for collectible classes
* Modify DispatchInfo to use LoaderAllocator handles
The DispatchMemberInfo was using global handles to refer to the managed
MemberInfo instances. That doesn't work with unloadability.
This change modifies it to use handles allocated from LoaderAllocator.
* Disable COM interop for WinRT types
* Remove collectible check from IsTypeVisibleFromCom. That fixes three
new COM interop tests
* Add collectible check to GetComClassFactory when we check for
unsupported interop with WinRT
* Add COM unloadability tests
Add two tests to test COM unloadability:
* One for using native COM server from managed COM client
* One for using managed COM objects from native client
* Add unloading test for IUnknownTest
* Disable NETClientPrimitivesInALC on Win ARM
The NETClientPrimitives is disabled there too.
Diffstat (limited to 'src/vm/loaderallocator.hpp')
-rw-r--r-- | src/vm/loaderallocator.hpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/vm/loaderallocator.hpp b/src/vm/loaderallocator.hpp index f2d729071b..a283721c37 100644 --- a/src/vm/loaderallocator.hpp +++ b/src/vm/loaderallocator.hpp @@ -129,6 +129,10 @@ class ListLockEntryBase; typedef ListLockEntryBase<void*> ListLockEntry; class UMEntryThunkCache; +#ifdef FEATURE_COMINTEROP +class ComCallWrapperCache; +#endif // FEATURE_COMINTEROP + class LoaderAllocator { VPTR_BASE_VTABLE_CLASS(LoaderAllocator) @@ -248,6 +252,18 @@ private: SList<FailedTypeInitCleanupListItem> m_failedTypeInitCleanupList; SegmentedHandleIndexStack m_freeHandleIndexesStack; +#ifdef FEATURE_COMINTEROP + // The wrapper cache for this loader allocator - it has its own CCacheLineAllocator on a per loader allocator basis + // to allow the loader allocator to go away and eventually kill the memory when all refs are gone + + VolatilePtr<ComCallWrapperCache> m_pComCallWrapperCache; + // Used for synchronizing creation of the m_pComCallWrapperCache + CrstExplicitInit m_ComCallWrapperCrst; + // Hash table that maps a MethodTable to COM Interop compatibility data. + PtrHashMap m_interopDataHash; + // Used for synchronizing access to the m_interopDataHash + CrstExplicitInit m_InteropDataCrst; +#endif #ifndef DACCESS_COMPILE @@ -509,6 +525,7 @@ public: void InitVirtualCallStubManager(BaseDomain *pDomain); void UninitVirtualCallStubManager(); + #ifndef CROSSGEN_COMPILE inline VirtualCallStubManager *GetVirtualCallStubManager() { @@ -530,6 +547,30 @@ public: LIMITED_METHOD_CONTRACT; return &m_ILStubCache; } + +#ifdef FEATURE_COMINTEROP + + ComCallWrapperCache * GetComCallWrapperCache(); + + void ResetComCallWrapperCache() + { + LIMITED_METHOD_CONTRACT; + m_pComCallWrapperCache = NULL; + } + +#ifndef DACCESS_COMPILE + + // Look up interop data for a method table + // Returns the data pointer if present, NULL otherwise + InteropMethodTableData *LookupComInteropData(MethodTable *pMT); + + // Returns TRUE if successfully inserted, FALSE if this would be a duplicate entry + BOOL InsertComInteropData(MethodTable* pMT, InteropMethodTableData *pData); + +#endif // DACCESS_COMPILE + +#endif // FEATURE_COMINTEROP + }; // class LoaderAllocator typedef VPTR(LoaderAllocator) PTR_LoaderAllocator; |