2002-01-22 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 22 Jan 2002 19:52:13 +0000 (19:52 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 22 Jan 2002 19:52:13 +0000 (19:52 -0000)
* ecore.cs (FieldExpr.Emit): Release temporaries.

* assign.cs (LocalTemporary.Release): new function.

* codegen.cs (EmitContext.GetTemporaryStorage,
EmitContext.FreeTemporaryStorage): Rework the way we deal with
temporary storage.  Now we can "put back" localbuilders when we
are done with them

svn path=/trunk/mcs/; revision=2096

mcs/mcs/ChangeLog
mcs/mcs/TODO
mcs/mcs/assign.cs
mcs/mcs/class.cs
mcs/mcs/codegen.cs
mcs/mcs/driver.cs
mcs/mcs/ecore.cs
mcs/mcs/statement.cs

index dad4a8c895dbe320452af73bdada84161de4a7c6..a53b6faa6854eb1268f366e137126767eceb7eb6 100755 (executable)
@@ -1,3 +1,14 @@
+2002-01-22  Miguel de Icaza  <miguel@ximian.com>
+
+       * ecore.cs (FieldExpr.Emit): Release temporaries.
+
+       * assign.cs (LocalTemporary.Release): new function.
+
+       * codegen.cs (EmitContext.GetTemporaryStorage,
+       EmitContext.FreeTemporaryStorage): Rework the way we deal with
+       temporary storage.  Now we can "put back" localbuilders when we
+       are done with them
+
 2002-01-21  Miguel de Icaza  <miguel@ximian.com>
 
        * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
index f41b3b87fafcbabdac46cad3764d28d3f03cf7f9..1826597ab61c57c02d58871c77c03dc480b11307 100644 (file)
@@ -157,6 +157,10 @@ PENDING TASKS
 OPTIMIZATIONS
 -------------
 
+* Use of local temporary in UnaryMutator
+
+       We should get rid of the Localtemporary there for some cases
+
 * Emitcontext
 
        Do we really need to instanciate this variable all the time?
index b30d48d3ef8c25dbd1150ac564dc9cfb6081e1fd..e8513561055cd50cf3c556efce7b31931e7eabe2 100755 (executable)
@@ -52,7 +52,13 @@ namespace Mono.CSharp {
                        builder = ec.GetTemporaryStorage (t);
                }
 
-               public LocalTemporary (LocalBuilder b, Type t)
+               public void Release (EmitContext ec)
+               {
+                       ec.FreeTemporaryStorage (builder);
+                       builder = null;
+               }
+               
+               Public LocalTemporary (LocalBuilder b, Type t)
                {
                        type = t;
                        eclass = ExprClass.Value;
@@ -245,6 +251,7 @@ namespace Mono.CSharp {
                                tempo.Store (ec);
                                am.EmitAssign (ec, tempo);
                                tempo.Emit (ec);
+                               tempo.Release (ec);
                        }
                }
                
index 752950ba046106720b99724881834e0bd2984ae4..043b731d5e71d52eb5aaf2875f41cc3abcd1bbdf 100755 (executable)
@@ -1245,16 +1245,16 @@ namespace Mono.CSharp {
                                filter = accepting_filter; 
                        
                        if ((mt & MemberTypes.Field) != 0) {
-                               if (Fields != null) {
-                                       foreach (Field f in Fields) {
+                               if (fields != null) {
+                                       foreach (Field f in fields) {
                                                FieldBuilder fb = f.FieldBuilder;
                                                if (filter (fb, criteria) == true)
                                                        members.Add (fb);
                                        }
                                }
 
-                               if (Constants != null) {
-                                       foreach (Const con in Constants) {
+                               if (constants != null) {
+                                       foreach (Const con in constants) {
                                                FieldBuilder fb = con.FieldBuilder;
                                                if (filter (fb, criteria) == true)
                                                        members.Add (fb);
@@ -1263,8 +1263,8 @@ namespace Mono.CSharp {
                        }
 
                        if ((mt & MemberTypes.Method) != 0) {
-                               if (Methods != null) {
-                                       foreach (Method m in Methods) {
+                               if (methods != null) {
+                                       foreach (Method m in methods) {
                                                MethodBuilder mb = m.MethodBuilder;
 
                                                // If we are in transit, ignore
@@ -1279,8 +1279,8 @@ namespace Mono.CSharp {
                                        }
                                }
 
-                               if (Operators != null){
-                                       foreach (Operator o in Operators) {
+                               if (operators != null){
+                                       foreach (Operator o in operators) {
                                                MethodBuilder ob = o.OperatorMethodBuilder;
 
                                                if (filter (ob, criteria) == true)
@@ -1290,23 +1290,23 @@ namespace Mono.CSharp {
                        }
 
                        if ((mt & MemberTypes.Event) != 0) {
-                               if (Events != null)
-                                       foreach (Event e in Events) {
+                               if (events != null)
+                                       foreach (Event e in events) {
                                                if (filter (e.EventBuilder, criteria) == true)
                                                        members.Add (e.EventBuilder);
                                        }
                        }
                        
                        if ((mt & MemberTypes.Property) != 0){
-                               if (Properties != null)
-                                       foreach (Property p in Properties) {
+                               if (properties != null)
+                                       foreach (Property p in properties) {
                                                if (filter (p.PropertyBuilder, criteria) == true) {
                                                        members.Add (p.PropertyBuilder);
                                                }
                                        }
 
-                               if (Indexers != null)
-                                       foreach (Indexer ix in Indexers) {
+                               if (indexers != null)
+                                       foreach (Indexer ix in indexers) {
                                                if (filter (ix.PropertyBuilder, criteria) == true) {
                                                        members.Add (ix.PropertyBuilder);
                                                }
@@ -1775,7 +1775,6 @@ namespace Mono.CSharp {
                //
                static public bool AsAccessible (Type type, int flags)
                {
-                       // FIXME: Implement me
                        return true;
                }
 
@@ -2064,6 +2063,7 @@ namespace Mono.CSharp {
                        if (!parent.MethodModifiersValid (ModFlags, Name, Location))
                                return false;
 
+                       flags = Modifiers.MethodAttr (ModFlags);
                        //
                        // verify accessibility
                        //
@@ -2130,7 +2130,6 @@ namespace Mono.CSharp {
                        //
                        // If we implement an interface, extract the interface name.
                        //
-                       flags = Modifiers.MethodAttr (ModFlags);
 
                        if (Name.IndexOf (".") != -1){
                                int pos = Name.LastIndexOf (".");
index ae75e96231e1d1ebfed25f9963da0b7f57f563b6..0c493bb1d113a7389222868927a92259cea2d997 100755 (executable)
@@ -238,19 +238,22 @@ namespace Mono.CSharp {
                {
                        LocalBuilder location;
                        
-                       if (temporary_storage == null)
-                               temporary_storage = new Hashtable ();
-                       
-                       location = (LocalBuilder) temporary_storage [t];
-                       if (location != null)
-                               return location;
+                       if (temporary_storage != null){
+                               location = (LocalBuilder) temporary_storage [t];
+                               if (location != null)
+                                       return location;
+                       }
                        
                        location = ig.DeclareLocal (t);
-                       temporary_storage.Add (t, location);
                        
                        return location;
                }
 
+               public void FreeTemporaryStorage (LocalBuilder b)
+               {
+                       // Empty for now.
+               }
+
                /// <summary>
                ///   Current loop begin and end labels.
                /// </summary>
index 6e628becc03b778dce9938efcdb4323e2a57dcd5..29fe11c9b1c321b60fb96a879216ebd68dd65322 100755 (executable)
@@ -310,7 +310,7 @@ namespace Mono.CSharp
                        // This is not required because Assembly.Load knows about this
                        // path.
                        //
-                       link_paths.Add (GetSystemDir ()); 
+                       link_paths.Add (GetSystemDir ());
 
                        int argc = args.Length;
                        for (i = 0; i < argc; i++){
@@ -532,6 +532,7 @@ namespace Mono.CSharp
                                        first_source = arg;
 
                                string [] files = Directory.GetFiles (".", arg);
+                               
                                foreach (string f in files){
                                        if (!f.ToLower ().EndsWith (".cs")){
                                                error ("Do not know how to compile " + arg);
index b01bc4a22ed5f27218b90f9ec4625052b10bb1e0..51232241232242ab852511e7727722375d795a52 100755 (executable)
@@ -3100,9 +3100,10 @@ namespace Mono.CSharp {
                        } else {
                                if (InstanceExpression.Type.IsValueType){
                                        IMemoryLocation ml;
+                                       LocalTemporary tempo = null;
                                        
                                        if (!(InstanceExpression is IMemoryLocation)){
-                                               LocalTemporary tempo = new LocalTemporary (
+                                               tempo = new LocalTemporary (
                                                        ec, InstanceExpression.Type);
 
                                                InstanceExpression.Emit (ec);
index b9ca8abacb8c5236400c79db2b5e99227364a0be..b757088dbe2360502c8d6a5a497e9d8685116ba2 100755 (executable)
@@ -747,7 +747,7 @@ namespace Mono.CSharp {
 
                        return null;
                }
-               
+
                public bool AddVariable (string type, string name, Parameters pars, Location l)
                {
                        if (variables == null)
@@ -931,7 +931,7 @@ namespace Mono.CSharp {
                                        string name = (string) de.Key;
                                        VariableInfo vi = (VariableInfo) de.Value;
                                        Type t;
-                                       
+
                                        t = RootContext.LookupType (tc, vi.Type, false, vi.Location);
                                        if (t == null)
                                                continue;