From 6e7c2ef1c2b8315cf6a7ccaf002361e288ab7671 Mon Sep 17 00:00:00 2001 From: EgorBo Date: Wed, 28 Jan 2026 15:24:49 +0100 Subject: [PATCH 1/6] Use CORJIT_PREJIT_UNSUPPORTED instead of CORJIT_LIMITATION for BlockNonDeterministicIntrinsics --- src/coreclr/inc/corjit.h | 15 ++++++++------- src/coreclr/jit/compiler.cpp | 3 ++- src/coreclr/jit/compiler.h | 2 +- src/coreclr/jit/error.cpp | 6 ++++++ src/coreclr/jit/error.h | 1 + .../tools/superpmi/superpmi/jitinstance.cpp | 2 +- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/coreclr/inc/corjit.h b/src/coreclr/inc/corjit.h index 3c02853b1cfa0b..e1c2388e5f9a3e 100644 --- a/src/coreclr/inc/corjit.h +++ b/src/coreclr/inc/corjit.h @@ -32,13 +32,14 @@ // These are error codes returned by CompileMethod enum CorJitResult { - CORJIT_OK = 0, - CORJIT_BADCODE = (JITINTERFACE_HRESULT)0x80000001, - CORJIT_OUTOFMEM = (JITINTERFACE_HRESULT)0x80000002, - CORJIT_INTERNALERROR = (JITINTERFACE_HRESULT)0x80000003, - CORJIT_SKIPPED = (JITINTERFACE_HRESULT)0x80000004, - CORJIT_RECOVERABLEERROR = (JITINTERFACE_HRESULT)0x80000005, - CORJIT_IMPLLIMITATION= (JITINTERFACE_HRESULT)0x80000006, + CORJIT_OK = 0, + CORJIT_BADCODE = (JITINTERFACE_HRESULT)0x80000001, + CORJIT_OUTOFMEM = (JITINTERFACE_HRESULT)0x80000002, + CORJIT_INTERNALERROR = (JITINTERFACE_HRESULT)0x80000003, + CORJIT_SKIPPED = (JITINTERFACE_HRESULT)0x80000004, + CORJIT_RECOVERABLEERROR = (JITINTERFACE_HRESULT)0x80000005, + CORJIT_IMPLLIMITATION = (JITINTERFACE_HRESULT)0x80000006, + CORJIT_PREJIT_UNSUPPORTED = (JITINTERFACE_HRESULT)0x80000007, }; /*****************************************************************************/ diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 2336eeeabbdfa0..141ec042cfa187 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -7706,7 +7706,8 @@ int jitNativeCode(CORINFO_METHOD_HANDLE methodHnd, result = param.result; if (!inlineInfo && - (result == CORJIT_INTERNALERROR || result == CORJIT_RECOVERABLEERROR || result == CORJIT_IMPLLIMITATION) && + (result == CORJIT_INTERNALERROR || result == CORJIT_RECOVERABLEERROR || result == CORJIT_IMPLLIMITATION || + result == CORJIT_PREJIT_UNSUPPORTED) && !jitFallbackCompile) { // If we failed the JIT, reattempt with debuggable code. diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 0cf381b8b2dc85..074e7b4276b617 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -8480,7 +8480,7 @@ class Compiler { if (mustExpand) { - implLimitation(); + implPrejitUnsupported(); } return true; } diff --git a/src/coreclr/jit/error.cpp b/src/coreclr/jit/error.cpp index afd74afac25064..544a8eebb6e987 100644 --- a/src/coreclr/jit/error.cpp +++ b/src/coreclr/jit/error.cpp @@ -77,6 +77,12 @@ void DECLSPEC_NORETURN implLimitation() fatal(CORJIT_IMPLLIMITATION); } +/*****************************************************************************/ +void DECLSPEC_NORETURN implPrejitUnsupported() +{ + fatal(CORJIT_PREJIT_UNSUPPORTED); +} + /*****************************************************************************/ void DECLSPEC_NORETURN NOMEM() { diff --git a/src/coreclr/jit/error.h b/src/coreclr/jit/error.h index 8bbd5cac3889e9..772941e520e9e7 100644 --- a/src/coreclr/jit/error.h +++ b/src/coreclr/jit/error.h @@ -66,6 +66,7 @@ extern void DECLSPEC_NORETURN badCode(); extern void DECLSPEC_NORETURN badCode3(const char* msg, const char* msg2, int arg, _In_z_ const char* file, unsigned line); extern void DECLSPEC_NORETURN noWay(); extern void DECLSPEC_NORETURN implLimitation(); +extern void DECLSPEC_NORETURN implPrejitUnsupported(); extern void DECLSPEC_NORETURN NOMEM(); extern void DECLSPEC_NORETURN fatal(int errCode); diff --git a/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp b/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp index 5caefae5767fa0..14b78b4a23767b 100644 --- a/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp +++ b/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp @@ -334,7 +334,7 @@ ReplayResults JitInstance::CompileMethod(MethodContext* MethodToCompile, int mcI } } - if ((jitResult == CORJIT_OK) || (jitResult == CORJIT_BADCODE)) + if ((jitResult == CORJIT_OK) || (jitResult == CORJIT_BADCODE) || (jitResult == CORJIT_PREJIT_UNSUPPORTED)) { // capture the results of compilation pParam->pThis->mc->cr->recCompileMethod(&NEntryBlock, &NCodeSizeBlock, jitResult); From 2b48dc988939e9adbd19e0d5979123fa9adf48fc Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Wed, 28 Jan 2026 15:57:02 +0100 Subject: [PATCH 2/6] Update src/coreclr/jit/compiler.h Co-authored-by: Jan Kotas --- src/coreclr/jit/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 074e7b4276b617..0b7048eba62798 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -8480,7 +8480,7 @@ class Compiler { if (mustExpand) { - implPrejitUnsupported(); + implReadyToRunUnsupported(); } return true; } From acd3f38601e06a295541fbc57ca842a408267092 Mon Sep 17 00:00:00 2001 From: EgorBo Date: Wed, 28 Jan 2026 16:00:15 +0100 Subject: [PATCH 3/6] Feedback --- src/coreclr/inc/corjit.h | 16 ++++++++-------- src/coreclr/jit/compiler.cpp | 2 +- src/coreclr/jit/error.cpp | 4 ++-- .../tools/superpmi/superpmi/jitinstance.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/coreclr/inc/corjit.h b/src/coreclr/inc/corjit.h index e1c2388e5f9a3e..bf17388fd4bb64 100644 --- a/src/coreclr/inc/corjit.h +++ b/src/coreclr/inc/corjit.h @@ -32,14 +32,14 @@ // These are error codes returned by CompileMethod enum CorJitResult { - CORJIT_OK = 0, - CORJIT_BADCODE = (JITINTERFACE_HRESULT)0x80000001, - CORJIT_OUTOFMEM = (JITINTERFACE_HRESULT)0x80000002, - CORJIT_INTERNALERROR = (JITINTERFACE_HRESULT)0x80000003, - CORJIT_SKIPPED = (JITINTERFACE_HRESULT)0x80000004, - CORJIT_RECOVERABLEERROR = (JITINTERFACE_HRESULT)0x80000005, - CORJIT_IMPLLIMITATION = (JITINTERFACE_HRESULT)0x80000006, - CORJIT_PREJIT_UNSUPPORTED = (JITINTERFACE_HRESULT)0x80000007, + CORJIT_OK = 0, + CORJIT_BADCODE = (JITINTERFACE_HRESULT)0x80000001, + CORJIT_OUTOFMEM = (JITINTERFACE_HRESULT)0x80000002, + CORJIT_INTERNALERROR = (JITINTERFACE_HRESULT)0x80000003, + CORJIT_SKIPPED = (JITINTERFACE_HRESULT)0x80000004, + CORJIT_RECOVERABLEERROR = (JITINTERFACE_HRESULT)0x80000005, + CORJIT_IMPLLIMITATION = (JITINTERFACE_HRESULT)0x80000006, + CORJIT_R2R_UNSUPPORTED = (JITINTERFACE_HRESULT)0x80000007, }; /*****************************************************************************/ diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 141ec042cfa187..f2ea29dd8ccef0 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -7707,7 +7707,7 @@ int jitNativeCode(CORINFO_METHOD_HANDLE methodHnd, if (!inlineInfo && (result == CORJIT_INTERNALERROR || result == CORJIT_RECOVERABLEERROR || result == CORJIT_IMPLLIMITATION || - result == CORJIT_PREJIT_UNSUPPORTED) && + result == CORJIT_R2R_UNSUPPORTED) && !jitFallbackCompile) { // If we failed the JIT, reattempt with debuggable code. diff --git a/src/coreclr/jit/error.cpp b/src/coreclr/jit/error.cpp index 544a8eebb6e987..cb7d1c88481d3f 100644 --- a/src/coreclr/jit/error.cpp +++ b/src/coreclr/jit/error.cpp @@ -78,9 +78,9 @@ void DECLSPEC_NORETURN implLimitation() } /*****************************************************************************/ -void DECLSPEC_NORETURN implPrejitUnsupported() +void DECLSPEC_NORETURN implReadyToRunUnsupported() { - fatal(CORJIT_PREJIT_UNSUPPORTED); + fatal(CORJIT_R2R_UNSUPPORTED); } /*****************************************************************************/ diff --git a/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp b/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp index 14b78b4a23767b..753452a80a4b2d 100644 --- a/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp +++ b/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp @@ -334,7 +334,7 @@ ReplayResults JitInstance::CompileMethod(MethodContext* MethodToCompile, int mcI } } - if ((jitResult == CORJIT_OK) || (jitResult == CORJIT_BADCODE) || (jitResult == CORJIT_PREJIT_UNSUPPORTED)) + if ((jitResult == CORJIT_OK) || (jitResult == CORJIT_BADCODE) || (jitResult == CORJIT_R2R_UNSUPPORTED)) { // capture the results of compilation pParam->pThis->mc->cr->recCompileMethod(&NEntryBlock, &NCodeSizeBlock, jitResult); From f07c4f878c3409d5fb957161f53a84cd396a4acd Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Wed, 28 Jan 2026 16:01:43 +0100 Subject: [PATCH 4/6] Update error.h --- src/coreclr/jit/error.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/error.h b/src/coreclr/jit/error.h index 772941e520e9e7..5692730cd4b6b0 100644 --- a/src/coreclr/jit/error.h +++ b/src/coreclr/jit/error.h @@ -66,7 +66,7 @@ extern void DECLSPEC_NORETURN badCode(); extern void DECLSPEC_NORETURN badCode3(const char* msg, const char* msg2, int arg, _In_z_ const char* file, unsigned line); extern void DECLSPEC_NORETURN noWay(); extern void DECLSPEC_NORETURN implLimitation(); -extern void DECLSPEC_NORETURN implPrejitUnsupported(); +extern void DECLSPEC_NORETURN implReadyToRunUnsupported(); extern void DECLSPEC_NORETURN NOMEM(); extern void DECLSPEC_NORETURN fatal(int errCode); From 4a0f47a09e474fdebcf750461e1cb476a8641b0c Mon Sep 17 00:00:00 2001 From: EgorBo Date: Thu, 29 Jan 2026 01:34:49 +0100 Subject: [PATCH 5/6] FB --- src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs | 2 +- src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs | 1 + src/coreclr/vm/jitinterface.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index 49a70a4085a0d8..b230a62e092ae7 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -381,7 +381,7 @@ private CompilationResult CompileMethodInternal(IMethodNode methodCodeNodeNeedin { ThrowHelper.ThrowInvalidProgramException(); } - if (result == CorJitResult.CORJIT_IMPLLIMITATION) + if (result == CorJitResult.CORJIT_IMPLLIMITATION || result == CorJitResult.CORJIT_R2R_UNSUPPORTED) { #if READYTORUN throw new RequiresRuntimeJitException("JIT implementation limitation"); diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs index 29d780fbefce86..edbcb331cf2058 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs @@ -1467,6 +1467,7 @@ public enum CorJitResult CORJIT_SKIPPED = unchecked((int)0x80000004), CORJIT_RECOVERABLEERROR = unchecked((int)0x80000005), CORJIT_IMPLLIMITATION = unchecked((int)0x80000006), + CORJIT_R2R_UNSUPPORTED = unchecked((int)0x80000007), }; public enum TypeCompareState diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index f481c7b3d3d200..8254617caef995 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -13148,6 +13148,7 @@ void ThrowExceptionForJit(HRESULT res) case CORJIT_BADCODE: case CORJIT_IMPLLIMITATION: + case CORJIT_R2R_UNSUPPORTED: default: COMPlusThrow(kInvalidProgramException); break; From e966b8397f3089e4e6247f6f4a9f5d7585e68aea Mon Sep 17 00:00:00 2001 From: EgorBo Date: Thu, 29 Jan 2026 01:54:46 +0100 Subject: [PATCH 6/6] bump guid --- src/coreclr/inc/jiteeversionguid.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/coreclr/inc/jiteeversionguid.h b/src/coreclr/inc/jiteeversionguid.h index b1e4ab8c49fb07..75e98a796a949c 100644 --- a/src/coreclr/inc/jiteeversionguid.h +++ b/src/coreclr/inc/jiteeversionguid.h @@ -37,11 +37,11 @@ #include -constexpr GUID JITEEVersionIdentifier = { /* db46fd97-a8e8-4bda-9cec-d7feb061154c */ - 0xdb46fd97, - 0xa8e8, - 0x4bda, - {0x9c, 0xec, 0xd7, 0xfe, 0xb0, 0x61, 0x15, 0x4c} +constexpr GUID JITEEVersionIdentifier = { /* d98b5b0d-dd75-4e4d-b950-0d1cafd01dea */ + 0xd98b5b0d, + 0xdd75, + 0x4e4d, + {0xb9, 0x50, 0x0d, 0x1c, 0xaf, 0xd0, 0x1d, 0xea} }; #endif // JIT_EE_VERSIONING_GUID_H