[Mono-bugs] [Bug 59367][Wis] Changed - We do not always choose most space efficient way to create arrays

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 31 May 2004 23:53:54 -0400 (EDT)


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 bmaurer@users.sf.net.

http://bugzilla.ximian.com/show_bug.cgi?id=59367

--- shadow/59367	2004-05-31 22:48:03.000000000 -0400
+++ shadow/59367.tmp.19909	2004-05-31 23:53:54.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 59367
 Product: Mono: Compilers
 Version: unspecified
-OS: 
+OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Wishlist
 Component: C#
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: bmaurer@users.sf.net               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -181,6 +181,23 @@
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
          00 00 00 00 00 00 00 00 00 00 00 00) // size: 1724
 
 however, this was a silly decision. In exchange for a few bytes of IL code,
 we have added 1724 bytes of data. In this case, it would have been smarter
 to just do it via IL code.
+
+------- Additional Comments From bmaurer@users.sf.net  2004-05-31 23:53 -------
+I think the condition needs to be the following:
+
+With
+
+int total_size = /* total number of elements in the array */
+int store_size = /* size of dup/ldc/ldc/stelem */
+int array_factor = /* number of bytes per element in the const array */
+int const_overhead = /* size of ldtoken/call */
+int non_zero_const = /* number of constant elements whose value is not
+0 */
+
+if ((total_size * array_factor + const_overhead) > (non_zero_const *
+store_size))
+
+note the non-zero thing here. By default, arrays are 0 inited.