https://bugzilla.novell.com/show_bug.cgi?id=375160
User [EMAIL PROTECTED] added comment https://bugzilla.novell.com/show_bug.cgi?id=375160#c1 --- Comment #1 from Jan Oravec <[EMAIL PROTECTED]> 2008-03-28 20:02:24 MST --- Just found this code (class.c:1265): if (layout != TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) { /* * For small structs, set min_align to at least the struct size to improve * performance, and since the JIT memset/memcpy code assumes this and generates * unaligned accesses otherwise. See #78990 for a testcase. */ if (class->instance_size <= sizeof (MonoObject) + sizeof (gpointer)) class->min_align = MAX (class->min_align, class->instance_size - sizeof (MonoObject)); } I am not sure, if runtime can choose struct packing arbitrarily, but I see another problems: a) it forces high minimum alignments on structures which could be heavily used in other structures... these other structures are massively oversized because of that b) class->instance_size - sizeof (MonoObject) isn't necessarily 2^N, e.g.: class X { int a; short b; byte c; } class Y { int a; X x; } sizeof (X) == 7, sizeof (Y) == 17, while adding another byte to X makes sizeof (Y) == 16, which is even lower! Something very bad may happen when min_align = 7... -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
