Author: martin
Date: 2005-04-15 12:06:26 -0400 (Fri, 15 Apr 2005)
New Revision: 43059

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/attribute.cs
   trunk/mcs/gmcs/expression.cs
Log:
**** Merged r41706 from MCS ****


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-04-15 16:05:35 UTC (rev 43058)
+++ trunk/mcs/gmcs/ChangeLog    2005-04-15 16:06:26 UTC (rev 43059)
@@ -1,3 +1,7 @@
+2005-03-11  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * attribute.cs expression.cs: Get rid of some allocations.
+
 2004-03-11  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * doc.cs : just eliminate the latest change.

Modified: trunk/mcs/gmcs/attribute.cs
===================================================================
--- trunk/mcs/gmcs/attribute.cs 2005-04-15 16:05:35 UTC (rev 43058)
+++ trunk/mcs/gmcs/attribute.cs 2005-04-15 16:06:26 UTC (rev 43059)
@@ -316,16 +316,19 @@
 
                        // Now we extract the positional and named arguments
                        
-                       ArrayList pos_args = new ArrayList ();
-                       ArrayList named_args = new ArrayList ();
+                       ArrayList pos_args = null;
+                       ArrayList named_args = null;
                        int pos_arg_count = 0;
+                       int named_arg_count = 0;
                        
                        if (Arguments != null) {
                                pos_args = (ArrayList) Arguments [0];
                                if (pos_args != null)
                                        pos_arg_count = pos_args.Count;
-                               if (Arguments.Count > 1)
+                               if (Arguments.Count > 1) {
                                        named_args = (ArrayList) Arguments [1];
+                                       named_arg_count = named_args.Count;
+                               }
                        }
 
                        pos_values = new object [pos_arg_count];
@@ -364,17 +367,18 @@
                        ArrayList prop_infos  = null;
                        ArrayList field_values = null;
                        ArrayList prop_values = null;
+                       Hashtable seen_names = null;
 
-                       if (named_args.Count > 0) {
+                       if (named_arg_count > 0) {
                                field_infos = new ArrayList ();
                                prop_infos  = new ArrayList ();
                                field_values = new ArrayList ();
                                prop_values = new ArrayList ();
+
+                               seen_names = new Hashtable();
                        }
-
-                       Hashtable seen_names = new Hashtable();
                        
-                       for (i = 0; i < named_args.Count; i++) {
+                       for (i = 0; i < named_arg_count; i++) {
                                DictionaryEntry de = (DictionaryEntry) 
named_args [i];
                                string member_name = (string) de.Key;
                                Argument a  = (Argument) de.Value;
@@ -536,7 +540,7 @@
                        }
 
                        try {
-                               if (named_args.Count > 0) {
+                               if (named_arg_count > 0) {
                                        prop_info_arr = new PropertyInfo 
[prop_infos.Count];
                                        field_info_arr = new FieldInfo 
[field_infos.Count];
                                        field_values_arr = new object 
[field_values.Count];

Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs        2005-04-15 16:05:35 UTC (rev 43058)
+++ trunk/mcs/gmcs/expression.cs        2005-04-15 16:06:26 UTC (rev 43059)
@@ -4873,8 +4873,8 @@
                        bool method_params = false;
                        Type applicable_type = null;
                        int arg_count = 0;
-                       ArrayList candidates = new ArrayList ();
-                       ArrayList candidate_overrides = new ArrayList ();
+                       ArrayList candidates = new ArrayList (2);
+                       ArrayList candidate_overrides = null;
 
                         //
                         // Used to keep a map between the candidate
@@ -4921,6 +4921,8 @@
                                if (!me.IsBase &&
                                    methods [i].IsVirtual &&
                                    (methods [i].Attributes & 
MethodAttributes.NewSlot) == 0) {
+                                       if (candidate_overrides == null)
+                                               candidate_overrides = new 
ArrayList ();
                                        candidate_overrides.Add (methods [i]);
                                        continue;
                                }
@@ -5118,10 +5120,11 @@
                                        throw new InternalErrorException (
                                                "Should not happen.  An 
'override' method took part in overload resolution: " + method);
                                                                    
-                               foreach (MethodBase candidate in 
candidate_overrides) {
-                                       if (IsOverride (candidate, method))
-                                               method = candidate;
-                               }
+                               if (candidate_overrides != null)
+                                       foreach (MethodBase candidate in 
candidate_overrides) {
+                                               if (IsOverride (candidate, 
method))
+                                                       method = candidate;
+                                       }
                        }
 
                        //

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

Reply via email to