Exemplo n.º 1
0
        public override void RenderIL_Store(ILCanvas canvas, ILValue target, ILValue index, ILValue value)
        {
            target.RenderIL_Load(canvas);
            index.RenderIL_Load(canvas);

            value.GetILImplicitCast(GetElementType())
            .RenderIL_Load(canvas);

            canvas.Emit_Stelem_Ref();
        }
Exemplo n.º 2
0
 public override void EmitStore(ILCanvas canvas, ILValue target, ILValue to_store)
 {
     if (method_pair.CanSet())
     {
         method_pair.EmitStore(canvas, target, to_store);
     }
     else if (backing_field != null)
     {
         backing_field.EmitStore(canvas, target, to_store);
     }
 }
Exemplo n.º 3
0
 static public void UseValue(this ILCanvas item, ILValue value, Process <ILValue> process)
 {
     if (value.IsILCostTrivial())
     {
         process(value);
     }
     else
     {
         item.UseLocalValue(value, l => process(l));
     }
 }
Exemplo n.º 4
0
 public override void EmitLoad(ILCanvas canvas, ILValue target)
 {
     if (method_pair.CanGet())
     {
         method_pair.EmitLoad(canvas, target);
     }
     else if (backing_field != null)
     {
         backing_field.EmitLoad(canvas, target);
     }
 }
Exemplo n.º 5
0
        static public void RenderIL_LoadAddress(this ILValue item, ILCanvas canvas)
        {
            ILAddressable cast;

            if (item.Convert <ILAddressable>(out cast))
            {
                cast.RenderIL_LoadAddress(canvas);
            }
            else
            {
                item.RenderIL_LoadAddressInternal(canvas);
            }
        }
Exemplo n.º 6
0
        public ILLocal CreateCementedLocal(ILValue value)
        {
            ILLocal local;

            if (value.Convert <ILLocal>(out local))
            {
                if (local.IsCemented())
                {
                    return(local);
                }
            }

            return(cemented_locals.AddAndGet(new ILLocal(value.GetValueType(), null, value, true))
                   .Chain(l => AddStatement(new ILInitializeLocal(l))));
        }
Exemplo n.º 7
0
        public override void RenderIL_Store(ILCanvas canvas, ILValue value)
        {
            if (field.IsInstanceField())
            {
                RenderIL_LoadTarget(canvas);

                value.GetILImplicitCast(field.FieldType)
                .RenderIL_Load(canvas);

                canvas.Emit_Stfld(field);
            }
            else
            {
                value.GetILImplicitCast(field.FieldType)
                .RenderIL_Load(canvas);

                canvas.Emit_Stsfld(field);
            }
        }
Exemplo n.º 8
0
        public ILStatement GenerateStatement(ILValue value, IList <ILCase> cases, ILStatement else_statement, int min_index, int max_index, int index)
        {
            int less_index    = (index + min_index) / 2;
            int greater_index = (index + max_index) / 2;

            if (index == min_index || index == max_index)
            {
                return(new ILIf(
                           value.GetILEqualTo(label),
                           statement,
                           else_statement
                           ));
            }

            return(new ILIf(
                       value.GetILLessThan(label),
                       cases[less_index].GenerateStatement(value, cases, else_statement, min_index, index, less_index),
                       cases[greater_index].GenerateStatement(value, cases, else_statement, index, max_index, greater_index)
                       ));
        }
Exemplo n.º 9
0
 public override void EmitCastAddress(ILCanvas canvas, ILValue value)
 {
     value.RenderIL_LoadAddress(canvas);
 }
Exemplo n.º 10
0
 public override void RenderIL_Operate(ILCanvas canvas, ILValue input)
 {
     LoadValue(canvas, input); canvas.Emit_Neg();
 }
Exemplo n.º 11
0
 static public ILConstructorInvokation GetBaseILConstructor(this ILValue item, params ILValue[] arguments)
 {
     return(item.GetBaseILConstructor((IEnumerable <ILValue>)arguments));
 }
Exemplo n.º 12
0
 static public ILConstructorInvokation GetILConstructorInvokation(this ILValue item, ConstructorInfo constructor, params ILValue[] arguments)
 {
     return(item.GetILConstructorInvokation(constructor, (IEnumerable <ILValue>)arguments));
 }
Exemplo n.º 13
0
 public ILReturn(ILValue v)
 {
     value = v;
 }
Exemplo n.º 14
0
 public ILWhile(ILValue c, ILStatement w)
 {
     condition       = c;
     while_statement = w;
 }
Exemplo n.º 15
0
 public override void EmitStore(ILCanvas canvas, ILValue target, ILValue to_store)
 {
     new ILField(target, field_info).RenderIL_Store(canvas, to_store);
 }
Exemplo n.º 16
0
 public override void RenderIL_Operate(ILCanvas canvas, ILValue left, ILValue right)
 {
     typeof(string).GetStaticILMethodInvokation("Concat", left, right).RenderIL_Load(canvas);
 }
Exemplo n.º 17
0
 static public void RenderIL_LoadAddressInternal(this ILValue item, ILCanvas canvas)
 {
     item.RenderIL_Load(canvas);
     canvas.MakeAddressImmediate(item.GetValueType());
 }
Exemplo n.º 18
0
 static public ILField GetILField(this ILValue item, string name)
 {
     return(item.GetILField(item.GetValueType().GetInstanceField(name)));
 }
Exemplo n.º 19
0
 static public ILField GetILField(this ILValue item, FieldInfo field)
 {
     return(field.IfNotNull(f => new ILField(item, f)));
 }
Exemplo n.º 20
0
 static public ILStatement CreateILCalculate(this ILValue item)
 {
     return(item.IfNotNull(i => new ILCalculate(i)));
 }
Exemplo n.º 21
0
 public override void RenderIL_Operate(ILCanvas canvas, ILValue left, ILValue right)
 {
     LoadValues(canvas, left, right); canvas.Emit_Cgtoe();
 }
Exemplo n.º 22
0
 public ILAssignArray(ILValue a, IEnumerable <ILValue> v)
 {
     array  = a;
     values = v.ToList();
 }
Exemplo n.º 23
0
 public override void RenderIL_Operate(ILCanvas canvas, ILValue left, ILValue right)
 {
     typeof(ObjectExtensions_Compare).GetStaticILMethodInvokation("NotEqualsEX", left, right).RenderIL_Load(canvas);
 }
Exemplo n.º 24
0
 public ILAssign(ILValue d, ILValue s)
 {
     destination = d;
     source      = s;
 }
Exemplo n.º 25
0
 public override void EmitLoadAddress(ILCanvas canvas, ILValue target)
 {
     new ILField(target, field_info).RenderIL_LoadAddress(canvas);
 }
Exemplo n.º 26
0
 static public BasicType GetValueBasicType(this ILValue item)
 {
     return(item.GetValueType().GetBasicType());
 }
Exemplo n.º 27
0
        public override void EmitCast(ILCanvas canvas, ILValue value)
        {
            value.RenderIL_Load(canvas);

            canvas.Emit_Conv_R8();
        }
Exemplo n.º 28
0
 static public ILValue GetILIsNotNull(this ILValue item)
 {
     return(item.GetILNotEqualTo(ILNull.INSTANCE));
 }
Exemplo n.º 29
0
        public override void EmitCast(ILCanvas canvas, ILValue value)
        {
            value.RenderIL_Load(canvas);

            canvas.Emit_Unbox_Any(GetDestinationType());
        }
Exemplo n.º 30
0
 static public ILConstructorInvokation GetILConstructorInvokation(this ILValue item, ConstructorInfo constructor, IEnumerable <ILValue> arguments)
 {
     return(constructor.IfNotNull(c => new ILConstructorInvokation(item, constructor, arguments)));
 }