Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit cbbfdc6

Browse files
committed
Dynamic methods use freelisted MethodDescriptors, so we need to
null out m_GcCover when a freelisted entry is reused. Now we can assert in SetupGcCoverage that m_GcCover is NULL.
1 parent a84e95d commit cbbfdc6

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/vm/dynamicmethod.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ DynamicMethodDesc* DynamicMethodTable::GetDynamicMethod(BYTE *psig, DWORD sigSiz
280280
pNewMD->m_pszDebugClassName = (LPUTF8)"dynamicclass";
281281
pNewMD->m_pszDebugMethodSignature = "DynamicMethod Signature not available";
282282
#endif // _DEBUG
283+
284+
#ifdef HAVE_GCCOVER
285+
pNewMD->m_GcCover = NULL;
286+
#endif
287+
283288
pNewMD->SetNotInline(TRUE);
284289
pNewMD->GetLCGMethodResolver()->Reset();
285290

src/vm/gccover.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,9 @@ void SetupGcCoverage(MethodDesc* pMD, BYTE* methodStartPtr) {
144144
}
145145
#endif
146146

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.
149-
if (pMD->m_GcCover)
150-
{
151-
return;
152-
}
153-
147+
// We should be the first and only thread to instrument this
148+
// method for gc coverage.
149+
_ASSERTE(!pMD->m_GcCover);
154150
PCODE codeStart = (PCODE) methodStartPtr;
155151
SetupAndSprinkleBreakpointsForJittedMethod(pMD, codeStart);
156152
}

0 commit comments

Comments
 (0)