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

Commit ecb4575

Browse files
authored
Use function-local StackingAllocator for EnC added methods (#26256)
As adding EnC methods happens on the Debugger Thread, there's no managed Thread object from which to obtain the cached StackingAllocator. Instead, just use a function-local StackingAllocator.
1 parent 6d8482c commit ecb4575

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/vm/class.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,12 +604,16 @@ HRESULT EEClass::AddMethod(MethodTable * pMT, mdMethodDef methodDef, RVA newRVA,
604604
// Get the new MethodDesc (Note: The method desc memory is zero initialized)
605605
MethodDesc *pNewMD = pChunk->GetFirstMethodDesc();
606606

607-
ACQUIRE_STACKING_ALLOCATOR(pStackingAllocator);
608607

609608
// Initialize the new MethodDesc
609+
610+
// This method runs on a debugger thread. Debugger threads do not have Thread object that caches StackingAllocator.
611+
// Use a local StackingAllocator instead.
612+
StackingAllocator stackingAllocator;
613+
610614
MethodTableBuilder builder(pMT,
611615
pClass,
612-
pStackingAllocator,
616+
&stackingAllocator,
613617
&dummyAmTracker);
614618
EX_TRY
615619
{

0 commit comments

Comments
 (0)