Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CrstTypes.def « inc « coreclr « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 279118f3012ae4cbf058b781af06ef246c1f0b54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

//
// This file is used to describe the different types of Crst and their dependencies on other Crst types (in
// terms of which types may be legally held while others are acquired).
//
// The CrstTypeTool utility is used to parse this file, verify that there are no logical inconsistencies (such
// as a cycle in the dependencies) and generate an enum value and numerical ranking for each type. This
// ranking is used by the runtime (in checked builds) to verify that none of the rules described below are
// violated (which could lead to a deadlock).
//
// When you add a new Crst type you need to be aware of which Crst types may be already held when your Crst is
// acquired and which other types may be subsequently acquired. You can then add a Crst definition to this
// file and annotate it with those dependencies. Running CrstTypeTool will check to see if this introduces a
// potential deadlock problem and if everything checks out will generate a new version of
// file:CrstTypes.h (be sure to check this file out from TFS/SD before running CrstTypeTool).
//
// The format of this file is a very simple language. Comments are introduced with '//' and continue to the
// end of the line. Keywords are case insensitive (Crst type names, however, are case sensitive since they'll
// be translated directly to C++ enum values). Crst type names are used without the 'Crst' prefix used in C++
// code (e.g. CrstAppDomainCache is referred to as AppDomainCache). The following words are reserved keywords
// and may not be used as the names of Crst types:
//      Crst
//      End
//      AcquiredBefore
//      AcquiredAfter
//      Unordered
//      SameLevelAs
//
// Each Crst type definition has the following format (where [] indicates optional and ... indicates zero or
// more repetitions):
//      Crst <type name>
//          [AcquiredBefore <type name>...]
//          [AcquiredAfter <type name>...]
//          [SameLevelAs <type name>...]
//          [Unordered]
//      End
//
// For example:
//      Crst Foo
//          AcquiredBefore Bar
//          AcquiredAfter Zob Baz
//          SameLevelAs Foo
//      End
//
// This introduces a new Crst type Foo (CrstFoo inside the runtime). This type may be legally acquired when
// the current thread holds Crst instances of type Zob, Bar or even other instances of Foo. While Foo is held
// it is legal to acquire Crsts of type Bar. Assuming that this definition does not introduce any dependency
// cycles, CrstTypeTool will assign a numeric rank to CrstFoo that maximizes the chance that any other Crst
// type interaction you didn't explicitly specify (e.g. holding Foo while taking a Crst of type Wibble) will
// generate a ranking violation assert in the checked build.
//
// Note that the following set of definitions:
//      Crst A AcquiredBefore B End
//      Crst B End
//
//      Crst A End
//      Crst B AcquiredAfter A End
//
//      Crst A AcquiredBefore B End
//      Crst B AcquiredAfter A End
//
// are all equivalent. You are free to use whichever variant seems clearest to you (CrstTypeTool will tell you
// if you introduce conflicting rules). Similarly "A SameLevelAs B" implies "B SameLevelAs A". The initial
// contents of this file uses AcquiredBefore in preference to AcquiredAfter purely because it was generated
// automatically by a profiling mechanism (the initial rules were seeded from observations of Crst usage while
// running our test suites). Feel free to add meaningful comments to existing rules if you feel they can
// usefully clarify the reasons for particular dependencies.
//
// See CrstTypeTool.cs for how to consume this file.
//
// Each Crst type definition is currently in alphabetical order. Please maintain this convention.
//

Crst AppDomainCache
    AcquiredBefore UniqueStack UnresolvedClassLock
End

Crst AppDomainHandleTable
    AcquiredBefore AvailableParamTypes HandleTable IbcProfile SyncBlockCache SystemDomainDelayedUnloadList
                   ThreadStore SystemDomain
End

Crst ArgBasedStubCache
End

Crst AssemblyLoader
    AcquiredBefore DeadlockDetection UniqueStack DebuggerMutex
End

Crst AvailableClass
    AcquiredBefore LoaderHeap
End

Crst AvailableParamTypes
    AcquiredBefore ModuleLookupTable IbcProfile LoaderHeap
End

Crst BaseDomain
    AcquiredBefore LoaderHeap UniqueStack
End

Crst CCompRC
    Unordered
End

Crst ClassFactInfoHash
    AcquiredBefore SyncBlockCache ThreadStore
End

Crst ClassInit
    AcquiredBefore DeadlockDetection IbcProfile
    SameLevelAs Jit
End

Crst ClrNotification
    Unordered
End

Crst COMWrapperCache
    AcquiredBefore HandleTable UniqueStack
End

Crst DeadlockDetection
End

Crst DebuggerController
    // AcquiredBefore DebuggerHeapLock DebuggerJitInfo LoaderHeap

    // See bug: 581892. This has a conflict with CrstInstMethodHashTableRanking.
    // The controller logic will be moved to OOP in V3, and so this lock will no longer be necessary.
    // Fixing this in-proc would be difficult, and it would all be throwaway as we go oop.
    Unordered
End

// This is a leaf debugger lock.
Crst DebuggerFavorLock
    AcquiredAfter DebuggerJitInfo DebuggerMutex
End

// This is the lock used by the DebuggerHeapExecutableMemoryAllocator for allocating/freeing memory.
Crst DebuggerHeapExecMemLock
End

// Debugger Heap lock is the smallest of the debugger locks.
Crst DebuggerHeapLock
    AcquiredAfter DebuggerFavorLock DebuggerJitInfo DebuggerMutex
    // Disabled per bug 581892
    // AcquiredAfter DebuggerController
End

Crst DebuggerJitInfo
    AcquiredBefore DebuggerHeapLock
End

// This is the major debugger lock.
// It's the largest of the debugger locks.
Crst DebuggerMutex
    AcquiredBefore AvailableParamTypes
                   DynamicIL LoaderHeap ModuleLookupTable

    // Disabled per bug 581892
    // AcquiredBefore DebuggerController
    AcquiredBefore DebuggerHeapLock DebuggerJitInfo

End

// This lock is used only for testing data consistency (see code:DataTest::TestDataSafety)
// and is released before taking any other lock except for CrstDataTest2
Crst DataTest1
    AcquiredAfter DebuggerMutex
End

// This lock is used only for testing data consistency (see code:DataTest::TestDataSafety)
// and is released before taking any other lockCrst DataTest2
Crst DataTest2
    AcquiredAfter DataTest1
End

Crst DbgTransport
End

Crst DelegateToFPtrHash
End

Crst DomainLocalBlock
    AcquiredBefore AppDomainHandleTable IbcProfile LoaderHeap SystemDomainDelayedUnloadList UniqueStack
End

Crst DynamicIL
End

Crst DynamicMT
    AcquiredBefore IbcProfile
End

Crst EventStore
End

Crst Exception
End

Crst ExecutableAllocatorLock
    AcquiredAfter LoaderHeap ArgBasedStubCache UMEntryThunkFreeListLock
End

Crst ExecuteManRangeLock
    AcquiredAfter NativeImageEagerFixups
End

Crst FCall
    AcquiredBefore LoaderHeap
End

Crst RetThunkCache
    AcquiredBefore LoaderHeap
End

Crst FuncPtrStubs
    AcquiredBefore IbcProfile LoaderHeap UniqueStack CodeFragmentHeap JumpStubCache
End

Crst FusionAppCtx
    AcquiredBefore PEImage
End

Crst GCCover
    AcquiredBefore LoaderHeap CodeVersioning
End

Crst GlobalStrLiteralMap
    AcquiredBefore HandleTable IbcProfile SyncBlockCache SystemDomainDelayedUnloadList ThreadStore UniqueStack
End

Crst HandleTable
    SameLevelAs HandleTable
End

Crst IbcProfile
End

Crst IJWFixupData
    AcquiredBefore FuncPtrStubs IJWHash LoaderHeap
End

Crst IJWHash
End

Crst ILStubGen
    AcquiredBefore DeadlockDetection UniqueStack
End

Crst InstMethodHashTable
    AcquiredBefore LoaderHeap UniqueStack JumpStubCache
End

Crst Interop
    AcquiredBefore AppDomainHandleTable AvailableParamTypes ClassInit DeadlockDetection DomainLocalBlock
                   HandleTable InstMethodHashTable InteropData JitGenericHandleCache LoaderHeap SigConvert
                   StubDispatchCache StubUnwindInfoHeapSegments SyncBlockCache TypeIDMap UnresolvedClassLock
                   PendingTypeLoadEntry
End

Crst InteropData
    AcquiredBefore LoaderHeap UniqueStack
End

Crst IsJMCMethod
End

Crst ISymUnmanagedReader
    AcquiredBefore UniqueStack JumpStubCache
End

Crst Jit
    AcquiredBefore DeadlockDetection JumpStubCache
    SameLevelAs ClassInit
End

Crst JitGenericHandleCache
End

Crst JitPatchpoint
    AcquiredBefore LoaderHeap
End

Crst JitPerf
    Unordered
End

Crst JumpStubCache
    AcquiredBefore ExecuteManRangeLock LoaderHeap SingleUseLock
    AcquiredAfter AppDomainCache
                  ILStubGen ThreadpoolTimerQueue ThreadpoolWaitThreads
                  TypeIDMap BaseDomain AssemblyLoader
End

Crst ListLock
    Unordered
End

// Leaflock leveling, used for crsts that explicitly want to be a leaf lock
Crst LeafLock
End

Crst LoaderAllocator
    AcquiredBefore AppDomainHandleTable HandleTable UniqueStack ThreadStore
    AcquiredAfter DomainLocalBlock
End

Crst LoaderAllocatorReferences
    AcquiredBefore LoaderAllocator
    AcquiredAfter PendingTypeLoadEntry InstMethodHashTable
End

Crst AssemblyList
    AcquiredAfter LoaderAllocatorReferences ThreadStore AssemblyLoader
End

Crst LoaderHeap
End

Crst StubCache
    AcquiredBefore LoaderHeap
End

Crst ManagedObjectWrapperMap
    AcquiredBefore HandleTable
End

Crst Module
    AcquiredBefore LoaderHeap UniqueStack
End

Crst ModuleFixup
    AcquiredBefore AppDomainHandleTable GlobalStrLiteralMap IbcProfile SyncBlockCache
End

Crst ModuleLookupTable
    AcquiredBefore LoaderHeap
End

Crst Nls
End

Crst ObjectList
    SameLevelAs ObjectList
End

Crst PEImage
    AcquiredBefore UniqueStack
End

Crst PendingTypeLoadEntry
    AcquiredBefore AppDomainCache AppDomainHandleTable AssemblyLoader AvailableClass AvailableParamTypes
                   BaseDomain ClassInit DeadlockDetection DebuggerController DebuggerJitInfo DebuggerMutex
                   DomainLocalBlock Exception ExecuteManRangeLock FuncPtrStubs
                   FusionAppCtx GlobalStrLiteralMap HandleTable IbcProfile
                   IJWFixupData IJWHash ISymUnmanagedReader Jit JumpStubCache LoaderHeap
                   Module ModuleLookupTable PEImage SecurityStackwalkCache
                   SigConvert SingleUseLock StubDispatchCache StubUnwindInfoHeapSegments
                   SyncBlockCache SystemDomain ThreadIdDispenser ThreadStore TypeIDMap UnresolvedClassLock
    SameLevelAs PendingTypeLoadEntry
End

// ProfilerGCRefDataFreeList synchronizes access to the profiler API's list of
// free, previously allocated structures that track moved references and
// root references during a GC.
Crst ProfilerGCRefDataFreeList
End

// ProfilingAPIStatus serializes attempts to transition the global status
// from state to state, and access to the ProfilerDetachInfo structure
// between the thread executing DetachProfiler(), and the DetachThread
// carrying out the evacuation order.
Crst ProfilingAPIStatus
    AcquiredBefore ThreadStore
End

Crst RCWCache
    AcquiredBefore IbcProfile LoaderHeap RCWCleanupList
End

Crst RCWCleanupList
End

Crst ExternalObjectContextCache
End

Crst Reflection
    AcquiredBefore LoaderHeap UnresolvedClassLock
End

// Used to synchronize all rejit information stored in a given AppDomain.
Crst CodeVersioning
    AcquiredBefore LoaderHeap SingleUseLock DeadlockDetection JumpStubCache DebuggerController FuncPtrStubs
    AcquiredAfter ReJITGlobalRequest ThreadStore GlobalStrLiteralMap SystemDomain DebuggerMutex MethodDescBackpatchInfoTracker
                ReadyToRunEntryPointToMethodDescMap ClassInit AppDomainCache TypeIDMap FusionAppCtx
End

// Used to synchronize all global requests (which may span multiple AppDomains) which add
// new functions to rejit tables, or request Reverts on existing functions in the rejit
// tables.  One of these crsts exist per runtime.
Crst ReJITGlobalRequest
    AcquiredBefore ThreadStore CodeVersioning SystemDomain JitInlineTrackingMap
End

// ETW infrastructure uses this crst to protect a hash table of TypeHandles which is
// used to remember which types have been logged (to avoid duplicate logging of the
// same type).
Crst EtwTypeLogHash
    AcquiredAfter SingleUseLock
End

Crst SavedExceptionInfo
    AcquiredBefore DebuggerController
End

Crst SaveModuleProfileData
End

Crst SecurityStackwalkCache
End

Crst SigConvert
    AcquiredBefore LoaderHeap
End

Crst SingleUseLock
    AcquiredBefore ExecuteManRangeLock LoaderHeap UniqueStack DebuggerJitInfo
End

Crst UnwindInfoTableLock
    AcquiredAfter StubUnwindInfoHeapSegments SingleUseLock
    AcquiredBefore StressLog
End

Crst SpecialStatics
End

Crst StressLog
    Unordered
End

Crst CodeFragmentHeap
    AcquiredBefore SingleUseLock
End

Crst StubDispatchCache
End

Crst StubUnwindInfoHeapSegments
    AcquiredAfter StubCache
End

Crst SyncBlockCache
    AcquiredBefore ThreadIdDispenser
End

Crst SyncHashLock
End

Crst SystemBaseDomain
    AcquiredBefore LoaderHeap UniqueStack
End

Crst SystemDomain
    AcquiredBefore DebuggerMutex HandleTable IbcProfile SaveModuleProfileData
                   ThreadIdDispenser ThreadStore
End

Crst SystemDomainDelayedUnloadList
End

Crst ThreadIdDispenser
End

Crst ThreadpoolTimerQueue
    AcquiredBefore UniqueStack
End

Crst ThreadpoolWaitThreads
    AcquiredBefore UniqueStack
End

Crst ThreadpoolWorker
    AcquiredBefore ThreadIdDispenser ThreadStore
End

Crst ThreadStore
    AcquiredBefore AvailableParamTypes DeadlockDetection DebuggerController
                   DebuggerHeapLock DebuggerJitInfo DynamicIL ExecuteManRangeLock HandleTable IbcProfile
                   JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilerGCRefDataFreeList
                   SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList ThreadIdDispenser DebuggerMutex
End

Crst TypeIDMap
    AcquiredBefore UniqueStack
End

Crst TypeEquivalenceMap
    AcquiredBefore LoaderHeap
End

Crst UMEntryThunkFreeListLock
End

Crst UniqueStack
    AcquiredBefore LoaderHeap
End

Crst UnresolvedClassLock
    AcquiredBefore AvailableParamTypes IbcProfile JumpStubCache
End

Crst WrapperTemplate
    AcquiredBefore IbcProfile
End

Crst UMEntryThunkCache
    AcquiredBefore LoaderHeap
End

Crst PinnedByrefValidation
End

Crst VSDIndirectionCellLock
    AcquiredBefore LoaderHeap
End

Crst MulticoreJitHash
End

Crst MulticoreJitManager
    AcquiredBefore MulticoreJitHash ThreadStore
End

Crst StackSampler
End

Crst InlineTrackingMap
    AcquiredBefore IbcProfile
End

Crst JitInlineTrackingMap
    AcquiredBefore CodeVersioning ThreadStore LoaderAllocator
End

Crst EventPipe
    AcquiredAfter PendingTypeLoadEntry
    AcquiredBefore ThreadIdDispenser ThreadStore DomainLocalBlock InstMethodHashTable
End

Crst NotifyGdb
End

Crst ReadyToRunEntryPointToMethodDescMap
    AcquiredBefore ExecuteManRangeLock UniqueStack
End

Crst TieredCompilation
    AcquiredAfter CodeVersioning
    AcquiredBefore ThreadpoolTimerQueue
End

Crst COMCallWrapper
End

Crst MethodDescBackpatchInfoTracker
    AcquiredBefore FuncPtrStubs ThreadStore SystemDomain
    AcquiredAfter ReJITGlobalRequest
End

Crst NativeImageEagerFixups
End

Crst NativeImageLoad
End

Crst PgoData
    AcquiredBefore LoaderHeap
End