Ejemplo n.º 1
0
                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
                        if (operand != null)
                                cil.ldstr (operand);
                        else
                                cil.ldstr (b_operand);
                }
Ejemplo n.º 2
0
                public PEAPI.HandlerBlock Resolve (CodeGen code_gen, MethodDef method)
                {
                        PEAPI.CILLabel from = handler_block.GetFromLabel (code_gen, method);
                        PEAPI.CILLabel to = handler_block.GetToLabel (code_gen, method);
                        PEAPI.Finally phinally = new PEAPI.Finally (from, to);

                        return phinally;
                }
Ejemplo n.º 3
0
                public PEAPI.HandlerBlock Resolve (CodeGen code_gen, MethodDef method)
                {
                        PEAPI.CILLabel from = handler_block.GetFromLabel (code_gen, method);
                        PEAPI.CILLabel to = handler_block.GetToLabel (code_gen, method);
                        PEAPI.Fault fault = new PEAPI.Fault (from, to);

                        return fault;
                }
Ejemplo n.º 4
0
                public PEAPI.HandlerBlock Resolve (CodeGen code_gen, MethodDef method)
                {
                        PEAPI.CILLabel label = this_block.GetFromLabel (code_gen, method);
                        PEAPI.CILLabel from = handler_block.GetFromLabel (code_gen, method);
                        PEAPI.CILLabel to = handler_block.GetToLabel (code_gen, method);
                        PEAPI.Filter filter = new PEAPI.Filter (label, from, to);

                        return filter;
                }
Ejemplo n.º 5
0
                public PEAPI.HandlerBlock Resolve (CodeGen code_gen, MethodDef method)
                {
                        PEAPI.CILLabel from = handler_block.GetFromLabel (code_gen, method);
                        PEAPI.CILLabel to = handler_block.GetToLabel (code_gen, method);
                        PEAPI.Catch katch;

                        type_ref.Resolve (code_gen);

                        katch = new PEAPI.Catch (type_ref.PeapiType, from, to);

                        return katch;
                }
Ejemplo n.º 6
0
                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
                        PEAPI.CILLabel from = block.GetFromLabel (code_gen, meth);
                        PEAPI.CILLabel to = block.GetToLabel (code_gen, meth);
                        PEAPI.TryBlock try_block = new PEAPI.TryBlock (from, to);

                        foreach (ISehClause clause in clause_list)
                                try_block.AddHandler (clause.Resolve (code_gen, meth));
			
                        cil.AddTryBlock (try_block);
                }
Ejemplo n.º 7
0
                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
                        switch (op) {
                        case MiscInstr.ldc_r8:
                                cil.ldc_r8 (d_operand);
                                break;
                        case MiscInstr.ldc_r4:
                                cil.ldc_r4 ((float) d_operand);
                                break;
                        case MiscInstr.ldc_i8:
                                cil.ldc_i8 (l_operand);
                                break;
                        }
                }
Ejemplo n.º 8
0
                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
                        if (field_ref != null) {
                                field_ref.Resolve (code_gen);
                                cil.FieldInst (PEAPI.FieldOp.ldtoken,
                                                field_ref.PeapiField);
                        } else if (method_ref != null) {
                                method_ref.Resolve (code_gen);
                                cil.MethInst (PEAPI.MethodOp.ldtoken,
                                                method_ref.PeapiMethod);
                        } else if (type_ref != null) {
                                type_ref.Resolve (code_gen);
                                cil.TypeInst (PEAPI.TypeOp.ldtoken,
                                                type_ref.PeapiType);
                        }
                }
Ejemplo n.º 9
0
                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
                        int count = 0;
                        PEAPI.CILLabel[] label_array;

                        if (label_list != null) {
                                label_array = new PEAPI.CILLabel[label_list.Count];
                                foreach (object lab in label_list) {
                                        if (lab is LabelInfo) {
                                                label_array[count++] = ((LabelInfo)lab).Label;
                                        } else {                                                
                                                throw new InternalErrorException ("offsets in switch statements.");
                                        }
                                }
                        } else {
                                label_array = new PEAPI.CILLabel [0];
                        }

                        cil.Switch (label_array);
                }
Ejemplo n.º 10
0
                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
                        PEAPI.Type[] param_array;
                        PEAPI.CalliSig callisig;

                        if (param != null) {
                                param_array = new PEAPI.Type[param.Length];
                                int count = 0;
                                foreach (BaseTypeRef typeref in param) {
                                        typeref.Resolve (code_gen);
                                        param_array[count++] = typeref.PeapiType;
                                }
                        } else {
                                param_array = new PEAPI.Type[0];
                        }

                        ret_type.Resolve (code_gen);
                        callisig = new PEAPI.CalliSig (call_conv,
                                        ret_type.PeapiType, param_array);

                        cil.calli (callisig);
                }
Ejemplo n.º 11
0
 public override void Emit(CodeGen code_gen, MethodDef meth,
                           PEAPI.CILInstructions cil)
 {
     operand.Resolve(code_gen);
     cil.FieldInst(op, operand.PeapiField);
 }
Ejemplo n.º 12
0
                public override void Emit (CodeGen code_gen, MethodDef meth, 
					   PEAPI.CILInstructions cil)
                {
                        cil.Inst (op);
                }
Ejemplo n.º 13
0
                public void AddMethodDef (MethodDef methoddef)
                {
                        if (IsInterface && !methoddef.IsStatic && (!methoddef.IsVirtual || !methoddef.IsAbstract)) {
                                Report.Warning (methoddef.StartLocation, "Non-virtual or non-abstract instance method in interface, set to such");
                                methoddef.Attributes |= PEAPI.MethAttr.Abstract | PEAPI.MethAttr.Virtual;
                        }

                        if (method_table [methoddef.Signature] != null)
                                Report.Error (methoddef.StartLocation, "Duplicate method declaration: " + methoddef.Signature);

                        method_table.Add (methoddef.Signature, methoddef);
                        method_list.Add (methoddef);
                }
Ejemplo n.º 14
0
 public void AddOverride (MethodDef body, BaseTypeRef parent, string name)
 {
         if (override_list == null)
                 override_list = new ArrayList ();
         override_list.Add (new DictionaryEntry (body,
                            new DictionaryEntry (parent, name)));
 }
Ejemplo n.º 15
0
                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
			cil.Branch (op, label.Label);
                }
Ejemplo n.º 16
0
                public PEAPI.CILLabel GetFromLabel (CodeGen code_gen, MethodDef method)
                {
			return from_label.Label;
                }
Ejemplo n.º 17
0
                /// <summary>
                ///  Add this instruction to the supplied codebuffer
                /// </summary>
                public abstract void Emit (CodeGen code_gen, MethodDef meth, 
					   PEAPI.CILInstructions cil);
Ejemplo n.º 18
0
                public PEAPI.CILLabel GetToLabel (CodeGen code_gen, MethodDef method)
                {
			return to_label.Label;
                }
Ejemplo n.º 19
0
                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
                        operand.Resolve (code_gen);
                        cil.MethInst (op, operand.PeapiMethod);
                }
Ejemplo n.º 20
0
                public override void Emit (CodeGen code_gen, MethodDef meth,
					   PEAPI.CILInstructions cil)
                {
                        cil.emitbyte ((byte)value);
                }