From ecb4575a825e8a6aa21f9775bc8005524e56e03d Mon Sep 17 00:00:00 2001 From: Juan Hoyos Date: Mon, 19 Aug 2019 19:21:40 -0700 Subject: 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. --- src/vm/class.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vm/class.cpp b/src/vm/class.cpp index e52ca61f50..1cc1358d4e 100644 --- a/src/vm/class.cpp +++ b/src/vm/class.cpp @@ -604,12 +604,16 @@ HRESULT EEClass::AddMethod(MethodTable * pMT, mdMethodDef methodDef, RVA newRVA, // Get the new MethodDesc (Note: The method desc memory is zero initialized) MethodDesc *pNewMD = pChunk->GetFirstMethodDesc(); - ACQUIRE_STACKING_ALLOCATOR(pStackingAllocator); // Initialize the new MethodDesc + + // This method runs on a debugger thread. Debugger threads do not have Thread object that caches StackingAllocator. + // Use a local StackingAllocator instead. + StackingAllocator stackingAllocator; + MethodTableBuilder builder(pMT, pClass, - pStackingAllocator, + &stackingAllocator, &dummyAmTracker); EX_TRY { -- cgit v1.2.3