@@ -144,69 +144,15 @@ void SetupGcCoverage(MethodDesc* pMD, BYTE* methodStartPtr) {
144
144
}
145
145
#endif
146
146
147
+ // We may have lost out to another thread instrumenting this method.
148
+ // If so, we'll also lose the publishing race. So just return.
147
149
if (pMD->m_GcCover )
148
- return ;
149
-
150
- //
151
- // In the gcstress=4 case, we can easily piggy-back onto the JITLock because we
152
- // have a JIT operation that needs to take that lock already. But in the case of
153
- // gcstress=8, we cannot do this because the code already exists, and if gccoverage
154
- // were not in the picture, we're happy to race to do the prestub work because all
155
- // threads end up with the same answer and don't leak any resources in the process.
156
- //
157
- // However, with gccoverage, we need to exclude all other threads from mucking with
158
- // the code while we fill in the breakpoints and make our shadow copy of the code.
159
- //
160
150
{
161
- BaseDomain* pDomain = pMD->GetDomain ();
162
- // Enter the global lock which protects the list of all functions being JITd
163
- JitListLock::LockHolder pJitLock (pDomain->GetJitLock ());
164
-
165
-
166
- // It is possible that another thread stepped in before we entered the global lock for the first time.
167
- if (pMD->m_GcCover )
168
- {
169
- // We came in to jit but someone beat us so return the jitted method!
170
- return ;
171
- }
172
- else
173
- {
174
- const char *description = " jit lock (gc cover)" ;
175
- #ifdef _DEBUG
176
- description = pMD->m_pszDebugMethodName ;
177
- #endif
178
- ReleaseHolder<JitListLockEntry> pEntry (JitListLockEntry::Find (pJitLock, pMD->GetInitialCodeVersion (), description));
179
-
180
- // We have an entry now, we can release the global lock
181
- pJitLock.Release ();
182
-
183
- // Take the entry lock
184
- {
185
- JitListLockEntry::LockHolder pEntryLock (pEntry, FALSE );
186
-
187
- if (pEntryLock.DeadlockAwareAcquire ())
188
- {
189
- // we have the lock...
190
- }
191
- else
192
- {
193
- // Note that at this point we don't have the lock, but that's OK because the
194
- // thread which does have the lock is blocked waiting for us.
195
- }
196
-
197
- if (pMD->m_GcCover )
198
- {
199
- return ;
200
- }
201
-
202
- PCODE codeStart = (PCODE) methodStartPtr;
203
-
204
- SetupAndSprinkleBreakpointsForJittedMethod (pMD,
205
- codeStart
206
- );
207
- }
208
- }
151
+ return ;
209
152
}
153
+
154
+ PCODE codeStart = (PCODE) methodStartPtr;
155
+ SetupAndSprinkleBreakpointsForJittedMethod (pMD, codeStart);
210
156
}
211
157
212
158
#ifdef FEATURE_PREJIT
0 commit comments