make_generic_param_class (MonoGenericParam *param)
{
MonoClass *klass, **ptr;
- int count, pos, i;
+ int count, pos, i, min_align;
MonoGenericParamInfo *pinfo = mono_generic_param_info (param);
MonoGenericContainer *container = mono_generic_param_owner (param);
g_assert_checked (container);
/* We don't use type_token for VAR since only classes can use it (not arrays, pointer, VARs, etc) */
klass->sizes.generic_param_token = !is_anonymous ? pinfo->token : 0;
- /*Init these fields to sane values*/
- klass->min_align = 1;
/*
* This makes sure the the value size of this class is equal to the size of the types the gparam is
* constrained to, the JIT depends on this.
*/
- klass->instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_stack_size_internal (m_class_get_byval_arg (klass), NULL, TRUE);
+ klass->instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_size (m_class_get_byval_arg (klass), &min_align);
+ klass->min_align = min_align;
mono_memory_barrier ();
klass->size_inited = 1;
MonoType *klass_byval_arg = m_class_get_byval_arg (klass);
if (klass_byval_arg->type == MONO_TYPE_VAR || klass_byval_arg->type == MONO_TYPE_MVAR)
- instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_stack_size_internal (klass_byval_arg, NULL, TRUE);
+ instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_size (klass_byval_arg, &min_align);
else if (klass_byval_arg->type == MONO_TYPE_PTR)
instance_size = MONO_ABI_SIZEOF (MonoObject) + MONO_ABI_SIZEOF (gpointer);
return (c.Foo () == "abcd") ? 0 : 1;
}
#endif
+
+ class KvpList<T> {
+ public T[] array = new T[4];
+ int size = 0;
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public void MyAdd(T item) {
+ if (size < (uint)array.Length) {
+ array [size] = item;
+ size++;
+ }
+ }
+ }
+
+ public static int test_0_regress_18455 () {
+ var p = new KvpList<KeyValuePair<int, KeyValuePair<int,int>>> ();
+ KeyValuePair<int, KeyValuePair<int,int>> kvp = new KeyValuePair<int, KeyValuePair<int,int>> (3, new KeyValuePair<int,int> (1, 2));
+
+ p.MyAdd (kvp);
+ return p.array [1].Key == 0 ? 0 : 1;
+ }
}
// #13191