CrstAssemblyIdentityCache = 5,
CrstAssemblyList = 6,
CrstAssemblyLoader = 7,
- CrstAssemblyUsageLog = 8,
- CrstAvailableClass = 9,
- CrstAvailableParamTypes = 10,
- CrstBaseDomain = 11,
- CrstCCompRC = 12,
- CrstCer = 13,
- CrstClassFactInfoHash = 14,
- CrstClassInit = 15,
- CrstClrNotification = 16,
- CrstCLRPrivBinderMaps = 17,
- CrstCLRPrivBinderMapsAdd = 18,
- CrstCodeFragmentHeap = 19,
- CrstCOMWrapperCache = 20,
- CrstConnectionNameTable = 21,
- CrstContexts = 22,
- CrstCoreCLRBinderLog = 23,
- CrstCrstCLRPrivBinderLocalWinMDPath = 24,
- CrstCSPCache = 25,
- CrstDataTest1 = 26,
- CrstDataTest2 = 27,
- CrstDbgTransport = 28,
- CrstDeadlockDetection = 29,
- CrstDebuggerController = 30,
- CrstDebuggerFavorLock = 31,
- CrstDebuggerHeapExecMemLock = 32,
- CrstDebuggerHeapLock = 33,
- CrstDebuggerJitInfo = 34,
- CrstDebuggerMutex = 35,
- CrstDelegateToFPtrHash = 36,
- CrstDomainLocalBlock = 37,
- CrstDynamicIL = 38,
- CrstDynamicMT = 39,
- CrstDynLinkZapItems = 40,
- CrstEtwTypeLogHash = 41,
- CrstEventPipe = 42,
- CrstEventStore = 43,
- CrstException = 44,
- CrstExecuteManLock = 45,
- CrstExecuteManRangeLock = 46,
- CrstFCall = 47,
- CrstFriendAccessCache = 48,
- CrstFuncPtrStubs = 49,
- CrstFusionAppCtx = 50,
- CrstFusionAssemblyDownload = 51,
- CrstFusionBindContext = 52,
- CrstFusionBindResult = 53,
- CrstFusionClb = 54,
- CrstFusionClosure = 55,
- CrstFusionClosureGraph = 56,
- CrstFusionConfigSettings = 57,
- CrstFusionDownload = 58,
- CrstFusionIsoLibInit = 59,
- CrstFusionLoadContext = 60,
- CrstFusionLog = 61,
- CrstFusionNgenIndex = 62,
- CrstFusionNgenIndexPool = 63,
- CrstFusionPcyCache = 64,
- CrstFusionPolicyConfigPool = 65,
- CrstFusionSingleUse = 66,
- CrstFusionWarningLog = 67,
- CrstGCMemoryPressure = 68,
- CrstGlobalStrLiteralMap = 69,
- CrstHandleTable = 70,
- CrstHostAssemblyMap = 71,
- CrstHostAssemblyMapAdd = 72,
- CrstIbcProfile = 73,
- CrstIJWFixupData = 74,
- CrstIJWHash = 75,
- CrstILFingerprintCache = 76,
- CrstILStubGen = 77,
- CrstInlineTrackingMap = 78,
- CrstInstMethodHashTable = 79,
- CrstInterfaceVTableMap = 80,
- CrstInterop = 81,
- CrstInteropData = 82,
- CrstIOThreadpoolWorker = 83,
- CrstIsJMCMethod = 84,
- CrstISymUnmanagedReader = 85,
- CrstJit = 86,
- CrstJitGenericHandleCache = 87,
- CrstJitPerf = 88,
- CrstJumpStubCache = 89,
- CrstLeafLock = 90,
- CrstListLock = 91,
- CrstLoaderAllocator = 92,
- CrstLoaderAllocatorReferences = 93,
- CrstLoaderHeap = 94,
- CrstMda = 95,
- CrstMetadataTracker = 96,
- CrstModIntPairList = 97,
- CrstModule = 98,
- CrstModuleFixup = 99,
- CrstModuleLookupTable = 100,
- CrstMulticoreJitHash = 101,
- CrstMulticoreJitManager = 102,
- CrstMUThunkHash = 103,
- CrstNativeBinderInit = 104,
- CrstNativeImageCache = 105,
- CrstNls = 106,
- CrstNotifyGdb = 107,
- CrstObjectList = 108,
- CrstOnEventManager = 109,
- CrstPatchEntryPoint = 110,
- CrstPEFileSecurityManager = 111,
- CrstPEImage = 112,
- CrstPEImagePDBStream = 113,
- CrstPendingTypeLoadEntry = 114,
- CrstPinHandle = 115,
- CrstPinnedByrefValidation = 116,
- CrstProfilerGCRefDataFreeList = 117,
- CrstProfilingAPIStatus = 118,
- CrstPublisherCertificate = 119,
- CrstRCWCache = 120,
- CrstRCWCleanupList = 121,
- CrstRCWRefCache = 122,
+ CrstAvailableClass = 8,
+ CrstAvailableParamTypes = 9,
+ CrstBaseDomain = 10,
+ CrstCCompRC = 11,
+ CrstCer = 12,
+ CrstClassFactInfoHash = 13,
+ CrstClassInit = 14,
+ CrstClrNotification = 15,
+ CrstCLRPrivBinderMaps = 16,
+ CrstCLRPrivBinderMapsAdd = 17,
+ CrstCodeFragmentHeap = 18,
+ CrstCOMWrapperCache = 19,
+ CrstConnectionNameTable = 20,
+ CrstContexts = 21,
+ CrstCoreCLRBinderLog = 22,
+ CrstCrstCLRPrivBinderLocalWinMDPath = 23,
+ CrstCSPCache = 24,
+ CrstDataTest1 = 25,
+ CrstDataTest2 = 26,
+ CrstDbgTransport = 27,
+ CrstDeadlockDetection = 28,
+ CrstDebuggerController = 29,
+ CrstDebuggerFavorLock = 30,
+ CrstDebuggerHeapExecMemLock = 31,
+ CrstDebuggerHeapLock = 32,
+ CrstDebuggerJitInfo = 33,
+ CrstDebuggerMutex = 34,
+ CrstDelegateToFPtrHash = 35,
+ CrstDomainLocalBlock = 36,
+ CrstDynamicIL = 37,
+ CrstDynamicMT = 38,
+ CrstDynLinkZapItems = 39,
+ CrstEtwTypeLogHash = 40,
+ CrstEventPipe = 41,
+ CrstEventStore = 42,
+ CrstException = 43,
+ CrstExecuteManLock = 44,
+ CrstExecuteManRangeLock = 45,
+ CrstFCall = 46,
+ CrstFriendAccessCache = 47,
+ CrstFuncPtrStubs = 48,
+ CrstFusionAppCtx = 49,
+ CrstFusionAssemblyDownload = 50,
+ CrstFusionBindContext = 51,
+ CrstFusionBindResult = 52,
+ CrstFusionClb = 53,
+ CrstFusionClosure = 54,
+ CrstFusionClosureGraph = 55,
+ CrstFusionConfigSettings = 56,
+ CrstFusionDownload = 57,
+ CrstFusionIsoLibInit = 58,
+ CrstFusionLoadContext = 59,
+ CrstFusionLog = 60,
+ CrstFusionNgenIndex = 61,
+ CrstFusionNgenIndexPool = 62,
+ CrstFusionPcyCache = 63,
+ CrstFusionPolicyConfigPool = 64,
+ CrstFusionSingleUse = 65,
+ CrstFusionWarningLog = 66,
+ CrstGCMemoryPressure = 67,
+ CrstGlobalStrLiteralMap = 68,
+ CrstHandleTable = 69,
+ CrstHostAssemblyMap = 70,
+ CrstHostAssemblyMapAdd = 71,
+ CrstIbcProfile = 72,
+ CrstIJWFixupData = 73,
+ CrstIJWHash = 74,
+ CrstILFingerprintCache = 75,
+ CrstILStubGen = 76,
+ CrstInlineTrackingMap = 77,
+ CrstInstMethodHashTable = 78,
+ CrstInterfaceVTableMap = 79,
+ CrstInterop = 80,
+ CrstInteropData = 81,
+ CrstIOThreadpoolWorker = 82,
+ CrstIsJMCMethod = 83,
+ CrstISymUnmanagedReader = 84,
+ CrstJit = 85,
+ CrstJitGenericHandleCache = 86,
+ CrstJitPerf = 87,
+ CrstJumpStubCache = 88,
+ CrstLeafLock = 89,
+ CrstListLock = 90,
+ CrstLoaderAllocator = 91,
+ CrstLoaderAllocatorReferences = 92,
+ CrstLoaderHeap = 93,
+ CrstMda = 94,
+ CrstMetadataTracker = 95,
+ CrstModIntPairList = 96,
+ CrstModule = 97,
+ CrstModuleFixup = 98,
+ CrstModuleLookupTable = 99,
+ CrstMulticoreJitHash = 100,
+ CrstMulticoreJitManager = 101,
+ CrstMUThunkHash = 102,
+ CrstNativeBinderInit = 103,
+ CrstNativeImageCache = 104,
+ CrstNls = 105,
+ CrstNotifyGdb = 106,
+ CrstObjectList = 107,
+ CrstOnEventManager = 108,
+ CrstPatchEntryPoint = 109,
+ CrstPEFileSecurityManager = 110,
+ CrstPEImage = 111,
+ CrstPEImagePDBStream = 112,
+ CrstPendingTypeLoadEntry = 113,
+ CrstPinHandle = 114,
+ CrstPinnedByrefValidation = 115,
+ CrstProfilerGCRefDataFreeList = 116,
+ CrstProfilingAPIStatus = 117,
+ CrstPublisherCertificate = 118,
+ CrstRCWCache = 119,
+ CrstRCWCleanupList = 120,
+ CrstRCWRefCache = 121,
+ CrstReadyToRunEntryPointToMethodDescMap = 122,
CrstReDacl = 123,
CrstReflection = 124,
CrstReJITDomainTable = 125,
0, // CrstAssemblyIdentityCache
0, // CrstAssemblyList
7, // CrstAssemblyLoader
- 0, // CrstAssemblyUsageLog
3, // CrstAvailableClass
6, // CrstAvailableParamTypes
7, // CrstBaseDomain
3, // CrstRCWCache
0, // CrstRCWCleanupList
3, // CrstRCWRefCache
+ 3, // CrstReadyToRunEntryPointToMethodDescMap
0, // CrstReDacl
9, // CrstReflection
7, // CrstReJITDomainTable
"CrstAssemblyIdentityCache",
"CrstAssemblyList",
"CrstAssemblyLoader",
- "CrstAssemblyUsageLog",
"CrstAvailableClass",
"CrstAvailableParamTypes",
"CrstBaseDomain",
"CrstRCWCache",
"CrstRCWCleanupList",
"CrstRCWRefCache",
+ "CrstReadyToRunEntryPointToMethodDescMap",
"CrstReDacl",
"CrstReflection",
"CrstReJITDomainTable",
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Threading;
+
+internal static class Program
+{
+ private static int Main()
+ {
+ // Verify crst levels with GCs triggered during R2R code lookup in the Prestub on the main thread, during which dynamic
+ // code from a background thread is deleted at the start of the GC in the main thread
+
+ var t = new Thread(() =>
+ {
+ for (uint i = 0; ; ++i)
+ {
+ DynamicMethod dynamicMethod = CreateDynamicMethod($"DynMethod{i}");
+ var dynamicMethodDelegate = (Action)dynamicMethod.CreateDelegate(typeof(Action));
+ dynamicMethodDelegate();
+ }
+ });
+ t.IsBackground = true;
+ t.Start();
+
+ for (int i = 0; i < 100; ++i)
+ {
+ typeof(Program).InvokeMember(
+ $"Func{i}",
+ BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Static,
+ null,
+ null,
+ Array.Empty<object>());
+ }
+
+ return 100;
+ }
+
+ private static DynamicMethod CreateDynamicMethod(string name)
+ {
+ var dynamicMethod = new DynamicMethod(name, null, null);
+ ILGenerator ilGenerator = dynamicMethod.GetILGenerator();
+ ilGenerator.Emit(OpCodes.Ret);
+ return dynamicMethod;
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func0() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func1() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func2() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func3() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func4() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func5() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func6() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func7() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func8() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func9() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func10() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func11() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func12() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func13() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func14() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func15() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func16() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func17() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func18() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func19() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func20() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func21() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func22() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func23() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func24() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func25() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func26() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func27() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func28() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func29() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func30() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func31() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func32() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func33() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func34() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func35() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func36() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func37() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func38() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func39() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func40() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func41() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func42() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func43() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func44() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func45() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func46() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func47() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func48() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func49() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func50() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func51() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func52() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func53() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func54() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func55() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func56() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func57() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func58() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func59() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func60() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func61() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func62() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func63() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func64() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func65() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func66() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func67() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func68() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func69() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func70() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func71() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func72() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func73() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func74() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func75() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func76() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func77() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func78() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func79() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func80() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func81() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func82() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func83() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func84() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func85() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func86() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func87() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func88() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func89() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func90() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func91() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func92() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func93() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func94() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func95() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func96() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func97() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func98() {}
+ [MethodImpl(MethodImplOptions.NoInlining)] private static void Func99() {}
+}