+2009-05-21 Zoltan Varga <vargaz@gmail.com>
+
+ * aot-compiler.c (add_wrappers): Add StructureToPtr/PtrToStructure wrappers.
+
+ * basic.cs: Move the test_2_cprop_bug () test to generics.cs as it involves
+ generics.
+
2009-05-20 Rodrigo Kumpera <rkumpera@novell.com>
* local-propagation.c (mono_local_cprop): Avoid local propagation
add_method (acfg, mono_marshal_get_native_wrapper (method, TRUE, TRUE));
}
}
+
+ /* StructureToPtr/PtrToStructure wrappers */
+ for (i = 0; i < acfg->image->tables [MONO_TABLE_TYPEDEF].rows; ++i) {
+ MonoClass *klass;
+
+ token = MONO_TOKEN_TYPE_DEF | (i + 1);
+ klass = mono_class_get (acfg->image, token);
+
+ if (klass->valuetype && !klass->generic_container && ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT)) {
+ MonoMarshalType *info;
+ gboolean can_marshal = TRUE;
+ int j;
+
+ info = mono_marshal_load_type_info (klass);
+
+ /* Only allow a few field types to avoid asserts in the marshalling code */
+ for (j = 0; j < info->num_fields; j++) {
+ switch (info->fields [j].field->type->type) {
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ break;
+ default:
+ can_marshal = FALSE;
+ break;
+ }
+ }
+
+ if (can_marshal) {
+ add_method (acfg, mono_marshal_get_struct_to_ptr (klass));
+ add_method (acfg, mono_marshal_get_ptr_to_struct (klass));
+ }
+ }
+ }
}
static gboolean
return 0;
}
- //repro for #505375
- public static int test_2_cprop_bug () {
- int idx = 0;
- int a = 1;
- var cmp = System.Collections.Generic.Comparer<int>.Default ;
- if (cmp.Compare (a, 0) > 0)
- a = 0;
- do { idx++; } while (cmp.Compare (idx - 1, a) == 0);
- return idx;
- }
-
-
}
return 0;
}
+ //repro for #505375
+ [Category ("!FULLAOT")]
+ public static int test_2_cprop_bug () {
+ int idx = 0;
+ int a = 1;
+ var cmp = System.Collections.Generic.Comparer<int>.Default ;
+ if (cmp.Compare (a, 0) > 0)
+ a = 0;
+ do { idx++; } while (cmp.Compare (idx - 1, a) == 0);
+ return idx;
+ }
+
public static void VirtualInterfaceCallFromGenericMethod <T> (IFoo f) {
f.Bar <T> ();
}