Skip to content

Commit dd1fedf

Browse files
authored
Use JIT assumptions when passing to RhpNewArray* helpers (#121139)
Impleement first item from #116191
1 parent d1700ab commit dd1fedf

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/InternalCalls.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ internal static class InternalCalls
101101

102102
[RuntimeImport(RuntimeLibrary, "RhpNewArrayFast")]
103103
[MethodImpl(MethodImplOptions.InternalCall)]
104-
internal static extern unsafe object RhpNewArrayFast(MethodTable* pEEType, int length);
104+
internal static extern unsafe object RhpNewArrayFast(MethodTable* pEEType, nint length);
105105

106106
#if FEATURE_64BIT_ALIGNMENT
107107
[RuntimeImport(RuntimeLibrary, "RhpNewFastAlign8")]
@@ -114,7 +114,7 @@ internal static class InternalCalls
114114

115115
[RuntimeImport(RuntimeLibrary, "RhpNewArrayFastAlign8")]
116116
[MethodImpl(MethodImplOptions.InternalCall)]
117-
internal static extern unsafe object RhpNewArrayFastAlign8(MethodTable* pEEType, int length);
117+
internal static extern unsafe object RhpNewArrayFastAlign8(MethodTable* pEEType, nint length);
118118

119119
[RuntimeImport(RuntimeLibrary, "RhpNewFastMisalign")]
120120
[MethodImpl(MethodImplOptions.InternalCall)]

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static unsafe object RhNewObject(MethodTable* pEEType)
5656
}
5757

5858
[RuntimeExport("RhNewArray")]
59-
public static unsafe object RhNewArray(MethodTable* pEEType, int length)
59+
public static unsafe object RhNewArray(MethodTable* pEEType, nint length)
6060
{
6161
Debug.Assert(pEEType->IsSzArray);
6262

src/coreclr/nativeaot/Runtime/portable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ FCIMPL1(Object *, RhpNewFinalizable, MethodTable* pEEType)
8888
}
8989
FCIMPLEND
9090

91-
FCIMPL2(Array *, RhpNewArrayFast, MethodTable * pArrayEEType, int numElements)
91+
FCIMPL2(Array *, RhpNewArrayFast, MethodTable * pArrayEEType, intptr_t numElements)
9292
{
9393
Thread * pCurThread = ThreadStore::GetCurrentThread();
9494
gc_alloc_context * acontext = pCurThread->GetAllocContext();
@@ -221,7 +221,7 @@ FCIMPL1(Object*, RhpNewFastMisalign, MethodTable* pEEType)
221221
}
222222
FCIMPLEND
223223

224-
FCIMPL2(Array*, RhpNewArrayFastAlign8, MethodTable* pArrayEEType, int numElements)
224+
FCIMPL2(Array*, RhpNewArrayFastAlign8, MethodTable* pArrayEEType, intptr_t numElements)
225225
{
226226
Thread* pCurThread = ThreadStore::GetCurrentThread();
227227
gc_alloc_context* acontext = pCurThread->GetAllocContext();

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ internal static IntPtr RhHandleAllocCrossReference(object value, IntPtr context)
404404

405405
[MethodImpl(MethodImplOptions.InternalCall)]
406406
[RuntimeImport(RuntimeLibrary, "RhNewArray")]
407-
internal static extern unsafe Array RhNewArray(MethodTable* pEEType, int length);
407+
internal static extern unsafe Array RhNewArray(MethodTable* pEEType, nint length);
408408

409409
[MethodImpl(MethodImplOptions.InternalCall)]
410410
[RuntimeImport(RuntimeLibrary, "RhNewVariableSizeObject")]

src/coreclr/nativeaot/Test.CoreLib/src/System/Runtime/RuntimeImports.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ internal static IntPtr RhGetModuleSection(TypeManagerHandle module, ReadyToRunSe
7878

7979
[MethodImpl(MethodImplOptions.InternalCall)]
8080
[RuntimeImport(RuntimeLibrary, "RhNewArray")]
81-
private static extern unsafe Array RhNewArray(MethodTable* pEEType, int length);
81+
private static extern unsafe Array RhNewArray(MethodTable* pEEType, nint length);
8282

8383
[MethodImpl(MethodImplOptions.InternalCall)]
8484
[RuntimeImport(RuntimeLibrary, "RhNewString")]

0 commit comments

Comments
 (0)