1 | // Licensed to the .NET Foundation under one or more agreements. |
---|---|
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | |
6 | |
7 | #ifndef _METHOD_INL_ |
8 | #define _METHOD_INL_ |
9 | |
10 | inline BOOL MethodDesc::HasTemporaryEntryPoint() |
11 | { |
12 | WRAPPER_NO_CONTRACT; |
13 | return GetMethodDescChunk()->HasTemporaryEntryPoints(); |
14 | } |
15 | |
16 | inline InstantiatedMethodDesc* MethodDesc::AsInstantiatedMethodDesc() const |
17 | { |
18 | WRAPPER_NO_CONTRACT; |
19 | SUPPORTS_DAC; |
20 | |
21 | _ASSERTE(GetClassification() == mcInstantiated); |
22 | return dac_cast<PTR_InstantiatedMethodDesc>(this); |
23 | } |
24 | |
25 | inline BOOL MethodDesc::IsZapped() |
26 | { |
27 | WRAPPER_NO_CONTRACT; |
28 | #ifdef FEATURE_PREJIT |
29 | return GetMethodDescChunk()->IsZapped(); |
30 | #else |
31 | return FALSE; |
32 | #endif |
33 | } |
34 | |
35 | inline PTR_DynamicResolver DynamicMethodDesc::GetResolver() |
36 | { |
37 | LIMITED_METHOD_CONTRACT; |
38 | |
39 | return m_pResolver; |
40 | } |
41 | |
42 | inline SigParser MethodDesc::GetSigParser() |
43 | { |
44 | WRAPPER_NO_CONTRACT; |
45 | |
46 | PCCOR_SIGNATURE pSig; |
47 | ULONG cSig; |
48 | GetSig(&pSig, &cSig); |
49 | |
50 | return SigParser(pSig, cSig); |
51 | } |
52 | |
53 | inline SigPointer MethodDesc::GetSigPointer() |
54 | { |
55 | WRAPPER_NO_CONTRACT; |
56 | |
57 | PCCOR_SIGNATURE pSig; |
58 | ULONG cSig; |
59 | GetSig(&pSig, &cSig); |
60 | |
61 | return SigPointer(pSig, cSig); |
62 | } |
63 | |
64 | inline PTR_LCGMethodResolver DynamicMethodDesc::GetLCGMethodResolver() |
65 | { |
66 | CONTRACTL |
67 | { |
68 | MODE_ANY; |
69 | GC_NOTRIGGER; |
70 | NOTHROW; |
71 | PRECONDITION(IsLCGMethod()); |
72 | SO_TOLERANT; |
73 | } |
74 | CONTRACTL_END; |
75 | |
76 | return PTR_LCGMethodResolver(m_pResolver); |
77 | } |
78 | |
79 | inline PTR_ILStubResolver DynamicMethodDesc::GetILStubResolver() |
80 | { |
81 | CONTRACTL |
82 | { |
83 | MODE_ANY; |
84 | GC_NOTRIGGER; |
85 | NOTHROW; |
86 | PRECONDITION(IsILStub()); |
87 | SO_TOLERANT; |
88 | } |
89 | CONTRACTL_END; |
90 | |
91 | return PTR_ILStubResolver(m_pResolver); |
92 | } |
93 | |
94 | inline PTR_DynamicMethodDesc MethodDesc::AsDynamicMethodDesc() |
95 | { |
96 | CONTRACTL |
97 | { |
98 | MODE_ANY; |
99 | GC_NOTRIGGER; |
100 | NOTHROW; |
101 | PRECONDITION(IsDynamicMethod()); |
102 | SO_TOLERANT; |
103 | SUPPORTS_DAC; |
104 | } |
105 | CONTRACTL_END; |
106 | |
107 | return dac_cast<PTR_DynamicMethodDesc>(this); |
108 | } |
109 | |
110 | inline bool MethodDesc::IsDynamicMethod() |
111 | { |
112 | LIMITED_METHOD_CONTRACT; |
113 | return (mcDynamic == GetClassification()); |
114 | } |
115 | |
116 | inline bool MethodDesc::IsLCGMethod() |
117 | { |
118 | WRAPPER_NO_CONTRACT; |
119 | return ((mcDynamic == GetClassification()) && dac_cast<PTR_DynamicMethodDesc>(this)->IsLCGMethod()); |
120 | } |
121 | |
122 | inline bool MethodDesc::IsILStub() |
123 | { |
124 | WRAPPER_NO_CONTRACT; |
125 | |
126 | g_IBCLogger.LogMethodDescAccess(this); |
127 | return ((mcDynamic == GetClassification()) && dac_cast<PTR_DynamicMethodDesc>(this)->IsILStub()); |
128 | } |
129 | |
130 | inline BOOL MethodDesc::IsQCall() |
131 | { |
132 | WRAPPER_NO_CONTRACT; |
133 | return (IsNDirect() && dac_cast<PTR_NDirectMethodDesc>(this)->IsQCall()); |
134 | } |
135 | |
136 | #ifdef FEATURE_COMINTEROP |
137 | FORCEINLINE DWORD MethodDesc::IsGenericComPlusCall() |
138 | { |
139 | LIMITED_METHOD_CONTRACT; |
140 | return (mcInstantiated == GetClassification() && AsInstantiatedMethodDesc()->IMD_HasComPlusCallInfo()); |
141 | } |
142 | inline void MethodDesc::SetupGenericComPlusCall() |
143 | { |
144 | LIMITED_METHOD_CONTRACT; |
145 | AsInstantiatedMethodDesc()->IMD_SetupGenericComPlusCall(); |
146 | } |
147 | #endif // FEATURE_COMINTEROP |
148 | |
149 | |
150 | #ifdef FEATURE_COMINTEROP |
151 | |
152 | // static |
153 | inline ComPlusCallInfo *ComPlusCallInfo::FromMethodDesc(MethodDesc *pMD) |
154 | { |
155 | LIMITED_METHOD_CONTRACT; |
156 | if (pMD->IsComPlusCall()) |
157 | { |
158 | return ((ComPlusCallMethodDesc *)pMD)->m_pComPlusCallInfo; |
159 | } |
160 | else if (pMD->IsEEImpl()) |
161 | { |
162 | return ((DelegateEEClass *)pMD->GetClass())->m_pComPlusCallInfo; |
163 | } |
164 | else |
165 | { |
166 | _ASSERTE(pMD->IsGenericComPlusCall()); |
167 | return pMD->AsInstantiatedMethodDesc()->IMD_GetComPlusCallInfo(); |
168 | } |
169 | } |
170 | |
171 | #endif //FEATURE_COMINTEROP |
172 | |
173 | #ifdef FEATURE_CODE_VERSIONING |
174 | inline CodeVersionManager * MethodDesc::GetCodeVersionManager() |
175 | { |
176 | LIMITED_METHOD_CONTRACT; |
177 | return GetModule()->GetCodeVersionManager(); |
178 | } |
179 | #endif |
180 | |
181 | #ifdef FEATURE_TIERED_COMPILATION |
182 | inline CallCounter * MethodDesc::GetCallCounter() |
183 | { |
184 | LIMITED_METHOD_CONTRACT; |
185 | return GetModule()->GetCallCounter(); |
186 | } |
187 | #endif |
188 | |
189 | #endif // _METHOD_INL_ |
190 | |
191 |