mirror of https://github.com/rusefi/lua.git
OP_LOADFALSE broken in two instructions
This commit is contained in:
parent
28ef7061bb
commit
9b7987a9d1
8
lcode.c
8
lcode.c
|
@ -872,9 +872,9 @@ static void discharge2anyreg (FuncState *fs, expdesc *e) {
|
|||
}
|
||||
|
||||
|
||||
static int code_loadbool (FuncState *fs, int A, OpCode op, int jump) {
|
||||
static int code_loadbool (FuncState *fs, int A, OpCode op) {
|
||||
luaK_getlabel(fs); /* those instructions may be jump targets */
|
||||
return luaK_codeABC(fs, op, A, jump, 0);
|
||||
return luaK_codeABC(fs, op, A, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -908,8 +908,8 @@ static void exp2reg (FuncState *fs, expdesc *e, int reg) {
|
|||
int p_t = NO_JUMP; /* position of an eventual LOAD true */
|
||||
if (need_value(fs, e->t) || need_value(fs, e->f)) {
|
||||
int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs);
|
||||
p_f = code_loadbool(fs, reg, OP_LOADFALSE, 1); /* skip next inst. */
|
||||
p_t = code_loadbool(fs, reg, OP_LOADTRUE, 0);
|
||||
p_f = code_loadbool(fs, reg, OP_LFALSESKIP); /* skip next inst. */
|
||||
p_t = code_loadbool(fs, reg, OP_LOADTRUE);
|
||||
/* jump around these booleans if 'e' is not a test */
|
||||
luaK_patchtohere(fs, fj);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ static void *disptab[NUM_OPCODES] = {
|
|||
&&L_OP_LOADK,
|
||||
&&L_OP_LOADKX,
|
||||
&&L_OP_LOADFALSE,
|
||||
&&L_OP_LFALSESKIP,
|
||||
&&L_OP_LOADTRUE,
|
||||
&&L_OP_LOADNIL,
|
||||
&&L_OP_GETUPVAL,
|
||||
|
|
|
@ -25,6 +25,7 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
|
|||
,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADK */
|
||||
,opmode(0, 0, 0, 0, 1, iABx) /* OP_LOADKX */
|
||||
,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADFALSE */
|
||||
,opmode(0, 0, 0, 0, 1, iABC) /* OP_LFALSESKIP */
|
||||
,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADTRUE */
|
||||
,opmode(0, 0, 0, 0, 1, iABC) /* OP_LOADNIL */
|
||||
,opmode(0, 0, 0, 0, 1, iABC) /* OP_GETUPVAL */
|
||||
|
|
|
@ -202,7 +202,8 @@ OP_LOADI,/* A sBx R[A] := sBx */
|
|||
OP_LOADF,/* A sBx R[A] := (lua_Number)sBx */
|
||||
OP_LOADK,/* A Bx R[A] := K[Bx] */
|
||||
OP_LOADKX,/* A R[A] := K[extra arg] */
|
||||
OP_LOADFALSE,/* A B R[A] := false; if (B) pc++ */
|
||||
OP_LOADFALSE,/* A R[A] := false */
|
||||
OP_LFALSESKIP,/*A R[A] := false; pc++ */
|
||||
OP_LOADTRUE,/* A R[A] := true */
|
||||
OP_LOADNIL,/* A B R[A], R[A+1], ..., R[A+B] := nil */
|
||||
OP_GETUPVAL,/* A B R[A] := UpValue[B] */
|
||||
|
|
|
@ -16,6 +16,7 @@ static const char *const opnames[] = {
|
|||
"LOADK",
|
||||
"LOADKX",
|
||||
"LOADFALSE",
|
||||
"LFALSESKIP",
|
||||
"LOADTRUE",
|
||||
"LOADNIL",
|
||||
"GETUPVAL",
|
||||
|
|
6
lvm.c
6
lvm.c
|
@ -1183,7 +1183,11 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
|
|||
}
|
||||
vmcase(OP_LOADFALSE) {
|
||||
setbfvalue(s2v(ra));
|
||||
if (GETARG_B(i)) pc++; /* if B, skip next instruction */
|
||||
vmbreak;
|
||||
}
|
||||
vmcase(OP_LFALSESKIP) {
|
||||
setbfvalue(s2v(ra));
|
||||
pc++; /* skip next instruction */
|
||||
vmbreak;
|
||||
}
|
||||
vmcase(OP_LOADTRUE) {
|
||||
|
|
Loading…
Reference in New Issue