diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index a7146415972d4..5835e33e0db5e 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -2624,7 +2624,7 @@ emit_rgctx_fetch_inline (MonoCompile *cfg, MonoInst *rgctx, MonoJumpInfoRgctxEnt int table_size = mono_class_rgctx_get_array_size (0, entry->in_mrgctx); if (entry->in_mrgctx) - table_size -= MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT / sizeof (TARGET_SIZEOF_VOID_P); + table_size -= MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT / TARGET_SIZEOF_VOID_P; MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, slot_ins->dreg, table_size - 1); MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBGE, slowpath_bb); diff --git a/src/mono/mono/mini/mini.h b/src/mono/mono/mini/mini.h index 34c5e70d94270..4733731656d01 100644 --- a/src/mono/mono/mini/mini.h +++ b/src/mono/mono/mini/mini.h @@ -1097,7 +1097,8 @@ typedef struct { gpointer infos [MONO_ZERO_LEN_ARRAY]; } MonoMethodRuntimeGenericContext; -#define MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT (MONO_ABI_SIZEOF (MonoMethodRuntimeGenericContext) - MONO_ZERO_LEN_ARRAY * TARGET_SIZEOF_VOID_P) +/* MONO_ABI_SIZEOF () would include the 'infos' field as well */ +#define MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT (TARGET_SIZEOF_VOID_P * 2) #define MONO_RGCTX_SLOT_MAKE_RGCTX(i) (i) #define MONO_RGCTX_SLOT_MAKE_MRGCTX(i) ((i) | 0x80000000)