* MethodDef.cs: Add support for .zeroinit. This is just another
authorJackson Harper <jackson@novell.com>
Tue, 18 Nov 2003 10:18:04 +0000 (10:18 -0000)
committerJackson Harper <jackson@novell.com>
Tue, 18 Nov 2003 10:18:04 +0000 (10:18 -0000)
way of initializing locals.

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

mcs/ilasm/codegen/ChangeLog
mcs/ilasm/codegen/MethodDef.cs

index 48efc2b467d3994fa154926dd848c3890242f5ff..c6510d19f3b7ca08e9f88549c32d468c41dabbbd 100644 (file)
@@ -1,3 +1,8 @@
+2003-11-18  Jackson Harper <jackson@ximian.com>
+
+       * MethodDef.cs: Add support for .zeroinit. This is just another
+       way of initializing locals.
+       
 2003-11-17  Jackson Harper <jackson@ximian.com>
 
        * LdstrInstr.cs: Allow strings to be created as bytearrays.
index 393a0b4c6bd6aa3b30f695f1f7e79751f6850567..3c53943aa5c7f795e6e90eeeb7c2e8be14a881b5 100644 (file)
@@ -38,6 +38,7 @@ namespace Mono.ILASM {
                 private ArrayList label_list;
                 private PEAPI.MethodDef methoddef;
                 private bool entry_point;
+                private bool zero_init;
                 private bool is_resolved;
                 private bool is_defined;
                 private ArrayList local_list;
@@ -70,6 +71,7 @@ namespace Mono.ILASM {
                         named_param_table = new Hashtable ();
 
                         entry_point = false;
+                        zero_init = false;
                         init_locals = false;
                         max_stack = -1;
                         pinvoke_info = false;
@@ -191,6 +193,11 @@ namespace Mono.ILASM {
                         entry_point = true;
                 }
 
+                public void ZeroInit ()
+                {
+                        zero_init = true;
+                }
+                
                 public void SetMaxStack (int max_stack)
                 {
                         this.max_stack = max_stack;
@@ -323,6 +330,9 @@ namespace Mono.ILASM {
                                 if (code_gen.Report.ErrorCount > ec)
                                         return;
 
+                                if (zero_init)
+                                        init_locals = true;
+                                
                                 methoddef.AddLocals (local_array, init_locals);
                         }