Skip to content

Commit bc28cbe

Browse files
monojenkinsvargaz
andauthored
[runtime] Fix the mapping of 'int' in jit icall signatures, it should be int32 not native int. (#33711)
Co-authored-by: vargaz <vargaz@users.noreply.github.com>
1 parent bcb33e5 commit bc28cbe

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

src/mono/mono/metadata/icall-signatures.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ ICALL_SIG (3, (object, object, ptr)) \
199199
ICALL_SIG (3, (object, ptr, int)) \
200200
ICALL_SIG (3, (object, ptr, int32)) \
201201
ICALL_SIG (3, (object, ptr, ptr)) \
202+
ICALL_SIG (3, (object, ptr, sizet)) \
202203
ICALL_SIG (3, (ptr, int32, ptrref)) \
203204
ICALL_SIG (3, (ptr, object, ptr)) \
204205
ICALL_SIG (3, (ptr, ptr, int)) \
@@ -229,6 +230,8 @@ ICALL_SIG (4, (object, ptr, int, int)) \
229230
ICALL_SIG (4, (object, ptr, int, int32)) \
230231
ICALL_SIG (4, (object, ptr, int, ptr)) \
231232
ICALL_SIG (4, (object, ptr, ptr, int32)) \
233+
ICALL_SIG (4, (object, ptr, sizet, ptr)) \
234+
ICALL_SIG (4, (object, ptr, sizet, int32)) \
232235
ICALL_SIG (4, (ptr, object, int32, int32)) \
233236
ICALL_SIG (4, (ptr, object, ptr, ptr)) \
234237
ICALL_SIG (4, (ptr, ptr, int, ptr)) \

src/mono/mono/metadata/icall.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9509,27 +9509,27 @@ mono_lookup_icall_symbol (MonoMethod *m)
95099509
// Storage for these enums is pointer-sized as it gets replaced with MonoType*.
95109510
//
95119511
// mono_create_icall_signatures depends on this order. Handle with care.
9512-
// It is alphabetical.
95139512
typedef enum ICallSigType {
95149513
ICALL_SIG_TYPE_bool = 0x00,
95159514
ICALL_SIG_TYPE_boolean = ICALL_SIG_TYPE_bool,
95169515
ICALL_SIG_TYPE_double = 0x01,
95179516
ICALL_SIG_TYPE_float = 0x02,
95189517
ICALL_SIG_TYPE_int = 0x03,
95199518
ICALL_SIG_TYPE_int16 = 0x04,
9520-
ICALL_SIG_TYPE_int32 = 0x05,
9521-
ICALL_SIG_TYPE_int8 = 0x06,
9522-
ICALL_SIG_TYPE_long = 0x07,
9523-
ICALL_SIG_TYPE_obj = 0x08,
9519+
ICALL_SIG_TYPE_int32 = ICALL_SIG_TYPE_int,
9520+
ICALL_SIG_TYPE_int8 = 0x05,
9521+
ICALL_SIG_TYPE_long = 0x06,
9522+
ICALL_SIG_TYPE_obj = 0x07,
95249523
ICALL_SIG_TYPE_object = ICALL_SIG_TYPE_obj,
9525-
ICALL_SIG_TYPE_ptr = ICALL_SIG_TYPE_int,
9524+
ICALL_SIG_TYPE_ptr = 0x08,
95269525
ICALL_SIG_TYPE_ptrref = 0x09,
95279526
ICALL_SIG_TYPE_string = 0x0A,
95289527
ICALL_SIG_TYPE_uint16 = 0x0B,
95299528
ICALL_SIG_TYPE_uint32 = 0x0C,
95309529
ICALL_SIG_TYPE_uint8 = 0x0D,
95319530
ICALL_SIG_TYPE_ulong = 0x0E,
95329531
ICALL_SIG_TYPE_void = 0x0F,
9532+
ICALL_SIG_TYPE_sizet = 0x10
95339533
} ICallSigType;
95349534

95359535
#define ICALL_SIG_TYPES_1(a) ICALL_SIG_TYPE_ ## a,
@@ -9592,19 +9592,20 @@ mono_create_icall_signatures (void)
95929592
m_class_get_byval_arg (mono_defaults.boolean_class), // ICALL_SIG_TYPE_bool
95939593
m_class_get_byval_arg (mono_defaults.double_class), // ICALL_SIG_TYPE_double
95949594
m_class_get_byval_arg (mono_defaults.single_class), // ICALL_SIG_TYPE_float
9595-
m_class_get_byval_arg (mono_defaults.int_class), // ICALL_SIG_TYPE_int
9595+
m_class_get_byval_arg (mono_defaults.int32_class), // ICALL_SIG_TYPE_int
95969596
m_class_get_byval_arg (mono_defaults.int16_class), // ICALL_SIG_TYPE_int16
9597-
m_class_get_byval_arg (mono_defaults.int32_class), // ICALL_SIG_TYPE_int32
95989597
m_class_get_byval_arg (mono_defaults.sbyte_class), // ICALL_SIG_TYPE_int8
95999598
m_class_get_byval_arg (mono_defaults.int64_class), // ICALL_SIG_TYPE_long
96009599
m_class_get_byval_arg (mono_defaults.object_class), // ICALL_SIG_TYPE_obj
9600+
m_class_get_byval_arg (mono_defaults.int_class), // ICALL_SIG_TYPE_ptr
96019601
mono_class_get_byref_type (mono_defaults.int_class), // ICALL_SIG_TYPE_ptrref
96029602
m_class_get_byval_arg (mono_defaults.string_class), // ICALL_SIG_TYPE_string
96039603
m_class_get_byval_arg (mono_defaults.uint16_class), // ICALL_SIG_TYPE_uint16
96049604
m_class_get_byval_arg (mono_defaults.uint32_class), // ICALL_SIG_TYPE_uint32
96059605
m_class_get_byval_arg (mono_defaults.byte_class), // ICALL_SIG_TYPE_uint8
96069606
m_class_get_byval_arg (mono_defaults.uint64_class), // ICALL_SIG_TYPE_ulong
96079607
m_class_get_byval_arg (mono_defaults.void_class), // ICALL_SIG_TYPE_void
9608+
m_class_get_byval_arg (mono_defaults.int_class), // ICALL_SIG_TYPE_sizet
96089609
};
96099610

96109611
MonoMethodSignature_a *sig = (MonoMethodSignature*)&mono_icall_signatures;

src/mono/mono/metadata/sgen-mono.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2970,9 +2970,9 @@ sgen_client_init (void)
29702970
void
29712971
mono_gc_init_icalls (void)
29722972
{
2973-
mono_register_jit_icall (mono_gc_alloc_obj, mono_icall_sig_object_ptr_int, FALSE);
2974-
mono_register_jit_icall (mono_gc_alloc_vector, mono_icall_sig_object_ptr_int_int, FALSE);
2975-
mono_register_jit_icall (mono_gc_alloc_string, mono_icall_sig_object_ptr_int_int32, FALSE);
2973+
mono_register_jit_icall (mono_gc_alloc_obj, mono_icall_sig_object_ptr_sizet, FALSE);
2974+
mono_register_jit_icall (mono_gc_alloc_vector, mono_icall_sig_object_ptr_sizet_ptr, FALSE);
2975+
mono_register_jit_icall (mono_gc_alloc_string, mono_icall_sig_object_ptr_sizet_int32, FALSE);
29762976
mono_register_jit_icall (mono_profiler_raise_gc_allocation, mono_icall_sig_void_object, FALSE);
29772977
}
29782978

0 commit comments

Comments
 (0)