Skip to content

Commit a96bde9

Browse files
BrzVladvargaz
andauthored
Backport fixes for sharing wrappers when type attributes are involved (#21537)
* [wasm] Fix the handling of i8/u8 in get_wrapper_shared_type_full (). (#19859) Previously, these were returned verbatim, which caused sharing issues when the type had attributes. Fixes #19841. * [aot] Fix the handling of r4/r8 parameter types with attributes during generic sharing. (#20217) The attributes need to be ignored as with the other types, otherwise gsharedvt wrappers for signatures with parameters like double f = default will not be found. Fixes #20195. Co-authored-by: Zoltan Varga <[email protected]>
1 parent e7c645a commit a96bde9

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

mono/mini/mini-generic-sharing.c

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,31 @@ get_wrapper_shared_type_full (MonoType *t, gboolean is_field)
12541254
return mono_get_int32_type ();
12551255
case MONO_TYPE_U4:
12561256
return m_class_get_byval_arg (mono_defaults.uint32_class);
1257+
case MONO_TYPE_I8:
1258+
#if TARGET_SIZEOF_VOID_P == 8
1259+
/* Use native int as its already used for byref */
1260+
return m_class_get_byval_arg (mono_defaults.int_class);
1261+
#else
1262+
return m_class_get_byval_arg (mono_defaults.int64_class);
1263+
#endif
1264+
case MONO_TYPE_U8:
1265+
return m_class_get_byval_arg (mono_defaults.uint64_class);
1266+
case MONO_TYPE_I:
1267+
#if TARGET_SIZEOF_VOID_P == 8
1268+
return m_class_get_byval_arg (mono_defaults.int_class);
1269+
#else
1270+
return m_class_get_byval_arg (mono_defaults.int32_class);
1271+
#endif
1272+
case MONO_TYPE_U:
1273+
#if TARGET_SIZEOF_VOID_P == 8
1274+
return m_class_get_byval_arg (mono_defaults.uint64_class);
1275+
#else
1276+
return m_class_get_byval_arg (mono_defaults.uint32_class);
1277+
#endif
1278+
case MONO_TYPE_R4:
1279+
return m_class_get_byval_arg (mono_defaults.single_class);
1280+
case MONO_TYPE_R8:
1281+
return m_class_get_byval_arg (mono_defaults.double_class);
12571282
case MONO_TYPE_OBJECT:
12581283
case MONO_TYPE_CLASS:
12591284
case MONO_TYPE_SZARRAY:
@@ -1310,16 +1335,6 @@ get_wrapper_shared_type_full (MonoType *t, gboolean is_field)
13101335
t = shared_type;
13111336
return t;
13121337
}
1313-
#if TARGET_SIZEOF_VOID_P == 8
1314-
case MONO_TYPE_I8:
1315-
return mono_get_int_type ();
1316-
#endif
1317-
#if TARGET_SIZEOF_VOID_P == 4
1318-
case MONO_TYPE_I:
1319-
return mono_get_int32_type ();
1320-
case MONO_TYPE_U:
1321-
return m_class_get_byval_arg (mono_defaults.uint32_class);
1322-
#endif
13231338
default:
13241339
break;
13251340
}

0 commit comments

Comments
 (0)