initial checkin of opcode UNMF

pull/81/head
Dibyendu Majumdar 9 years ago
parent ef17b28545
commit e3f457b645

@ -227,7 +227,7 @@ OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */
OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */
OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */
OP_UNMF, /* A B R(A) := -R(B) floating point */
OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
} OpCode;

@ -62,6 +62,7 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
"SETLIST",
"CLOSURE",
"VARARG",
"UNMF", /* new opcode - floating point unary minus*/
"EXTRAARG",
NULL
};
@ -117,6 +118,7 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */
,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */
,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */
,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */
,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNMF */
,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */
};

@ -901,6 +901,12 @@ newframe: /* reentry point when frame changes (call/return) */
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); }
} break;
case OP_UNMF: {
/* R(A) = -R(B), R(B) must be a float */
TValue *rb = RB(i);
lua_assert(ttisfloat(rb));
setfltvalue(ra, -fltvalue(rb));
} break;
case OP_UNM: {
TValue *rb = RB(i);
lua_Number nb;

Loading…
Cancel
Save