本文整理汇总了C#中CodeGenContext.callvirt方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenContext.callvirt方法的具体用法?C# CodeGenContext.callvirt怎么用?C# CodeGenContext.callvirt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGenContext
的用法示例。
在下文中一共展示了CodeGenContext.callvirt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenCode0
internal override void GenCode0(CodeGenContext context)
{
// String.Concat(String.Concat(arg1, arg2), args, ...);
head.GenCode0(context);
if (head.nd_next != null)
{
int first = context.StoreInTemp("head", Runtime.StringRef, head.location);
for (Node n = head.nd_next; n != null; n = n.nd_next)
{
n.GenCode0(context);
int second = context.StoreInTemp("tail", Runtime.StringRef, n.location);
context.ldloc(first);
context.ldloc(second);
context.callvirt(Runtime.String.Concat);
context.stloc(first);
context.ReleaseLocal(second, true);
}
context.ldloc(first);
context.ReleaseLocal(first, true);
}
}
示例2: GenCode0
internal override void GenCode0(CodeGenContext context)
{
bool created;
ISimple list = GenArgList(context, out created);
list.GenSimple(context);
context.callvirt(Runtime.ArgList.ToRubyObject);
context.ReleaseLocal(list, created);
}
示例3: GenCode0
internal override void GenCode0(CodeGenContext context)
{
if (args != null)
{
bool created;
ISimple list = args.GenArgList(context, out created);
list.GenSimple(context);
context.callvirt(Runtime.ArgList.ToRubyArray);
context.ReleaseLocal(list, created);
}
else
context.newobj(Runtime.Array.ctor);
}
示例4: GenCode0
internal override void GenCode0(CodeGenContext context)
{
// ruby_class.undef_method(mid);
context.newLine(location);
context.ruby_class(parent_scope);
context.ldstr(mid.ToString());
context.callvirt(Runtime.Class.undef_method);
context.ldnull();
}
示例5: Assign
internal override void Assign(CodeGenContext context, Node rhs)
{
// Gen right hand sides
ListGen mrhs;
if (rhs is ListGen && !(rhs is MultipleRHS))
mrhs = (ListGen)rhs;
else
mrhs = new ARGS(null, null, rhs, null, location, true);
bool created;
ISimple list = mrhs.GenArgList(context, out created);
list.GenSimple(context);
context.callvirt(Runtime.ArgList.CheckSingleRHS);
int array = context.StoreInTemp("mrhs", Runtime.ArgListRef, location);
context.ReleaseLocal(list, created);
// Gen assignments to left hand sides
for (LVALUE l = elements; l != null; l = (LVALUE)l.nd_next)
{
l.Assign(context, new MultipleRHS(array, l.location));
context.pop();
}
context.ldloc(array);
context.callvirt(Runtime.ArgList.ToRubyArray);
context.ReleaseLocal(array, true);
}
示例6: GetRestRHS
private void GetRestRHS(CodeGenContext context)
{
// rhs.GetRest();
bool created;
ISimple list = ((ListGen)rhs).GenArgList(context, out created);
list.GenSimple(context);
context.callvirt(Runtime.ArgList.GetRest);
context.ReleaseLocal(list, created);
}
示例7: GenCode0
internal override void GenCode0(CodeGenContext context)
{
// arglist.GetNext(array);
context.ldloc(arglist);
context.callvirt(Runtime.ArgList.GetNext);
}
示例8: ArgsPlusRHS
// append rhs to args array
private ISimple ArgsPlusRHS(CodeGenContext context, out bool created)
{
// ArgList temp = args;
ISimple temp = args.GenArgList(context, out created);
// object value = rhs;
bool value_created;
ISimple value = context.PreCompute(rhs, "rhs", out value_created);
// temp.Add(value);
temp.GenSimple(context);
value.GenSimple(context);
context.callvirt(Runtime.ArgList.Add);
context.ReleaseLocal(value, value_created);
return temp;
}
示例9: CopyRestFormals
private void CopyRestFormals(CodeGenContext context, Scope scope)
{
if (rest != null)
{
string name = ID.ToDotNetName(rest.vid);
// locals.name = args.GetRest();
context.ldloc(0);
context.ldarg("args");
context.callvirt(Runtime.ArgList.GetRest);
context.stfld(scope.GetFrameField(name));
}
}
示例10: CopyOptionalFormals
private void CopyOptionalFormals(CodeGenContext context, Scope scope)
{
for (ASSIGNMENT opt = (ASSIGNMENT)optional; opt != null; opt = (ASSIGNMENT)opt.nd_next)
{
PERWAPI.CILLabel runout_label = context.NewLabel();
PERWAPI.CILLabel end_label = context.NewLabel();
string name = ID.ToDotNetName(((VAR)(opt.lhs)).vid);
Node defaultValue = opt.rhs;
// if (args.RunOut()) goto RunOut
context.ldarg("args");
context.callvirt(Runtime.ArgList.RunOut);
context.brtrue(runout_label);
// locals.name = args.GetNext();
context.ldloc(0);
context.ldarg("args");
context.callvirt(Runtime.ArgList.GetNext);
context.br(end_label);
// RunOut:
context.CodeLabel(runout_label);
// object def = defaultValue;
bool created;
ISimple def = context.PreCompute(defaultValue, "default", out created);
// locals.name = defaultValue
context.ldloc(0);
def.GenSimple(context);
context.ReleaseLocal(def, created);
context.CodeLabel(end_label);
// locals.name = ...
context.stfld(scope.GetFrameField(name));
}
}
示例11: CopyNormalFormals
private void CopyNormalFormals(CodeGenContext context, Scope scope)
{
PERWAPI.CILLabel OKLabel = context.NewLabel();
if (min_args > 0)
{
// if (args.Length < min_args)
context.ldarg("args");
context.callvirt(Runtime.ArgList.get_Length);
int length = context.StoreInTemp("length", PrimitiveType.Int32, location);
context.ldloc(length);
context.ldc_i4(min_args);
context.bge(OKLabel);
//context.Inst(Op.clt);
//context.brfalse(OKLabel);
// context.Branch(BranchOp.bge, OKLabel);
// throw new ArgumentError(string.Format("wrong number of arguments ({0} for {1})", args.Length, arity).raise(caller);
// FIXME: next line needs a String
context.ldstr("wrong number of arguments ({0} for {1})");
context.ldloc(length);
context.box(PrimitiveType.Int32);
context.ldc_i4(min_args);
context.box(PrimitiveType.Int32);
context.call(Runtime.SystemString.Format);
context.newobj(Runtime.ArgumentError.ctor);
context.ldloc(0);
context.callvirt(Runtime.Exception.raise);
context.throwOp();
context.ReleaseLocal(length, true);
// OKLabel:
context.CodeLabel(OKLabel);
}
// Copy parameters to locals
for (Node f = normal; f != null; f = f.nd_next)
{
string name = ID.ToDotNetName(((VAR)f).vid);
// local.f = args.GetNext();
context.ldloc(0);
context.ldarg("args");
context.callvirt(Runtime.ArgList.GetNext);
context.stfld(scope.GetFrameField(name));
}
}
示例12: GenCall0
internal override void GenCall0(CodeGenContext context)
{
// block.yield(caller, arguments)
LoadBlock(context);
context.ldloc(0); // caller
arguments.GenSimple(context);
context.callvirt(Runtime.Proc.yield);
}
示例13: GenCode0
internal override void GenCode0(CodeGenContext context)
{
context.ldloc(0);
context.call(Runtime.Frame.get_Tilde);
PERWAPI.CILLabel label1 = context.NewLabel();
context.brfalse(label1);
context.ldloc(0);
context.call(Runtime.Frame.get_Tilde);
context.ldloc(0);
switch (ch)
{
case '&':
context.callvirt(Runtime.Match.last_match);
break;
case '`':
context.callvirt(Runtime.Match.match_pre);
break;
case '\'':
context.callvirt(Runtime.Match.match_post);
break;
case '+':
context.callvirt(Runtime.Match.match_last);
break;
default:
throw new NotImplementedException("BACK_REF $" + ch);
}
PERWAPI.CILLabel label2 = context.NewLabel();
context.br(label2);
context.CodeLabel(label1);
context.ldnull();
context.CodeLabel(label2);
}
示例14: Defined
internal override void Defined(CodeGenContext context)
{
CILLabel endLabel = context.NewLabel();
context.ldloc(0);
context.call(Runtime.Frame.get_Tilde);
context.dup();
context.brfalse(endLabel);
context.ldc_i4(nth);
context.callvirt(Runtime.Match.defined_nth);
context.CodeLabel(endLabel);
}
示例15: GenArgList
internal override ISimple GenArgList(CodeGenContext context, out bool created)
{
bool single = true;
// ArgList arglist = new ArgList();
context.newobj(Runtime.ArgList.ctor);
int arglist = context.StoreInTemp("arglist", Runtime.ArgListRef, location);
int added = 0;
for (Node arg = parameters; arg != null; arg = arg.nd_next)
{
//object argument = arg;
bool argument_created;
ISimple argument = context.PreCompute0(arg, "arg", out argument_created);
// arglist.Add(argument);
context.ldloc(arglist);
argument.GenSimple(context);
context.callvirt(Runtime.ArgList.Add);
added++;
context.ReleaseLocal(argument, argument_created);
}
if (added != 1)
single = false;
if (hashlist != null)
{
// object hash = hashlist;
bool hash_created;
ISimple hash = context.PreCompute(new HASH(hashlist, hashlist.location), "hashlist", out hash_created);
// arglist.Add(hash);
context.ldloc(arglist);
hash.GenSimple(context);
context.callvirt(Runtime.ArgList.Add);
single = false;
context.ReleaseLocal(hash, hash_created);
}
if (array != null)
{
// object list = array;
bool list_created;
ISimple list = context.PreCompute(array, "array", out list_created);
// arglist.AddArray(list, caller);
context.ldloc(arglist);
list.GenSimple(context);
context.ldloc(0);
context.callvirt(Runtime.ArgList.AddArray);
single = false;
context.ReleaseLocal(list, list_created);
}
if (block != null)
{
// object b = block;
bool b_created;
ISimple b = context.PreCompute(block, "block", Runtime.ProcRef, out b_created);
// arglist.block = b;
context.ldloc(arglist);
b.GenSimple(context);
context.stfld(Runtime.ArgList.block);
context.ReleaseLocal(b, b_created);
}
if (single)
{
context.ldloc(arglist);
context.PushTrue();
context.stfld(Runtime.ArgList.single_arg);
}
created = true;
return new LOCAL(arglist, location);
}