本文整理汇总了C#中CodeGenContext.ldfld方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenContext.ldfld方法的具体用法?C# CodeGenContext.ldfld怎么用?C# CodeGenContext.ldfld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGenContext
的用法示例。
在下文中一共展示了CodeGenContext.ldfld方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenSimple
public virtual void GenSimple(CodeGenContext context)
{
// thisblock.localsN.vid
context.ldarg(0);
context.ldfld(block.frameFields[depth - 1]);
context.ldfld(field);
}
示例2: Assign
internal override void Assign(CodeGenContext context, Node rhs)
{
// object value = rhs;
bool created;
ISimple value = context.PreCompute(rhs, "rhs", out created);
// thisblock.localsN.SetDynamic("vid", value);
context.ldarg(0);
context.ldfld(block.frameFields[depth - 1]);
context.ldstr(Name);
value.GenSimple(context);
context.call(Runtime.Frame.SetDynamic);
value.GenSimple(context);
context.ReleaseLocal(value, created);
}
示例3: LoadBlock0
internal void LoadBlock0(CodeGenContext context)
{
if (context.HasArg(Runtime.ArgListRef))
{
context.ldarg("args"); // args.block
context.ldfld(Runtime.ArgList.block);
}
else if (context.HasArg(Runtime.ProcRef))
{
context.ldarg("block");
}
else
context.ldnull();
}
示例4: GenCode0
internal override void GenCode0(CodeGenContext context)
{
int RescueTemp = context.CreateLocal("rescueTemp", PERWAPI.PrimitiveType.Object);
int ExceptionTemp = context.CreateLocal("exceptionTemp", PERWAPI.PrimitiveType.Object);
PERWAPI.CILLabel endLabel = context.NewLabel();
context.StartBlock(Clause.Try);
{
expr.GenCode(context);
if (context.Reachable())
{
context.stloc(RescueTemp);
context.Goto(endLabel);
}
}
PERWAPI.TryBlock tryBlock = context.EndTryBlock();
context.StartBlock(Clause.Catch);
{
PERWAPI.CILLabel stdErrLabel = context.NewLabel();
context.stloc(ExceptionTemp);
context.ldloc(ExceptionTemp);
context.ldfld(Runtime.RubyException.parent);
context.isinst(Runtime.StandardErrorRef);
context.brtrue(stdErrLabel);
context.ldloc(ExceptionTemp);
context.throwOp();
context.CodeLabel(stdErrLabel);
rescue.GenCode(context);
if (context.Reachable())
{
context.stloc(RescueTemp);
context.Goto(endLabel);
}
}
context.EndCatchBlock(Runtime.RubyExceptionRef, tryBlock);
context.CodeLabel(endLabel);
context.ldloc(RescueTemp);
context.ReleaseLocal(RescueTemp, true);
context.ReleaseLocal(ExceptionTemp, true);
}
示例5: CatchBreakException
private void CatchBreakException(CodeGenContext context, int result, PERWAPI.CILLabel endLabel)
{
// catch (Exception exception)
int exception = context.StoreInTemp("exception", Runtime.BreakExceptionRef, location);
PERWAPI.CILLabel reThrowLabel = context.NewLabel();
// if (exception.scope != current_frame) goto reThrowLabel;
context.ldloc(0);
context.ldloc(exception);
context.ldfld(Runtime.BreakException.scope);
context.bne( reThrowLabel);
// result = exception.return_value;
context.ldloc(exception);
context.ldfld(Runtime.BreakException.return_value);
context.stloc(result);
// goto endLabel;
context.Goto(endLabel);
// reThrowLabel:
context.CodeLabel(reThrowLabel);
// throw exception;
context.ldloc(exception);
context.throwOp();
context.ReleaseLocal(exception, true);
}
示例6: GenCode0
internal override void GenCode0(CodeGenContext context)
{
context.newLine(location);
if (return_val != null)
return_val.GenCode(context);
else
context.ldnull();
if (this.parent_scope is BLOCK)
{
//throw new Ruby.ReturnException(return_value, this.defining_scope);
context.ldarg(0); // current Ruby.MethodBody
context.ldfld(Runtime.Block.defining_scope);
context.newobj(Runtime.ReturnException.ctor);
context.throwOp();
}
else if (this.parent_scope is BEGIN)
{
//throw new Ruby.ReturnException(return_value, caller);
context.ldarg("caller");
context.newobj(Runtime.ReturnException.ctor);
context.throwOp();
}
else
{
// return
context.stloc(parent_scope.returnTemp);
context.Goto(context.labels.Return);
}
}
示例7: GenRescue
internal void GenRescue(CodeGenContext context, PERWAPI.CILLabel endLabel, int RescueTemp, RESCUE_CLAUSE clauses)
{
// catch (System.Exception e) {
int e = context.StoreInTemp("e", Runtime.SystemExceptionRef, location);
//if (e is Ruby.ControlException)
PERWAPI.CILLabel else1 = context.NewLabel();
context.ldloc(e);
context.isinst(Runtime.ControlExceptionRef);
context.brfalse(else1);
// throw e;
context.rethrow();
context.CodeLabel(else1);
// Ruby.Exception exception;
int exception = context.CreateLocal("exception", Runtime.ExceptionRef);
//if (!(e is Ruby.RubyException))
PERWAPI.CILLabel else2 = context.NewLabel();
PERWAPI.CILLabel end = context.NewLabel();
context.ldloc(e);
context.isinst(Runtime.RubyExceptionRef);
context.brtrue(else2);
// exception = new Ruby.CLRException(frame, e);
context.ldloc(0);
context.ldloc(e);
context.newobj(Runtime.CLRException.ctor);
context.stloc(exception);
context.br(end);
//else
context.CodeLabel(else2);
// exception = (Ruby.RubyException)e.parent;
context.ldloc(e);
context.cast(Runtime.RubyExceptionRef);
context.ldfld(Runtime.RubyException.parent);
context.stloc(exception);
context.CodeLabel(end);
//Eval.ruby_errinfo.value = exception;
context.ldsfld(Runtime.Eval.ruby_errinfo);
context.ldloc(exception);
context.stfld(Runtime.global_variable.value);
if (clauses != null)
clauses.GenCode(context, endLabel, RescueTemp, exception);
context.rethrow();
context.ReleaseLocal(e, true);
context.ReleaseLocal(exception, true);
}
示例8: GenCode0
internal override void GenCode0(CodeGenContext context)
{
if (id is string)
context.ldstr((string)id);
else if (id is VALUE && ((VALUE)id).value is string)
context.ldstr((string)((VALUE)id).value);
else
{
((Node)id).GenCode(context);
context.ldfld(Runtime.String.value);
}
context.newobj(Runtime.Symbol.ctor);
}
示例9: GenCode0
internal override void GenCode0(CodeGenContext context)
{
MethodDef BlockN_constructor = GenerateClassForMethod(context);
// new Ruby.Proc(recv, block, new BlockN(locals, this.locals1, this.locals2 ...), arity);
context.ldarg("recv"); // recv
LoadBlock(context);
context.ldloc(0); // locals
if (block_parent is BLOCK)
foreach (FieldDef field in ((BLOCK)block_parent).frameFields)
{
// this.localsN
context.ldarg(0);
context.ldfld(field);
}
context.newobj(BlockN_constructor);
context.ldc_i4(arity);
context.newobj(Runtime.Proc.ctor);
}
示例10: LoadBlock
internal void LoadBlock(CodeGenContext context)
{
context.ldloc(0);
context.ldfld(Runtime.Frame.block_arg);
}
示例11: CatchReturnException
internal void CatchReturnException(CodeGenContext context, PERWAPI.TryBlock tryBlock)
{
// catch (Ruby.ReturnException exception) { ... }
context.StartBlock(Clause.Catch);
{
PERWAPI.CILLabel falseLabel = context.NewLabel();
int exception = context.StoreInTemp("exception", Runtime.ReturnExceptionRef, location);
// if (exception.scope == thisframe)
context.ldloc(exception);
context.ldfld(Runtime.ReturnException.scope);
context.ldloc(0);
context.bne(falseLabel);
// returnTemp = exception.return_value;
context.ldloc(exception);
context.ldfld(Runtime.ReturnException.return_value);
context.stloc(returnTemp);
context.Goto(context.labels.Return);
// falseLabel:
context.CodeLabel(falseLabel);
// throw exception
context.rethrow();
context.ReleaseLocal(exception, true);
}
context.EndCatchBlock(Runtime.ReturnExceptionRef, tryBlock);
}
示例12: CatchRetryException
private void CatchRetryException(CodeGenContext context, PERWAPI.CILLabel retryLabel)
{
// catch (Exception exception)
int exception = context.StoreInTemp("exception", Runtime.RetryExceptionRef, location);
PERWAPI.CILLabel reThrowLabel = context.NewLabel();
// if (exception.scope != current_frame) goto reThrowLabel;
context.ldloc(0);
context.ldloc(exception);
context.ldfld(Runtime.RetryException.scope);
context.bne( reThrowLabel);
// goto retryLabel
context.Goto(retryLabel);
// reThrowLabel:
context.CodeLabel(reThrowLabel);
// throw exception;
context.ldloc(exception);
context.throwOp();
context.ReleaseLocal(exception, true);
}