本文整理汇总了C#中expdesc类的典型用法代码示例。如果您正苦于以下问题:C# expdesc类的具体用法?C# expdesc怎么用?C# expdesc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
expdesc类属于命名空间,在下文中一共展示了expdesc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Copy
public void Copy(expdesc e)
{
this.k = e.k;
this.u.Copy(e.u);
this.t = e.t;
this.f = e.f;
}
示例2: GetCode
public static InstructionPtr GetCode(FuncState fs, expdesc e) {return new InstructionPtr(fs.f.code, e.u.s.info);}
示例3: LuaKInfix
public static void LuaKInfix (FuncState fs, BinOpr op, expdesc v) {
switch (op) {
case BinOpr.OPR_AND: {
LuaKGoIfTrue(fs, v);
break;
}
case BinOpr.OPR_OR: {
LuaKGoIFalse(fs, v);
break;
}
case BinOpr.OPR_CONCAT: {
LuaKExp2NextReg(fs, v); /* operand must be on the `stack' */
break;
}
case BinOpr.OPR_ADD: case BinOpr.OPR_SUB: case BinOpr.OPR_MUL: case BinOpr.OPR_DIV:
case BinOpr.OPR_MOD: case BinOpr.OPR_POW: {
if ((IsNumeral(v)==0)) LuaKExp2RK(fs, v);
break;
}
default: {
LuaKExp2RK(fs, v);
break;
}
}
}
示例4: CodeComp
private static void CodeComp (FuncState fs, OpCode op, int cond, expdesc e1,
expdesc e2) {
int o1 = LuaKExp2RK(fs, e1);
int o2 = LuaKExp2RK(fs, e2);
FreeExp(fs, e2);
FreeExp(fs, e1);
if (cond == 0 && op != OpCode.OP_EQ) {
int temp; /* exchange args to replace by `<' or `<=' */
temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */
cond = 1;
}
e1.u.s.info = CondJump(fs, op, cond, o1, o2);
e1.k = expkind.VJMP;
}
示例5: ConstFolding
private static int ConstFolding (OpCode op, expdesc e1, expdesc e2) {
LuaNumberType v1, v2, r;
if ((IsNumeral(e1)==0) || (IsNumeral(e2)==0)) return 0;
v1 = e1.u.nval;
v2 = e2.u.nval;
switch (op) {
case OpCode.OP_ADD: r = luai_numadd(v1, v2); break;
case OpCode.OP_SUB: r = luai_numsub(v1, v2); break;
case OpCode.OP_MUL: r = luai_nummul(v1, v2); break;
case OpCode.OP_DIV:
if (v2 == 0) return 0; /* do not attempt to divide by 0 */
r = luai_numdiv(v1, v2); break;
case OpCode.OP_MOD:
if (v2 == 0) return 0; /* do not attempt to divide by 0 */
r = luai_nummod(v1, v2); break;
case OpCode.OP_POW: r = luai_numpow(v1, v2); break;
case OpCode.OP_UNM: r = luai_numunm(v1); break;
case OpCode.OP_LEN: return 0; /* no constant folding for 'len' */
default: LuaAssert(0); r = 0; break;
}
if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */
e1.u.nval = r;
return 1;
}
示例6: CodeNot
private static void CodeNot (FuncState fs, expdesc e) {
LuaKDischargeVars(fs, e);
switch (e.k) {
case expkind.VNIL: case expkind.VFALSE: {
e.k = expkind.VTRUE;
break;
}
case expkind.VK: case expkind.VKNUM: case expkind.VTRUE: {
e.k = expkind.VFALSE;
break;
}
case expkind.VJMP: {
InvertJump(fs, e);
break;
}
case expkind.VRELOCABLE:
case expkind.VNONRELOC: {
Discharge2AnyReg(fs, e);
FreeExp(fs, e);
e.u.s.info = LuaKCodeABC(fs, OpCode.OP_NOT, 0, e.u.s.info, 0);
e.k = expkind.VRELOCABLE;
break;
}
default: {
LuaAssert(0); /* cannot happen */
break;
}
}
/* interchange true and false lists */
{ int temp = e.f; e.f = e.t; e.t = temp; }
RemoveValues(fs, e.f);
RemoveValues(fs, e.t);
}
示例7: LuaKGoIfTrue
public static void LuaKGoIfTrue (FuncState fs, expdesc e) {
int pc; /* pc of last jump */
LuaKDischargeVars(fs, e);
switch (e.k) {
case expkind.VK: case expkind.VKNUM: case expkind.VTRUE: {
pc = NO_JUMP; /* always true; do nothing */
break;
}
case expkind.VJMP: {
InvertJump(fs, e);
pc = e.u.s.info;
break;
}
default: {
pc = JumpOnCond(fs, e, 0);
break;
}
}
LuaKConcat(fs, ref e.f, pc); /* insert last jump in `f' list */
LuaKPatchToHere(fs, e.t);
e.t = NO_JUMP;
}
示例8: InvertJump
private static void InvertJump (FuncState fs, expdesc e) {
InstructionPtr pc = GetJumpControl(fs, e.u.s.info);
LuaAssert(testTMode(GET_OPCODE(pc[0])) != 0 && GET_OPCODE(pc[0]) != OpCode.OP_TESTSET &&
GET_OPCODE(pc[0]) != OpCode.OP_TEST);
SETARG_A(pc, (GETARG_A(pc[0]) == 0) ? 1 : 0);
}
示例9: LuaKDischargeVars
public static void LuaKDischargeVars (FuncState fs, expdesc e) {
switch (e.k) {
case expkind.VLOCAL: {
e.k = expkind.VNONRELOC;
break;
}
case expkind.VUPVAL: {
e.u.s.info = LuaKCodeABC(fs, OpCode.OP_GETUPVAL, 0, e.u.s.info, 0);
e.k = expkind.VRELOCABLE;
break;
}
case expkind.VGLOBAL: {
e.u.s.info = LuaKCodeABx(fs, OpCode.OP_GETGLOBAL, 0, e.u.s.info);
e.k = expkind.VRELOCABLE;
break;
}
case expkind.VINDEXED: {
FreeReg(fs, e.u.s.aux);
FreeReg(fs, e.u.s.info);
e.u.s.info = LuaKCodeABC(fs, OpCode.OP_GETTABLE, 0, e.u.s.info, e.u.s.aux);
e.k = expkind.VRELOCABLE;
break;
}
case expkind.VVARARG:
case expkind.VCALL: {
LuaKSetOneRet(fs, e);
break;
}
default: break; /* there is one value available (somewhere) */
}
}
示例10: LuaKSetOneRet
public static void LuaKSetOneRet (FuncState fs, expdesc e) {
if (e.k == expkind.VCALL) { /* expression is an open function call? */
e.k = expkind.VNONRELOC;
e.u.s.info = GETARG_A(GetCode(fs, e));
}
else if (e.k == expkind.VVARARG) {
SETARG_B(GetCode(fs, e), 2);
e.k = expkind.VRELOCABLE; /* can relocate its simple result */
}
}
示例11: LuaKSetReturns
public static void LuaKSetReturns (FuncState fs, expdesc e, int nresults) {
if (e.k == expkind.VCALL) { /* expression is an open function call? */
SETARG_C(GetCode(fs, e), nresults+1);
}
else if (e.k == expkind.VVARARG) {
SETARG_B(GetCode(fs, e), nresults+1);
SETARG_A(GetCode(fs, e), fs.freereg);
LuaKReserveRegs(fs, 1);
}
}
示例12: FreeExp
private static void FreeExp (FuncState fs, expdesc e) {
if (e.k == expkind.VNONRELOC)
FreeReg(fs, e.u.s.info);
}
示例13: IsNumeral
private static int IsNumeral(expdesc e) {
return (e.k == expkind.VKNUM && e.t == NO_JUMP && e.f == NO_JUMP) ? 1 : 0;
}
示例14: HasJumps
public static bool HasJumps(expdesc e) {return e.t != e.f;}
示例15: LuaKSetMultRet
public static void LuaKSetMultRet(FuncState fs, expdesc e) {LuaKSetReturns(fs, e, LUA_MULTRET);}