* IInstr.cs: Instructions now get their parent method when being
authorJackson Harper <jackson@novell.com>
Tue, 29 Jul 2003 05:14:25 +0000 (05:14 -0000)
committerJackson Harper <jackson@novell.com>
Tue, 29 Jul 2003 05:14:25 +0000 (05:14 -0000)
emitted.
* *Instr.cs: Adjust emit method to accept a methoddef

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

15 files changed:
mcs/ilasm/codegen/BranchInstr.cs
mcs/ilasm/codegen/CalliInstr.cs
mcs/ilasm/codegen/ChangeLog
mcs/ilasm/codegen/FieldInstr.cs
mcs/ilasm/codegen/IInstr.cs
mcs/ilasm/codegen/IntInstr.cs
mcs/ilasm/codegen/LdcInstr.cs
mcs/ilasm/codegen/LdstrInstr.cs
mcs/ilasm/codegen/LdtokenInstr.cs
mcs/ilasm/codegen/MethodDef.cs
mcs/ilasm/codegen/MethodInstr.cs
mcs/ilasm/codegen/SimpInstr.cs
mcs/ilasm/codegen/SwitchInstr.cs
mcs/ilasm/codegen/TryBlock.cs
mcs/ilasm/codegen/TypeInstr.cs

index a3d27237fbef6a26185e785fc7fd9c3b0f27161c..5f997256780560f2603dacc8533fbf79aa2b7c37 100644 (file)
@@ -16,19 +16,18 @@ namespace Mono.ILASM {
         public class BranchInstr : IInstr {
 
                 private PEAPI.BranchOp op;
-                private MethodDef method;
                 private string label;
 
-                public BranchInstr (PEAPI.BranchOp op, MethodDef method, string label)
+                public BranchInstr (PEAPI.BranchOp op, string label)
                 {
                         this.op = op;
-                        this.method = method;
                         this.label = label;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth,
+                                 PEAPI.CILInstructions cil)
                 {
-                        cil.Branch (op, method.GetLabelDef (label));
+                        cil.Branch (op, meth.GetLabelDef (label));
                 }
         }
 
index 682681027f81d026b2dc2285c23879af696a885b..2e0f63a7e540d19958c940812b50b31f9305cac4 100644 (file)
@@ -26,7 +26,8 @@ namespace Mono.ILASM {
                         this.param = param;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth,
+                                 PEAPI.CILInstructions cil)
                 {
                         PEAPI.Type[] param_array;
                         PEAPI.CalliSig callisig;
index 1d9f6fa555bd11e9dd387e3cc3221f1a985dfd46..d0fc93fbab82682ff17232f74016367fc3b23353 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-29 Jackson Harper <jackson@latitudegeo.com>
+
+       * IInstr.cs: Instructions now get their parent method when being 
+       emitted.
+       * *Instr.cs: Adjust emit method to accept a methoddef
+       
 2003-07-27 Jackson Harper <jackson@latitudegeo.com>
 
        * CodeGen.cs: Set the assembly name when creating the PEFile. 
index 17f04f9246cf6f25c366308b3737281c413ebf35..42eb00632da43cba5cff5f6230dd9cb111b426de 100644 (file)
@@ -24,10 +24,10 @@ namespace Mono.ILASM {
                         this.operand = operand;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth,
+                                 PEAPI.CILInstructions cil)
                 {
                         operand.Resolve (code_gen);
-
                         cil.FieldInst (op, operand.PeapiField);
                 }
 
index 0c87310795ec67bcd5bad490f9a88b14714da7b7..dde7cf7abca056b392611fe403adb6181d409a6c 100644 (file)
@@ -17,7 +17,8 @@ namespace Mono.ILASM {
                 /// <summary>
                 ///  Add this instruction to the supplied codebuffer
                 /// </summary>
-                void Emit (CodeGen code_gen, PEAPI.CILInstructions cil);
+                void Emit (CodeGen code_gen, MethodDef meth, 
+                          PEAPI.CILInstructions cil);
         }
 
 }
index f9aadbc57f795ed973444347edfa90476945da4d..cd5fc6c82e67efb49b6f4cf650e373b9d3035ba3 100644 (file)
@@ -23,7 +23,8 @@ namespace Mono.ILASM {
                         this.operand = operand;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth,
+                                 PEAPI.CILInstructions cil)
                 {
                         cil.IntInst (op, operand);
                 }
index 833bad1a63c4ea0afee7ce7f2152a8a082a8f1fd..c2d4f766fbf4b8b01a0dea253c96ad7998643c8f 100644 (file)
@@ -30,7 +30,8 @@ namespace Mono.ILASM {
                         l_operand = operand;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth,
+                                 PEAPI.CILInstructions cil)
                 {
                         switch (op) {
                         case MiscInstr.ldc_r8:
index 191dad278fc7bb0cbd47ec6d87e7432bc56d32d1..fb7afd6052947916791e383d691df4ea267097fe 100644 (file)
@@ -21,7 +21,8 @@ namespace Mono.ILASM {
                         this.operand = operand;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth,
+                                 PEAPI.CILInstructions cil)
                 {
                         cil.ldstr (operand);
                 }
index 284bad2f348ddf372f9c5ebbe6a842c9664d3e23..3b2eb493b05ee37db51da70e9b391032dadab04c 100644 (file)
@@ -33,7 +33,8 @@ namespace Mono.ILASM {
                         this.type_ref = type_ref;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth,
+                                 PEAPI.CILInstructions cil)
                 {
                         if (field_ref != null) {
                                 field_ref.Resolve (code_gen);
index afee23def07b3a4d8a2f89489228c2677a4cf083..180747636d841429de6e021266a4ab0c65042537 100644 (file)
@@ -344,7 +344,7 @@ namespace Mono.ILASM {
                                         if (label_pos >= label_info.Length)
                                                 next_label_pos = -1;
                                 }
-                                instr.Emit (code_gen, cil);
+                                instr.Emit (code_gen, this, cil);
                         }
 
                 }
index 2f0d9f9542a37f26334904cb8429d5ea76024457..de6d06e4ffc53f55e0ada3278f087b1ce72a286b 100644 (file)
@@ -24,7 +24,8 @@ namespace Mono.ILASM {
                         this.operand = operand;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth, 
+                                 PEAPI.CILInstructions cil)
                 {
                         operand.Resolve (code_gen);
                         cil.MethInst (op, operand.PeapiMethod);
index eea340982855ac65c0a2c696f0f1f0a3d003898d..e13811e003bc5bca36dcc0228b5b11bcd4ff4fe3 100644 (file)
@@ -21,7 +21,8 @@ namespace Mono.ILASM {
                         this.op = op;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth, 
+                                 PEAPI.CILInstructions cil)
                 {
                         cil.Inst (op);
                 }
index 1b13e59245811cb47d4621e47188cafe8a3f984e..2282a4194774739e1d72ae737fd16959fe8ba108 100644 (file)
@@ -16,22 +16,20 @@ namespace Mono.ILASM {
         public class SwitchInstr : IInstr {
 
                 private ArrayList label_list;
-                private MethodDef method;
 
-                public SwitchInstr (ArrayList label_list, MethodDef method)
+                public SwitchInstr (ArrayList label_list)
                 {
                         this.label_list = label_list;
-                        this.method = method;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth, PEAPI.CILInstructions cil)
                 {
                         int count = 0;
                         PEAPI.CILLabel[] label_array = new PEAPI.CILLabel[label_list.Count];
 
                         foreach (object lab in label_list) {
                                 if (lab is string) {
-                                        label_array[count++] = method.GetLabelDef ((string) lab);
+                                        label_array[count++] = meth.GetLabelDef ((string) lab);
                                 } else {
                                         // TODO: int32 labels
                                         throw new NotImplementedException ("offsets in switch statements.");
index 28615de3f802f6eb2ae86e34299e997ec7658566..5e36c24da90b79ab7f350d81c01e7be0a12789a8 100644 (file)
@@ -15,7 +15,6 @@ namespace Mono.ILASM {
 
         public class TryBlock : IInstr {
 
-                private MethodDef method;
                 private string from_label;
                 private string to_label;
                 private ArrayList clause_list;
@@ -34,24 +33,20 @@ namespace Mono.ILASM {
 
                 }
 
-                public void SetMethod (MethodDef method)
-                {
-                        this.method = method;
-                }
-
                 public void AddSehClause (ISehClause clause)
                 {
                         clause_list.Add (clause);
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth,
+                                 PEAPI.CILInstructions cil)
                 {
-                        PEAPI.CILLabel from = method.GetLabelDef (from_label);
-                        PEAPI.CILLabel to = method.GetLabelDef (to_label);
+                        PEAPI.CILLabel from = meth.GetLabelDef (from_label);
+                        PEAPI.CILLabel to = meth.GetLabelDef (to_label);
                         PEAPI.TryBlock try_block = new PEAPI.TryBlock (from, to);
 
                         foreach (ISehClause clause in clause_list)
-                                try_block.AddHandler (clause.Resolve (code_gen, method));
+                                try_block.AddHandler (clause.Resolve (code_gen, meth));
 
                         cil.AddTryBlock (try_block);
                 }
index fd058515b4b5174d8af9f0b6b469b721715286ff..03bec6b4b940b63b913a7f59d6a5a9da01f8cd2c 100644 (file)
@@ -23,10 +23,10 @@ namespace Mono.ILASM {
                         this.operand = operand;
                 }
 
-                public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
+                public void Emit (CodeGen code_gen, MethodDef meth, 
+                                 PEAPI.CILInstructions cil)
                 {
                         operand.Resolve (code_gen);
-
                         cil.TypeInst (op, operand.PeapiType);
                 }