Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 671368e

Browse files
committed
Reflect feedback
1 parent 4794f37 commit 671368e

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

src/System.Private.CoreLib/Resources/Strings.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,9 +2884,6 @@
28842884
<data name="NotSupported_CollectibleBoundNonCollectible" xml:space="preserve">
28852885
<value>A non-collectible assembly may not reference a collectible assembly.</value>
28862886
</data>
2887-
<data name="NotSupported_CollectibleCOM" xml:space="preserve">
2888-
<value>COM Interop is not supported for collectible types.</value>
2889-
</data>
28902887
<data name="NotSupported_CreateInstanceWithTypeBuilder" xml:space="preserve">
28912888
<value>CreateInstance cannot be used with an object of type TypeBuilder.</value>
28922889
</data>

src/inc/crsttypes.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ enum CrstType
189189
CrstVSDIndirectionCellLock = 170,
190190
CrstWinRTFactoryCache = 171,
191191
CrstWrapperTemplate = 172,
192-
kNumberOfCrstTypes = 173
192+
CrstComCallWrapper = 173,
193+
kNumberOfCrstTypes = 174
193194
};
194195

195196
#endif // __CRST_TYPES_INCLUDED
@@ -373,6 +374,7 @@ int g_rgCrstLevelMap[] =
373374
3, // CrstVSDIndirectionCellLock
374375
3, // CrstWinRTFactoryCache
375376
3, // CrstWrapperTemplate
377+
0, // CrstComCallWrapper
376378
};
377379

378380
// An array mapping CrstType to a stringized name.
@@ -551,6 +553,7 @@ LPCSTR g_rgCrstNameMap[] =
551553
"CrstVSDIndirectionCellLock",
552554
"CrstWinRTFactoryCache",
553555
"CrstWrapperTemplate",
556+
"CrstComCallWrapper",
554557
};
555558

556559
// Define a special level constant for unordered locks.

src/vm/comcallablewrapper.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,11 +2273,11 @@ ComCallWrapper* ComCallWrapper::CopyFromTemplate(ComCallWrapperTemplate* pTempla
22732273
// num interfaces on the object
22742274
size_t numInterfaces = pTemplate->GetNumInterfaces();
22752275

2276-
// we have a template, create a wrapper and initialize from the template
2277-
// alloc wrapper, aligned 32 bytes
22782276
if (pWrapperCache->IsLoaderAllocatorUnloading())
22792277
COMPlusThrow(kAppDomainUnloadedException);
22802278

2279+
// we have a template, create a wrapper and initialize from the template
2280+
// alloc wrapper, aligned to cache line
22812281
NewCCWHolder pStartWrapper(pWrapperCache);
22822282
pStartWrapper = (ComCallWrapper*)pWrapperCache->GetCacheLineAllocator()->
22832283
#ifdef _WIN64
@@ -3953,6 +3953,7 @@ ComCallWrapperCache *ComCallWrapperCache::Create(LoaderAllocator *pLoaderAllocat
39533953
GC_TRIGGERS;
39543954
MODE_ANY;
39553955
INJECT_FAULT(COMPlusThrowOM());
3956+
PRECONDITION(CheckPointer(pLoaderAllocator));
39563957
POSTCONDITION(CheckPointer(RETVAL));
39573958
}
39583959
CONTRACT_END;

src/vm/loaderallocator.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,7 @@ void LoaderAllocator::Init(BaseDomain *pDomain, BYTE *pExecutableHeapMemory)
10701070
m_crstLoaderAllocator.Init(CrstLoaderAllocator, (CrstFlags)CRST_UNSAFE_COOPGC);
10711071
#ifdef FEATURE_COMINTEROP
10721072
m_InteropDataCrst.Init(CrstInteropData, CRST_REENTRANCY);
1073+
m_ComCallWrapperCrst.Init(CrstComCallWrapper);
10731074
#endif
10741075

10751076
//
@@ -1346,6 +1347,10 @@ void LoaderAllocator::Terminate()
13461347
m_pUMEntryThunkCache = NULL;
13471348

13481349
m_crstLoaderAllocator.Destroy();
1350+
#ifdef FEATURE_COMINTEROP
1351+
m_ComCallWrapperCrst.Destroy();
1352+
m_InteropDataCrst.Destroy();
1353+
#endif
13491354
m_LoaderAllocatorReferences.RemoveAll();
13501355

13511356
// In collectible types we merge the low frequency and high frequency heaps
@@ -1934,7 +1939,6 @@ void AssemblyLoaderAllocator::ReleaseManagedAssemblyLoadContext()
19341939
}
19351940

19361941
#ifdef FEATURE_COMINTEROP
1937-
// TODO: should it rather go to AssemblyLoaderAllocator?
19381942
ComCallWrapperCache * LoaderAllocator::GetComCallWrapperCache()
19391943
{
19401944
CONTRACTL
@@ -1948,8 +1952,7 @@ ComCallWrapperCache * LoaderAllocator::GetComCallWrapperCache()
19481952

19491953
if (!m_pComCallWrapperCache)
19501954
{
1951-
// BaseDomain::LockHolder lh(this);
1952-
// TODO: add a lock
1955+
CrstHolder lh(&m_ComCallWrapperCrst);
19531956

19541957
if (!m_pComCallWrapperCache)
19551958
m_pComCallWrapperCache = ComCallWrapperCache::Create(this);

src/vm/loaderallocator.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,9 @@ class LoaderAllocator
256256
// The wrapper cache for this loader allocator - it has its own CCacheLineAllocator on a per loader allocator basis
257257
// to allow the loader allocator to go away and eventually kill the memory when all refs are gone
258258

259-
// TODO: is the volatile needed? The AppDomain version didn't have one
260259
VolatilePtr<ComCallWrapperCache> m_pComCallWrapperCache;
260+
// Used for synchronizing creation of the m_pComCallWrapperCache
261+
CrstExplicitInit m_ComCallWrapperCrst;
261262
// Hash table that maps a MethodTable to COM Interop compatibility data.
262263
PtrHashMap m_interopDataHash;
263264
// Used for synchronizing access to the m_interopDataHash

0 commit comments

Comments
 (0)