From f05edbde8db354fa78a385f728bb8726bb4a607a Mon Sep 17 00:00:00 2001 From: EgorBo Date: Tue, 17 Mar 2026 21:01:36 +0100 Subject: [PATCH 1/2] Checkpoint from Copilot CLI for coding agent session --- src/coreclr/inc/CrstTypes.def | 2 +- src/coreclr/inc/crsttypes_generated.h | 2 +- src/coreclr/vm/loaderallocator.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/coreclr/inc/CrstTypes.def b/src/coreclr/inc/CrstTypes.def index c9798ea5ebe084..2f8ea1bb96253c 100644 --- a/src/coreclr/inc/CrstTypes.def +++ b/src/coreclr/inc/CrstTypes.def @@ -296,7 +296,7 @@ End Crst LoaderAllocatorReferences AcquiredBefore LoaderAllocator - AcquiredAfter PendingTypeLoadEntry InstMethodHashTable + AcquiredAfter PendingTypeLoadEntry InstMethodHashTable ILStubGen End Crst AssemblyList diff --git a/src/coreclr/inc/crsttypes_generated.h b/src/coreclr/inc/crsttypes_generated.h index afab5353f7d97a..fc3496a633ea9d 100644 --- a/src/coreclr/inc/crsttypes_generated.h +++ b/src/coreclr/inc/crsttypes_generated.h @@ -172,7 +172,7 @@ int g_rgCrstLevelMap[] = 1, // CrstHandleTable 7, // CrstIJWFixupData 0, // CrstIJWHash - 14, // CrstILStubGen + 18, // CrstILStubGen 0, // CrstInlineTrackingMap 18, // CrstInstMethodHashTable 0, // CrstInterfaceDispatchGlobalLists diff --git a/src/coreclr/vm/loaderallocator.cpp b/src/coreclr/vm/loaderallocator.cpp index 8b50e2b1b8e8a0..51dafecf4d8201 100644 --- a/src/coreclr/vm/loaderallocator.cpp +++ b/src/coreclr/vm/loaderallocator.cpp @@ -267,9 +267,6 @@ BOOL LoaderAllocator::EnsureReference(LoaderAllocator *pOtherLA) } CONTRACTL_END; - // Check if this lock can be taken in all places that the function is called - _ASSERTE(GetAppDomain()->GetLoaderAllocatorReferencesLock()->Debug_CanTake()); - if (!IsCollectible()) return FALSE; @@ -279,6 +276,9 @@ BOOL LoaderAllocator::EnsureReference(LoaderAllocator *pOtherLA) if (!pOtherLA->IsCollectible()) return FALSE; + // Check if this lock can be taken in all places that the function is called + _ASSERTE(GetAppDomain()->GetLoaderAllocatorReferencesLock()->Debug_CanTake()); + _ASSERTE(Id()->GetType() == LAT_Assembly); CrstHolder ch(GetAppDomain()->GetLoaderAllocatorReferencesLock()); return CheckAddReference_Unlocked(pOtherLA); @@ -295,12 +295,12 @@ BOOL LoaderAllocator::EnsureInstantiation(Module *pDefiningModule, Instantiation BOOL fNewReferenceNeeded = FALSE; - // Check if this lock can be taken in all places that the function is called - _ASSERTE(GetAppDomain()->GetLoaderAllocatorReferencesLock()->Debug_CanTake()); - if (!IsCollectible()) return FALSE; + // Check if this lock can be taken in all places that the function is called + _ASSERTE(GetAppDomain()->GetLoaderAllocatorReferencesLock()->Debug_CanTake()); + _ASSERTE(Id()->GetType() == LAT_Assembly); CrstHolder ch(GetAppDomain()->GetLoaderAllocatorReferencesLock()); From b864edbc12f9f936bdea88083a609deca0687fb7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 20:43:42 +0000 Subject: [PATCH 2/2] Revert loaderallocator.cpp assert placement changes; ILStubGen level fix is sufficient Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- src/coreclr/vm/loaderallocator.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/coreclr/vm/loaderallocator.cpp b/src/coreclr/vm/loaderallocator.cpp index 51dafecf4d8201..8b50e2b1b8e8a0 100644 --- a/src/coreclr/vm/loaderallocator.cpp +++ b/src/coreclr/vm/loaderallocator.cpp @@ -267,6 +267,9 @@ BOOL LoaderAllocator::EnsureReference(LoaderAllocator *pOtherLA) } CONTRACTL_END; + // Check if this lock can be taken in all places that the function is called + _ASSERTE(GetAppDomain()->GetLoaderAllocatorReferencesLock()->Debug_CanTake()); + if (!IsCollectible()) return FALSE; @@ -276,9 +279,6 @@ BOOL LoaderAllocator::EnsureReference(LoaderAllocator *pOtherLA) if (!pOtherLA->IsCollectible()) return FALSE; - // Check if this lock can be taken in all places that the function is called - _ASSERTE(GetAppDomain()->GetLoaderAllocatorReferencesLock()->Debug_CanTake()); - _ASSERTE(Id()->GetType() == LAT_Assembly); CrstHolder ch(GetAppDomain()->GetLoaderAllocatorReferencesLock()); return CheckAddReference_Unlocked(pOtherLA); @@ -295,12 +295,12 @@ BOOL LoaderAllocator::EnsureInstantiation(Module *pDefiningModule, Instantiation BOOL fNewReferenceNeeded = FALSE; - if (!IsCollectible()) - return FALSE; - // Check if this lock can be taken in all places that the function is called _ASSERTE(GetAppDomain()->GetLoaderAllocatorReferencesLock()->Debug_CanTake()); + if (!IsCollectible()) + return FALSE; + _ASSERTE(Id()->GetType() == LAT_Assembly); CrstHolder ch(GetAppDomain()->GetLoaderAllocatorReferencesLock());