Author: miguel
Date: 2007-12-27 15:54:16 -0500 (Thu, 27 Dec 2007)
New Revision: 91962

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/decl.cs
   trunk/mcs/mcs/expression.cs
   trunk/mcs/mcs/statement.cs
Log:
2007-12-27  AdTsai (http://code.google.com/u/AdTsai/)

        Reviewed by Ben Maurer, Miguel de Icaza, patches from Google's
        GHOP:
        
        
http://code.google.com/p/google-highly-open-participation-mono/issues/detail?id=4
 
        
        * expression.cs: foreach loop to for loop, saved on allocation of
        enumerator (59333kb->59141kb)

        * statement.cs. Changed foreach loops to for loops, saved on
        allocation of enumerator (59141kb->59006kb)

        * decl.cs: ArrayLists in .NET 1.1 allocate 16 elements by default
        when constructed with no specified capacity. This was causing a
        few ArrayLists to allocate more memory than they would potentially
        need in the Block class and MemberCache class. Setting the
        ArrayLists to construct with a capacity of 1 saves some
        memory. (56216kb->55585kb)



Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2007-12-27 19:27:46 UTC (rev 91961)
+++ trunk/mcs/mcs/ChangeLog     2007-12-27 20:54:16 UTC (rev 91962)
@@ -1,3 +1,16 @@
+2007-12-27  AdTsai (http://code.google.com/u/AdTsai/)
+
+       Reviewed by Ben Maurer, Miguel de Icaza, patches from Google's
+       GHOP:
+       
+       
http://code.google.com/p/google-highly-open-participation-mono/issues/detail?id=4
 
+       
+       * expression.cs: foreach loop to for loop, saved on allocation of
+       enumerator (59333kb->59141kb)
+
+       * statement.cs. Changed foreach loops to for loops, saved on
+       allocation of enumerator (59141kb->59006kb)
+
 2007-12-27  Marek Safar  <[EMAIL PROTECTED]>
 
        A fix for bug #347189 (2nd issue)
@@ -5,7 +18,7 @@
        type.
 
 2007-12-27  Miguel de Icaza  <[EMAIL PROTECTED]>
-
+       
        * report.cs: Do not use colors if stdout and stderr are not a
        terminal.
 

Modified: trunk/mcs/mcs/decl.cs
===================================================================
--- trunk/mcs/mcs/decl.cs       2007-12-27 19:27:46 UTC (rev 91961)
+++ trunk/mcs/mcs/decl.cs       2007-12-27 20:54:16 UTC (rev 91962)
@@ -1833,7 +1833,7 @@
                        // We use a name-based hash table of ArrayList's.
                        ArrayList list = (ArrayList) member_hash [name];
                        if (list == null) {
-                               list = new ArrayList ();
+                               list = new ArrayList (1);
                                member_hash.Add (name, list);
                        }
 
@@ -1894,7 +1894,7 @@
                                // We use a name-based hash table of 
ArrayList's.
                                ArrayList list = (ArrayList) method_hash [name];
                                if (list == null) {
-                                       list = new ArrayList ();
+                                       list = new ArrayList (1);
                                        method_hash.Add (name, list);
                                }
 

Modified: trunk/mcs/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2007-12-27 19:27:46 UTC (rev 91961)
+++ trunk/mcs/mcs/expression.cs 2007-12-27 20:54:16 UTC (rev 91962)
@@ -4266,9 +4266,11 @@
                        //
                        // Next, evaluate all the expressions in the argument 
list
                        //
-                       if (Arguments != null){
-                               foreach (Argument a in Arguments){
-                                       if (!a.Resolve (ec, loc))
+                       if (Arguments != null)
+                       {
+                               for (int i = 0; i < Arguments.Count; ++i)
+                               {
+                                       if 
(!((Argument)Arguments[i]).Resolve(ec, loc))
                                                return null;
                                }
                        }

Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs  2007-12-27 19:27:46 UTC (rev 91961)
+++ trunk/mcs/mcs/statement.cs  2007-12-27 20:54:16 UTC (rev 91962)
@@ -1572,7 +1572,7 @@
                        this.EndLocation = end;
                        this.loc = start;
                        this_id = id++;
-                       statements = new ArrayList ();
+                       statements = new ArrayList (1);
                }
 
                public Block CreateSwitchBlock (Location start)
@@ -1598,7 +1598,7 @@
                void AddChild (Block b)
                {
                        if (children == null)
-                               children = new ArrayList ();
+                               children = new ArrayList (1);
                        
                        children.Add (b);
                }
@@ -2069,13 +2069,13 @@
                        }
 
                        if (temporary_variables != null) {
-                               foreach (LocalInfo vi in temporary_variables)
-                                       vi.ResolveVariable (ec);
+                               for (int i = 0; i < temporary_variables.Count; 
i++)
+                                       
((LocalInfo)temporary_variables[i]).ResolveVariable(ec);
                        }
 
                        if (children != null){
-                               foreach (Block b in children)
-                                       b.EmitMeta (ec);
+                               for (int i = 0; i < children.Count; i++)
+                                       ((Block)children[i]).EmitMeta(ec);
                        }
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to