From 852cd8e477b3d2f7ba3fa77b6127e597459b3751 Mon Sep 17 00:00:00 2001 From: vargaz Date: Thu, 19 Mar 2020 04:24:40 +0000 Subject: [PATCH] [runtime] Fix the mapping of 'int' in jit icall signatures, it should be int32 not native int. --- src/mono/mono/metadata/icall-signatures.h | 3 +++ src/mono/mono/metadata/icall.c | 17 +++++++++-------- src/mono/mono/metadata/sgen-mono.c | 6 +++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/mono/mono/metadata/icall-signatures.h b/src/mono/mono/metadata/icall-signatures.h index 876c427c314fae..40d2f9b8392376 100644 --- a/src/mono/mono/metadata/icall-signatures.h +++ b/src/mono/mono/metadata/icall-signatures.h @@ -199,6 +199,7 @@ ICALL_SIG (3, (object, object, ptr)) \ ICALL_SIG (3, (object, ptr, int)) \ ICALL_SIG (3, (object, ptr, int32)) \ ICALL_SIG (3, (object, ptr, ptr)) \ +ICALL_SIG (3, (object, ptr, sizet)) \ ICALL_SIG (3, (ptr, int32, ptrref)) \ ICALL_SIG (3, (ptr, object, ptr)) \ ICALL_SIG (3, (ptr, ptr, int)) \ @@ -229,6 +230,8 @@ ICALL_SIG (4, (object, ptr, int, int)) \ ICALL_SIG (4, (object, ptr, int, int32)) \ ICALL_SIG (4, (object, ptr, int, ptr)) \ ICALL_SIG (4, (object, ptr, ptr, int32)) \ +ICALL_SIG (4, (object, ptr, sizet, ptr)) \ +ICALL_SIG (4, (object, ptr, sizet, int32)) \ ICALL_SIG (4, (ptr, object, int32, int32)) \ ICALL_SIG (4, (ptr, object, ptr, ptr)) \ ICALL_SIG (4, (ptr, ptr, int, ptr)) \ diff --git a/src/mono/mono/metadata/icall.c b/src/mono/mono/metadata/icall.c index f1889e31113904..1a198289b95a7e 100644 --- a/src/mono/mono/metadata/icall.c +++ b/src/mono/mono/metadata/icall.c @@ -9509,7 +9509,6 @@ mono_lookup_icall_symbol (MonoMethod *m) // Storage for these enums is pointer-sized as it gets replaced with MonoType*. // // mono_create_icall_signatures depends on this order. Handle with care. -// It is alphabetical. typedef enum ICallSigType { ICALL_SIG_TYPE_bool = 0x00, ICALL_SIG_TYPE_boolean = ICALL_SIG_TYPE_bool, @@ -9517,12 +9516,12 @@ typedef enum ICallSigType { ICALL_SIG_TYPE_float = 0x02, ICALL_SIG_TYPE_int = 0x03, ICALL_SIG_TYPE_int16 = 0x04, - ICALL_SIG_TYPE_int32 = 0x05, - ICALL_SIG_TYPE_int8 = 0x06, - ICALL_SIG_TYPE_long = 0x07, - ICALL_SIG_TYPE_obj = 0x08, + ICALL_SIG_TYPE_int32 = ICALL_SIG_TYPE_int, + ICALL_SIG_TYPE_int8 = 0x05, + ICALL_SIG_TYPE_long = 0x06, + ICALL_SIG_TYPE_obj = 0x07, ICALL_SIG_TYPE_object = ICALL_SIG_TYPE_obj, - ICALL_SIG_TYPE_ptr = ICALL_SIG_TYPE_int, + ICALL_SIG_TYPE_ptr = 0x08, ICALL_SIG_TYPE_ptrref = 0x09, ICALL_SIG_TYPE_string = 0x0A, ICALL_SIG_TYPE_uint16 = 0x0B, @@ -9530,6 +9529,7 @@ typedef enum ICallSigType { ICALL_SIG_TYPE_uint8 = 0x0D, ICALL_SIG_TYPE_ulong = 0x0E, ICALL_SIG_TYPE_void = 0x0F, + ICALL_SIG_TYPE_sizet = 0x10 } ICallSigType; #define ICALL_SIG_TYPES_1(a) ICALL_SIG_TYPE_ ## a, @@ -9592,12 +9592,12 @@ mono_create_icall_signatures (void) m_class_get_byval_arg (mono_defaults.boolean_class), // ICALL_SIG_TYPE_bool m_class_get_byval_arg (mono_defaults.double_class), // ICALL_SIG_TYPE_double m_class_get_byval_arg (mono_defaults.single_class), // ICALL_SIG_TYPE_float - m_class_get_byval_arg (mono_defaults.int_class), // ICALL_SIG_TYPE_int + m_class_get_byval_arg (mono_defaults.int32_class), // ICALL_SIG_TYPE_int m_class_get_byval_arg (mono_defaults.int16_class), // ICALL_SIG_TYPE_int16 - m_class_get_byval_arg (mono_defaults.int32_class), // ICALL_SIG_TYPE_int32 m_class_get_byval_arg (mono_defaults.sbyte_class), // ICALL_SIG_TYPE_int8 m_class_get_byval_arg (mono_defaults.int64_class), // ICALL_SIG_TYPE_long m_class_get_byval_arg (mono_defaults.object_class), // ICALL_SIG_TYPE_obj + m_class_get_byval_arg (mono_defaults.int_class), // ICALL_SIG_TYPE_ptr mono_class_get_byref_type (mono_defaults.int_class), // ICALL_SIG_TYPE_ptrref m_class_get_byval_arg (mono_defaults.string_class), // ICALL_SIG_TYPE_string m_class_get_byval_arg (mono_defaults.uint16_class), // ICALL_SIG_TYPE_uint16 @@ -9605,6 +9605,7 @@ mono_create_icall_signatures (void) m_class_get_byval_arg (mono_defaults.byte_class), // ICALL_SIG_TYPE_uint8 m_class_get_byval_arg (mono_defaults.uint64_class), // ICALL_SIG_TYPE_ulong m_class_get_byval_arg (mono_defaults.void_class), // ICALL_SIG_TYPE_void + m_class_get_byval_arg (mono_defaults.int_class), // ICALL_SIG_TYPE_sizet }; MonoMethodSignature_a *sig = (MonoMethodSignature*)&mono_icall_signatures; diff --git a/src/mono/mono/metadata/sgen-mono.c b/src/mono/mono/metadata/sgen-mono.c index ab104aafe799c2..37e4f456bc8c7f 100644 --- a/src/mono/mono/metadata/sgen-mono.c +++ b/src/mono/mono/metadata/sgen-mono.c @@ -2970,9 +2970,9 @@ sgen_client_init (void) void mono_gc_init_icalls (void) { - mono_register_jit_icall (mono_gc_alloc_obj, mono_icall_sig_object_ptr_int, FALSE); - mono_register_jit_icall (mono_gc_alloc_vector, mono_icall_sig_object_ptr_int_int, FALSE); - mono_register_jit_icall (mono_gc_alloc_string, mono_icall_sig_object_ptr_int_int32, FALSE); + mono_register_jit_icall (mono_gc_alloc_obj, mono_icall_sig_object_ptr_sizet, FALSE); + mono_register_jit_icall (mono_gc_alloc_vector, mono_icall_sig_object_ptr_sizet_ptr, FALSE); + mono_register_jit_icall (mono_gc_alloc_string, mono_icall_sig_object_ptr_sizet_int32, FALSE); mono_register_jit_icall (mono_profiler_raise_gc_allocation, mono_icall_sig_void_object, FALSE); }