[runtime] Make the size of the pseudo classes created by make_generic_param_class...
authorZoltan Varga <vargaz@gmail.com>
Wed, 11 Mar 2015 04:08:04 +0000 (00:08 -0400)
committerZoltan Varga <vargaz@gmail.com>
Wed, 11 Mar 2015 04:08:04 +0000 (00:08 -0400)
mono/metadata/class.c

index c1e734bcbe6dceab35abdfb1c90dd84a2eeb614f..44f8d3142130ede756a535c18ccfbb701b4334b7 100644 (file)
@@ -6153,9 +6153,14 @@ make_generic_param_class (MonoGenericParam *param, MonoImage *image, gboolean is
 
        /*Init these fields to sane values*/
        klass->min_align = 1;
-       klass->instance_size = sizeof (gpointer);
+       /*
+        * 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 = sizeof (MonoObject) + mono_type_stack_size_internal (&klass->byval_arg, NULL, TRUE);
        mono_memory_barrier ();
        klass->size_inited = 1;
+       klass->setup_fields_called = 1;
 
        mono_class_setup_supertypes (klass);