static public void UseLocalValueImmediate(this ILCanvas item, Type type, Process <ILLocal> process) { item.UseLocal(type, delegate(ILLocal local) { local.RenderIL_StoreImmediate(item); process(local); }); }
public override void RenderIL_LoadAddress(ILCanvas canvas, ILValue target, ILValue index) { target.RenderIL_Load(canvas); index.RenderIL_Load(canvas); canvas.Emit_Ldelema(GetElementType()); }
static public void UseLocalValue(this ILCanvas item, ILValue value, Process <ILLocal> process) { item.UseLocal(value.GetValueType(), delegate(ILLocal local) { local.RenderIL_Store(item, value); process(local); }); }
public override void RenderIL_Load(ILCanvas canvas) { if (method.IsEffectivelyInstanceMethod() && caller != null) { caller.GetILImplicitCast(method.GetILMethodInvokationType()) .RenderIL_Load(canvas); arguments.GetILImplicitCasts(method.GetEffectiveParameterTypes()) .RenderIL_Load(canvas); if (method.IsTechnicallyInstanceMethod() && method.DeclaringType.IsReferenceType()) { canvas.Emit_Callvirt(method); } else { canvas.Emit_Call(method); } } else { arguments.GetILImplicitCasts(method.GetTechnicalParameterTypes()) .RenderIL_Load(canvas); canvas.Emit_Call(method); } }
public override void RenderIL_Load(ILCanvas canvas) { if (constructor != null) { constructor.GetEffectiveParameterTypes().ProcessTandemStrict(arguments, (t, a) => a.GetILImplicitCast(t).RenderIL_Load(canvas) ); canvas.Emit_Newobj(constructor); } else { if (type.IsStruct()) { canvas.UseLocal(type, delegate(ILLocal local) { local.RenderIL_LoadAddress(canvas); canvas.Emit_Initobj(type); local.RenderIL_Load(canvas); }); } else { canvas.Emit_Newobj(type.GetDefaultConstructor()); } } }
public override void RenderIL_Execute(ILCanvas canvas) { ILCanvasLabel exit_label = canvas.CreateLabel(); condition.GetILImplicitCast(typeof(bool)) .RenderIL_Load(canvas); if (HasElse()) { ILCanvasLabel false_label = canvas.CreateLabel(); false_label.Emit_Brfalse(); if_true_statement.RenderIL_Execute(canvas); exit_label.Emit_Br(); false_label.Emit_Label(); if_false_statement.RenderIL_Execute(canvas); } else { exit_label.Emit_Brfalse(); if_true_statement.RenderIL_Execute(canvas); } exit_label.Emit_Label(); }
public override void RenderIL_Store(ILCanvas canvas, ILValue value) { value.GetILImplicitCast(GetValueType()) .RenderIL_Load(canvas); canvas.Emit_Starg(GetArgIndex(canvas)); }
public override void RenderIL_Load(ILCanvas canvas, ILValue target, ILValue index) { target.RenderIL_Load(canvas); index.RenderIL_Load(canvas); canvas.Emit_Ldelem_I4(); }
public override void EmitCast(ILCanvas canvas, ILValue value) { value.RenderIL_Load(canvas); canvas.Emit_Unbox_Any(GetDestinationType().GetElementType()); canvas.MakeAddressImmediate(GetDestinationType().GetElementType()); }
public override void RenderIL_Execute(ILCanvas canvas) { GetLocals().Process(l => l.Allocate(canvas)); statements.Process(s => s.RenderIL_Execute(canvas)); GetLocals().Process(l => l.Release(canvas)); }
static public void UseLocal(this ILCanvas item, Type type, Process <ILLocal> process) { ILLocal local = new ILLocal(type, null, null, false); local.Allocate(item); process(local); local.Release(item); }
public override void RenderIL_Load(ILCanvas canvas) { new ILIf( condition, new ILLoad(true_value), new ILLoad(false_value) ).RenderIL_Execute(canvas); }
public override void RenderIL_Execute(ILCanvas canvas) { canvas.UseValue(array, delegate(ILValue local) { values.ProcessWithIndex( (i, v) => local.GetILIndexed(i).RenderIL_Store(canvas, v) ); }); }
public void RenderIL_StoreImmediate(ILCanvas canvas) { if (is_cemented) { throw new InvalidOperationException("Cannot store to cemented locals."); } RenderIL_StoreImmediateInternal(canvas); }
private ILCanvasLabel FetchLabel(ILCanvas canvas) { if (label == null) { label = canvas.CreateLabel(); } return(label); }
public override void RenderIL_Load(ILCanvas canvas) { caller.RenderIL_Load(canvas); arguments.GetILImplicitCasts(constructor.GetEffectiveParameterTypes()) .RenderIL_Load(canvas); canvas.Emit_Call(constructor); }
public override void RenderIL_Load(ILCanvas canvas) { value.RenderIL_Load(canvas); canvas.Emit_Isinst(check_type); canvas.Emit_Ldnull(); canvas.Emit_Cneq(); }
private int GetArgIndex(ILCanvas canvas) { if (canvas.GetMethod().IsTechnicallyInstanceMethod()) { return(parameter.Position + 1); } return(parameter.Position); }
public override void RenderIL_Execute(ILCanvas canvas) { value.RenderIL_Load(canvas); if (value.GetValueType().IsVoidType() == false) { canvas.Emit_Pop(); } }
private void RenderIL_ExecuteInternal(ILCanvas canvas, ILValue value, ILStatement else_statement) { int index = cases.Count / 2; canvas.UseValue(value, delegate(ILValue local) { cases[index].GenerateStatement(local, cases, else_statement, 0, cases.Count, index) .RenderIL_Execute(canvas); }); }
public override void RenderIL_Load(ILCanvas canvas) { canvas.UseValue( new ILNewArray(element_type, values.Count), delegate(ILValue local) { new ILAssignArray(local, values).RenderIL_Execute(canvas); local.RenderIL_Load(canvas); } ); }
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_I4(); }
public override void RenderIL_Execute(ILCanvas canvas) { if (value != null) { value.GetILImplicitCast(canvas.GetMethod().GetReturnType()) .RenderIL_Load(canvas); } canvas.Emit_Ret(); }
public override void RenderIL_Execute(ILCanvas canvas) { ILCanvasLabel after_label = canvas.CreateLabel(); after_label.Emit_Br(); entry_label.RenderIL_Execute(canvas); statement.RenderIL_Execute(canvas); after_label.Emit_Label(); }
static public void UseValue(this ILCanvas item, ILValue value, Process <ILValue> process) { if (value.IsILCostTrivial()) { process(value); } else { item.UseLocalValue(value, l => process(l)); } }
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); } }
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); } }
public override void RenderIL_Load(ILCanvas canvas) { if (field.IsInstanceField()) { RenderIL_LoadTarget(canvas); canvas.Emit_Ldfld(field); } else { canvas.Emit_Ldsfld(field); } }
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); } }
public void RenderIL_LoadAddress(ILCanvas canvas) { if (field.IsInstanceField()) { RenderIL_LoadTarget(canvas); canvas.Emit_Ldflda(field); } else { canvas.Emit_Ldsflda(field); } }