From 1f978f91373a50a5ffd04c7ac4ed3c3df0903f87 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 14 May 2026 21:52:03 +0000 Subject: [PATCH 1/2] Delete unused WBF_NoBarrier_CheckNotHeapInDebug and CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/f12f1f82-9c79-435d-a7cc-c641d3ab582c Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com> --- src/coreclr/inc/corinfo.h | 1 - src/coreclr/inc/jiteeversionguid.h | 10 +++++----- src/coreclr/inc/jithelpers.h | 1 - src/coreclr/jit/codegencommon.cpp | 14 -------------- src/coreclr/jit/codegenwasm.cpp | 3 --- src/coreclr/jit/jitgcinfo.h | 5 ----- src/coreclr/jit/utils.cpp | 1 - .../tools/Common/JitInterface/CorInfoHelpFunc.cs | 1 - src/coreclr/vm/gchelpers.cpp | 15 --------------- src/coreclr/vm/jitinterface.h | 1 - 10 files changed, 5 insertions(+), 47 deletions(-) diff --git a/src/coreclr/inc/corinfo.h b/src/coreclr/inc/corinfo.h index 5aa999e2745fa8..389ae74a9f8019 100644 --- a/src/coreclr/inc/corinfo.h +++ b/src/coreclr/inc/corinfo.h @@ -429,7 +429,6 @@ enum CorInfoHelpFunc CORINFO_HELP_ASSIGN_REF, // universal helpers with F_CALL_CONV calling convention CORINFO_HELP_CHECKED_ASSIGN_REF, - CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, // Do the store, and ensure that the target was not in the heap. CORINFO_HELP_ASSIGN_BYREF, CORINFO_HELP_BULK_WRITEBARRIER, diff --git a/src/coreclr/inc/jiteeversionguid.h b/src/coreclr/inc/jiteeversionguid.h index d51dc20a9cca3d..ad3cc36324fc88 100644 --- a/src/coreclr/inc/jiteeversionguid.h +++ b/src/coreclr/inc/jiteeversionguid.h @@ -37,11 +37,11 @@ #include -constexpr GUID JITEEVersionIdentifier = { /* bf284efa-a3fb-4420-a62f-6e1a0a1b2cfc */ - 0xbf284efa, - 0xa3fb, - 0x4420, - {0xa6, 0x2f, 0x6e, 0x1a, 0x0a, 0x1b, 0x2c, 0xfc} +constexpr GUID JITEEVersionIdentifier = { /* ff61c3a1-5780-4001-84cf-c3a060138d2f */ + 0xff61c3a1, + 0x5780, + 0x4001, + {0x84, 0xcf, 0xc3, 0xa0, 0x60, 0x13, 0x8d, 0x2f} }; #endif // JIT_EE_VERSIONING_GUID_H diff --git a/src/coreclr/inc/jithelpers.h b/src/coreclr/inc/jithelpers.h index 17d3f193197887..75c060a761d18a 100644 --- a/src/coreclr/inc/jithelpers.h +++ b/src/coreclr/inc/jithelpers.h @@ -169,7 +169,6 @@ // GC Write barrier support DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF, RhpAssignRef, METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF, RhpCheckedAssignRef,METHOD__NIL) - JITHELPER(CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, JIT_WriteBarrierEnsureNonHeapTarget,METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_BYREF, RhpByRefAssignRef,METHOD__NIL) DYNAMICJITHELPER(CORINFO_HELP_BULK_WRITEBARRIER, NULL, METHOD__BUFFER__MEMCOPYGC) diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index 790bf2b96a9d8e..53937afe22c724 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -2680,11 +2680,7 @@ void CodeGen::genReportEHClauses(EHClauseInfo* clauses) bool CodeGenInterface::genUseOptimizedWriteBarriers(GCInfo::WriteBarrierForm wbf) { #if defined(TARGET_X86) && NOGC_WRITE_BARRIERS -#ifdef DEBUG - return (wbf != GCInfo::WBF_NoBarrier_CheckNotHeapInDebug); // This one is always a call to a C++ method. -#else return true; -#endif #else return false; #endif @@ -2709,12 +2705,7 @@ bool CodeGenInterface::genUseOptimizedWriteBarriers(GCInfo::WriteBarrierForm wbf bool CodeGenInterface::genUseOptimizedWriteBarriers(GenTreeStoreInd* store) { #if defined(TARGET_X86) && NOGC_WRITE_BARRIERS -#ifdef DEBUG - GCInfo::WriteBarrierForm wbf = m_compiler->codeGen->gcInfo.gcIsWriteBarrierCandidate(store); - return (wbf != GCInfo::WBF_NoBarrier_CheckNotHeapInDebug); // This one is always a call to a C++ method. -#else return true; -#endif #else return false; #endif @@ -2746,11 +2737,6 @@ CorInfoHelpFunc CodeGenInterface::genWriteBarrierHelperForWriteBarrierForm(GCInf case GCInfo::WBF_BarrierUnchecked: return CORINFO_HELP_ASSIGN_REF; -#ifdef DEBUG - case GCInfo::WBF_NoBarrier_CheckNotHeapInDebug: - return CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP; -#endif // DEBUG - default: unreached(); } diff --git a/src/coreclr/jit/codegenwasm.cpp b/src/coreclr/jit/codegenwasm.cpp index eeba91f5bb40be..e39cef1b69c17e 100644 --- a/src/coreclr/jit/codegenwasm.cpp +++ b/src/coreclr/jit/codegenwasm.cpp @@ -2668,9 +2668,6 @@ void CodeGen::genEmitHelperCall(unsigned helper, int argSize, emitAttr retSize, // RhpCheckedAssignRef HELPER_SIG(CORINFO_HELP_CHECKED_ASSIGN_REF, UNMANAGED, CORINFO_WASM_TYPE_VOID /* retval */, CORINFO_WASM_TYPE_I, CORINFO_WASM_TYPE_I); - // JIT_WriteBarrierEnsureNonHeapTarget - HELPER_SIG(CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, UNMANAGED, CORINFO_WASM_TYPE_VOID /* retval */, - CORINFO_WASM_TYPE_I, CORINFO_WASM_TYPE_I); // RhpByRefAssignRef HELPER_SIG(CORINFO_HELP_ASSIGN_BYREF, UNMANAGED, CORINFO_WASM_TYPE_VOID /* retval */, CORINFO_WASM_TYPE_I, CORINFO_WASM_TYPE_I); diff --git a/src/coreclr/jit/jitgcinfo.h b/src/coreclr/jit/jitgcinfo.h index 0b86471f7bd44a..16ce50837db748 100644 --- a/src/coreclr/jit/jitgcinfo.h +++ b/src/coreclr/jit/jitgcinfo.h @@ -327,11 +327,6 @@ class GCInfo WBF_BarrierUnknown, // A barrier is required, no information on checked/unchecked. WBF_BarrierChecked, // A checked barrier is required. WBF_BarrierUnchecked, // An unchecked barrier is required. - WBF_NoBarrier_CheckNotHeapInDebug, // We believe that no barrier is required because the - // target is not in the heap -- but in debug build use a - // barrier call that verifies this property. (Because the - // target not being in the heap relies on a convention that - // might accidentally be violated in the future.) }; WriteBarrierForm gcIsWriteBarrierCandidate(GenTreeStoreInd* store); diff --git a/src/coreclr/jit/utils.cpp b/src/coreclr/jit/utils.cpp index f1380f35a176c0..8d39d359b30253 100644 --- a/src/coreclr/jit/utils.cpp +++ b/src/coreclr/jit/utils.cpp @@ -1691,7 +1691,6 @@ void HelperCallProperties::init() case CORINFO_HELP_ASSIGN_BYREF: isNoGC = true; FALLTHROUGH; - case CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP: case CORINFO_HELP_BULK_WRITEBARRIER: mutatesHeap = true; break; diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoHelpFunc.cs b/src/coreclr/tools/Common/JitInterface/CorInfoHelpFunc.cs index 748a9c781dcb73..a9ca6ffe3a3833 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoHelpFunc.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoHelpFunc.cs @@ -128,7 +128,6 @@ which is the right helper to use to allocate an object of a given type. */ CORINFO_HELP_ASSIGN_REF, // universal helpers with F_CALL_CONV calling convention CORINFO_HELP_CHECKED_ASSIGN_REF, - CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, // Do the store, and ensure that the target was not in the heap. CORINFO_HELP_ASSIGN_BYREF, CORINFO_HELP_BULK_WRITEBARRIER, diff --git a/src/coreclr/vm/gchelpers.cpp b/src/coreclr/vm/gchelpers.cpp index 162d33a8a4661a..c9e3020948fe3e 100644 --- a/src/coreclr/vm/gchelpers.cpp +++ b/src/coreclr/vm/gchelpers.cpp @@ -1575,21 +1575,6 @@ HCIMPLEND_RAW #endif // FEATURE_USE_ASM_GC_WRITE_BARRIERS -extern "C" HCIMPL2_RAW(VOID, JIT_WriteBarrierEnsureNonHeapTarget, Object **dst, Object *ref) -{ - // Must use static contract here, because if an AV occurs, a normal EH - // unwind will not occur, and destructors will not run. - STATIC_CONTRACT_MODE_COOPERATIVE; - STATIC_CONTRACT_THROWS; - STATIC_CONTRACT_GC_NOTRIGGER; - - assert(!GCHeapUtilities::GetGCHeap()->IsHeapPointer((void*)dst)); - - // not a release store because NonHeap. - *dst = ref; -} -HCIMPLEND_RAW - // This function sets the card table with the granularity of 1 byte, to avoid ghost updates // that could occur if multiple threads were trying to set different bits in the same card. diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h index 9ec98a22dd9b5b..609e4aef7279e5 100644 --- a/src/coreclr/vm/jitinterface.h +++ b/src/coreclr/vm/jitinterface.h @@ -207,7 +207,6 @@ extern "C" FCDECL2(VOID, RhpByRefAssignRef, Object **dst, Object *ref); extern "C" FCDECL2(VOID, RhpAssignRef, Object **dst, Object *ref); extern "C" FCDECL2(VOID, JIT_WriteBarrier, Object **dst, Object *ref); -extern "C" FCDECL2(VOID, JIT_WriteBarrierEnsureNonHeapTarget, Object **dst, Object *ref); EXTERN_C FCDECL2_VV(INT64, JIT_LMul, INT64 val1, INT64 val2); From 43dadf9d363ac542d9de26de09b9ed102ef0f6d9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 06:44:14 +0000 Subject: [PATCH 2/2] Apply formatting patch for jitgcinfo.h Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b7ce8ca9-f443-404b-9304-bf6f47e40d39 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> --- src/coreclr/jit/jitgcinfo.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreclr/jit/jitgcinfo.h b/src/coreclr/jit/jitgcinfo.h index 16ce50837db748..10ac0893e8b3ef 100644 --- a/src/coreclr/jit/jitgcinfo.h +++ b/src/coreclr/jit/jitgcinfo.h @@ -323,10 +323,10 @@ class GCInfo // requires a write barrier: enum WriteBarrierForm { - WBF_NoBarrier, // No barrier is required - WBF_BarrierUnknown, // A barrier is required, no information on checked/unchecked. - WBF_BarrierChecked, // A checked barrier is required. - WBF_BarrierUnchecked, // An unchecked barrier is required. + WBF_NoBarrier, // No barrier is required + WBF_BarrierUnknown, // A barrier is required, no information on checked/unchecked. + WBF_BarrierChecked, // A checked barrier is required. + WBF_BarrierUnchecked, // An unchecked barrier is required. }; WriteBarrierForm gcIsWriteBarrierCandidate(GenTreeStoreInd* store);