blob: e82ee3ed70a9aee5b47b18d90e2a2fad521b2926 (
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
|
// 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.
//
inline Module* DomainFile::GetCurrentModule()
{
LIMITED_METHOD_CONTRACT;
STATIC_CONTRACT_SO_TOLERANT;
SUPPORTS_DAC;
return m_pModule;
}
inline Module* DomainFile::GetLoadedModule()
{
LIMITED_METHOD_CONTRACT;
{
// CheckLoaded() eventually calls PEFile::GetNativeImageWithRef(), which
// takes a reader lock on the file's m_pMetadataLock. However, this is
// only done in debug for the consistency check, so we can accept the lock violation.
CONTRACT_VIOLATION(TakesLockViolation);
CONSISTENCY_CHECK(CheckLoaded());
}
return m_pModule;
}
inline Module* DomainFile::GetModule()
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
{
// While executing the consistency check, we will take a lock.
// But since this is debug-only, we'll allow the lock violation so that
// CANNOT_TAKE_LOCK callers aren't penalized
CONTRACT_VIOLATION(TakesLockViolation);
CONSISTENCY_CHECK(CheckLoadLevel(FILE_LOAD_ALLOCATE));
}
return m_pModule;
}
inline Assembly* DomainAssembly::GetCurrentAssembly()
{
LIMITED_METHOD_CONTRACT;
STATIC_CONTRACT_SO_TOLERANT;
return m_pAssembly;
}
inline Assembly* DomainAssembly::GetLoadedAssembly()
{
LIMITED_METHOD_DAC_CONTRACT;
{
// CheckLoaded() eventually calls PEFile::GetNativeImageWithRef(), which
// takes a reader lock on the file's m_pMetadataLock. However, this is
// only done in debug for the consistency check, so we can accept the lock violation.
CONTRACT_VIOLATION(TakesLockViolation);
CONSISTENCY_CHECK(CheckLoaded());
}
return m_pAssembly;
}
inline Assembly* DomainAssembly::GetAssembly()
{
LIMITED_METHOD_CONTRACT;
STATIC_CONTRACT_SO_TOLERANT;
{
// CheckLoadLevel() is SO_INTOLERANT. However, this is only done in
// debug for the consistency check, so we can accept the SO violation.
CONTRACT_VIOLATION(SOToleranceViolation);
CONSISTENCY_CHECK(CheckLoadLevel(FILE_LOAD_ALLOCATE));
}
return m_pAssembly;
}
#ifndef DACCESS_COMPILE
inline void DomainFile::UpdatePEFileWorker(PTR_PEFile pFile)
{
LIMITED_METHOD_CONTRACT;
CONSISTENCY_CHECK(CheckPointer(pFile));
if (pFile==m_pFile)
return;
_ASSERTE(m_pOriginalFile==NULL);
m_pOriginalFile=m_pFile;
pFile->AddRef();
m_pFile=pFile;
}
inline void DomainAssembly::UpdatePEFile(PTR_PEFile pFile)
{
CONTRACTL
{
THROWS;
GC_NOTRIGGER;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
GetAppDomain()->UpdatePublishHostedAssembly(this, pFile);
}
#endif // DACCESS_COMPILE
inline ULONG DomainAssembly::HashIdentity()
{
WRAPPER_NO_CONTRACT;
return GetFile()->HashIdentity();
}
inline BOOL DomainAssembly::IsCollectible()
{
LIMITED_METHOD_CONTRACT;
return m_fCollectible;
}
|