From 26f121b39d634bfe8fc6a966390cdebd6dd1efd4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 9 Oct 2026 22:45:32 +0000 Subject: [PATCH 1/4] Initial plan From f98ede0d1e6ec9259d867fb75ad5699fd6b5468f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Oct 2026 03:24:51 +0000 Subject: [PATCH 2/4] Resolve FCall-backed JIT helpers directly to avoid prestub GC holes Co-authored-by: agocke <515774+agocke@users.noreply.github.com> --- src/coreclr/vm/jithelpers.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp index 9fb22730713b6b..12dd774762f0cd 100644 --- a/src/coreclr/vm/jithelpers.cpp +++ b/src/coreclr/vm/jithelpers.cpp @@ -2541,6 +2541,10 @@ PCODE LoadDynamicJitHelper(DynamicCorInfoHelpFunc ftnNum) pMD = CoreLibBinder::GetMethod(binderId); PCODE pFunc = pMD->GetMultiCallableAddrOfCode(); +#ifndef FEATURE_PORTABLE_ENTRYPOINTS + if (pMD->IsFCall()) + pFunc = ECall::GetFCallImpl(pMD); +#endif // !FEATURE_PORTABLE_ENTRYPOINTS InterlockedCompareExchangeT(&hlpDynamicFuncTable[ftnNum].pfnHelper, (PCODE)pFunc, (PCODE)NULL); } From b87276e618952f739224bb011aacfe53e40210d0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Oct 2026 07:45:58 +0000 Subject: [PATCH 3/4] Register the no-GC small bulk-copy helper directly Co-authored-by: agocke <515774+agocke@users.noreply.github.com> --- src/coreclr/inc/jithelpers.h | 3 ++- src/coreclr/vm/corelib.h | 1 - src/coreclr/vm/jithelpers.cpp | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/coreclr/inc/jithelpers.h b/src/coreclr/inc/jithelpers.h index 99a84286242c8f..e185d5e7f8db84 100644 --- a/src/coreclr/inc/jithelpers.h +++ b/src/coreclr/inc/jithelpers.h @@ -172,7 +172,8 @@ DYNAMICJITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF, RhpCheckedAssignRef,METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_BULK_WRITEBARRIER, NULL, METHOD__BUFFER__MEMCOPYGC) - DYNAMICJITHELPER_NOINDIRECT(CORINFO_HELP_BULK_WRITEBARRIER_SMALL, NULL, METHOD__BUFFER__MEMCOPYGC_SMALL) + // This no-GC helper must call the native worker without entering the prestub. + JITHELPER(CORINFO_HELP_BULK_WRITEBARRIER_SMALL, Buffer::BulkMoveWithWriteBarrier, METHOD__NIL) // Accessing fields diff --git a/src/coreclr/vm/corelib.h b/src/coreclr/vm/corelib.h index 62fb4613954f1f..1a64498519ac45 100644 --- a/src/coreclr/vm/corelib.h +++ b/src/coreclr/vm/corelib.h @@ -1064,7 +1064,6 @@ DEFINE_CLASS(BUFFER, System, Buffer) DEFINE_METHOD(BUFFER, MEMCPY_PTRBYTE_ARRBYTE, Memcpy, SM_PtrByte_Int_ArrByte_Int_Int_RetVoid) DEFINE_METHOD(BUFFER, MEMCPY, Memcpy, SM_PtrByte_PtrByte_Int_RetVoid) DEFINE_METHOD(BUFFER, MEMCOPYGC, BulkMoveWithWriteBarrier, SM_RefByte_RefByte_UIntPtr_RetVoid) -DEFINE_METHOD(BUFFER, MEMCOPYGC_SMALL, BulkMoveWithWriteBarrierInternal, SM_RefByte_RefByte_UIntPtr_RetVoid) DEFINE_CLASS(STUBHELPERS, StubHelpers, StubHelpers) #ifdef FEATURE_COMINTEROP diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp index 12dd774762f0cd..1f1b7364a12462 100644 --- a/src/coreclr/vm/jithelpers.cpp +++ b/src/coreclr/vm/jithelpers.cpp @@ -24,6 +24,7 @@ #include "eeprofinterfaces.h" #include "dynamicinterfacecastable.h" #include "comsynchronizable.h" +#include "comutilnative.h" #ifndef TARGET_UNIX // Included for referencing __report_gsfailure @@ -2541,10 +2542,6 @@ PCODE LoadDynamicJitHelper(DynamicCorInfoHelpFunc ftnNum) pMD = CoreLibBinder::GetMethod(binderId); PCODE pFunc = pMD->GetMultiCallableAddrOfCode(); -#ifndef FEATURE_PORTABLE_ENTRYPOINTS - if (pMD->IsFCall()) - pFunc = ECall::GetFCallImpl(pMD); -#endif // !FEATURE_PORTABLE_ENTRYPOINTS InterlockedCompareExchangeT(&hlpDynamicFuncTable[ftnNum].pfnHelper, (PCODE)pFunc, (PCODE)NULL); } From d331c31818c8b655f7bca88059d9fb042d7e1690 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 13 Oct 2026 09:20:07 -0700 Subject: [PATCH 4/4] Update jithelpers.h Co-authored-by: Jan Kotas --- src/coreclr/inc/jithelpers.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/coreclr/inc/jithelpers.h b/src/coreclr/inc/jithelpers.h index e185d5e7f8db84..f03d0ff4914dde 100644 --- a/src/coreclr/inc/jithelpers.h +++ b/src/coreclr/inc/jithelpers.h @@ -172,7 +172,6 @@ DYNAMICJITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF, RhpCheckedAssignRef,METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_BULK_WRITEBARRIER, NULL, METHOD__BUFFER__MEMCOPYGC) - // This no-GC helper must call the native worker without entering the prestub. JITHELPER(CORINFO_HELP_BULK_WRITEBARRIER_SMALL, Buffer::BulkMoveWithWriteBarrier, METHOD__NIL) // Accessing fields