Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/coreclr/inc/readytorun.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// If you update this, ensure you run `git grep MINIMUM_READYTORUN_MAJOR_VERSION`
// and handle pending work.
#define READYTORUN_MAJOR_VERSION 18
#define READYTORUN_MINOR_VERSION 0x0003
#define READYTORUN_MINOR_VERSION 0x0004

#define MINIMUM_READYTORUN_MAJOR_VERSION 18

Expand Down Expand Up @@ -54,6 +54,7 @@
// R2R Version 18 updates fields layout algorithm
// R2R Version 18.2 adds InitClass and InitInstClass helpers
// R2R Version 18.3 adds the ExternalTypeMaps, ProxyTypeMaps, TypeMapAssemblyTargets sections
// R2R Version 18.4 adds ThrowArgument, ThrowArgumentOutOfRange, ThrowPlatformNotSupported, and ThrowNotImplemented helpers

struct READYTORUN_CORE_HEADER
{
Expand Down Expand Up @@ -346,6 +347,10 @@ enum ReadyToRunHelper
READYTORUN_HELPER_ThrowNullRef = 0x25,
READYTORUN_HELPER_ThrowDivZero = 0x26,
READYTORUN_HELPER_ThrowExact = 0x27,
READYTORUN_HELPER_ThrowArgument = 0x28,
Copy link
Member

@jkotas jkotas Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump minor R2R version at the top of the file, and add a comment on what changed in this R2R version

READYTORUN_HELPER_ThrowArgumentOutOfRange = 0x29,
READYTORUN_HELPER_ThrowPlatformNotSupported = 0x2A,
READYTORUN_HELPER_ThrowNotImplemented = 0x2B,

// Write barriers
READYTORUN_HELPER_WriteBarrier = 0x30,
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/inc/readytorunhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ HELPER(READYTORUN_HELPER_FailFast, CORINFO_HELP_FAIL_FAST,
HELPER(READYTORUN_HELPER_ThrowNullRef, CORINFO_HELP_THROWNULLREF, OPTIMIZEFORSIZE)
HELPER(READYTORUN_HELPER_ThrowDivZero, CORINFO_HELP_THROWDIVZERO, OPTIMIZEFORSIZE)
HELPER(READYTORUN_HELPER_ThrowExact, CORINFO_HELP_THROWEXACT, OPTIMIZEFORSIZE)
HELPER(READYTORUN_HELPER_ThrowArgument, CORINFO_HELP_THROW_ARGUMENTEXCEPTION, OPTIMIZEFORSIZE)
HELPER(READYTORUN_HELPER_ThrowArgumentOutOfRange, CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, OPTIMIZEFORSIZE)
HELPER(READYTORUN_HELPER_ThrowPlatformNotSupported, CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, OPTIMIZEFORSIZE)
HELPER(READYTORUN_HELPER_ThrowNotImplemented, CORINFO_HELP_THROW_NOT_IMPLEMENTED, OPTIMIZEFORSIZE)

HELPER(READYTORUN_HELPER_WriteBarrier, CORINFO_HELP_ASSIGN_REF, )
HELPER(READYTORUN_HELPER_CheckedWriteBarrier, CORINFO_HELP_CHECKED_ASSIGN_REF, )
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct ReadyToRunHeaderConstants
static const uint32_t Signature = 0x00525452; // 'RTR'

static const uint32_t CurrentMajorVersion = 18;
static const uint32_t CurrentMinorVersion = 3;
static const uint32_t CurrentMinorVersion = 4;
};

struct ReadyToRunHeader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal struct ReadyToRunHeaderConstants
public const uint Signature = 0x00525452; // 'RTR'

public const ushort CurrentMajorVersion = 18;
public const ushort CurrentMinorVersion = 3;
public const ushort CurrentMinorVersion = 4;
}
#if READYTORUN
#pragma warning disable 0169
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ public enum ReadyToRunHelper
ThrowNullRef = 0x25,
ThrowDivZero = 0x26,
ThrowExact = 0x27,
ThrowArgument = 0x28,
ThrowArgumentOutOfRange = 0x29,
ThrowPlatformNotSupported = 0x2A,
ThrowNotImplemented = 0x2B,

// Write barriers
WriteBarrier = 0x30,
Expand Down Expand Up @@ -372,11 +376,6 @@ public enum ReadyToRunHelper
// Marker to be used in asserts.
FirstFakeHelper,

ThrowArgumentOutOfRange,
ThrowArgument,
ThrowPlatformNotSupported,
ThrowNotImplemented,

DebugBreak,

GetRuntimeType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1291,17 +1291,25 @@ private ISymbolNode GetHelperFtnUncached(CorInfoHelpFunc ftnNum)
id = ReadyToRunHelper.InitInstClass;
break;

case CorInfoHelpFunc.CORINFO_HELP_GETSYNCFROMCLASSHANDLE:
case CorInfoHelpFunc.CORINFO_HELP_GETCLASSFROMMETHODPARAM:
case CorInfoHelpFunc.CORINFO_HELP_THROW_ARGUMENTEXCEPTION:
id = ReadyToRunHelper.ThrowArgument;
break;
case CorInfoHelpFunc.CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION:
id = ReadyToRunHelper.ThrowArgumentOutOfRange;
break;
case CorInfoHelpFunc.CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED:
id = ReadyToRunHelper.ThrowPlatformNotSupported;
break;
case CorInfoHelpFunc.CORINFO_HELP_THROW_NOT_IMPLEMENTED:
id = ReadyToRunHelper.ThrowNotImplemented;
break;
Comment on lines 1294 to +1305

case CorInfoHelpFunc.CORINFO_HELP_GETSYNCFROMCLASSHANDLE:
case CorInfoHelpFunc.CORINFO_HELP_GETCLASSFROMMETHODPARAM:
case CorInfoHelpFunc.CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE_MAYBENULL:
case CorInfoHelpFunc.CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_MAYBENULL:
case CorInfoHelpFunc.CORINFO_HELP_GETREFANY:
case CorInfoHelpFunc.CORINFO_HELP_NEW_MDARR_RARE:
// For Vector256.Create and similar cases
case CorInfoHelpFunc.CORINFO_HELP_THROW_NOT_IMPLEMENTED:
// For x86 tailcall where helper is required we need runtime JIT.
case CorInfoHelpFunc.CORINFO_HELP_TAILCALL:
// DirectOnThreadLocalData helper is used at runtime during R2R fixup resolution, not during R2R compilation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,22 @@ private void ParseHelper(StringBuilder builder)
builder.Append("THROW_DIV_ZERO");
break;

case ReadyToRunHelper.ThrowArgument:
builder.Append("THROW_ARGUMENT");
break;

case ReadyToRunHelper.ThrowArgumentOutOfRange:
builder.Append("THROW_ARGUMENT_OUT_OF_RANGE");
break;

case ReadyToRunHelper.ThrowPlatformNotSupported:
builder.Append("THROW_PLATFORM_NOT_SUPPORTED");
break;

case ReadyToRunHelper.ThrowNotImplemented:
builder.Append("THROW_NOT_IMPLEMENTED");
break;

// Write barriers
case ReadyToRunHelper.WriteBarrier:
builder.Append("WRITE_BARRIER");
Expand Down
Loading