Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82756 --- shadow/82756 2007-09-08 13:55:16.000000000 -0400 +++ shadow/82756.tmp.18142 2007-09-08 13:55:16.000000000 -0400 @@ -0,0 +1,54 @@ +Bug#: 82756 +Product: Mono: Compilers +Version: 1.2 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: useless instructions generated for struct field init + +mcs generate useless code when initing a struct in a field, either instance +or static. Basically, given the struct D, for a D field initialized with: + + d_field = new D (); + +It will emit the code: + + d_field = new D () + d_field = d_field; + +This just inflates the IL code for no reason and pessimizes the code a lot, +especially for instance fields (because it loads the this object reference +across method calls...). + +A simple test program follows, check with monodis the presence of the +useless instructions. + +struct D { + + readonly static D d1 = new D (1); + static D d2 = new D (2); + + int val; + + public D (int v) { + val = v; + } + static void Main () { + D d = new D (5); + T t = new T (); + } +} + +class T { + D d = new D (3); +} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
