aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/lvm.c b/lvm.c
index ce15d61b..28952da0 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.302 2017/11/03 12:12:30 roberto Exp roberto $ 2** $Id: lvm.c,v 2.303 2017/11/03 17:22:54 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -754,11 +754,11 @@ void luaV_finishOp (lua_State *L) {
754** Execute a jump instruction. The 'updatemask' allows signals to stop 754** Execute a jump instruction. The 'updatemask' allows signals to stop
755** tight loops. (Without it, the local copy of 'mask' could never change.) 755** tight loops. (Without it, the local copy of 'mask' could never change.)
756*/ 756*/
757#define dojump(ci,i,e) { pc += GETARG_sBx(i) + e; updatemask(L); } 757#define dojump(i,e) { pc += GETARG_sBx(i) + e; updatemask(L); }
758 758
759 759
760/* for test instructions, execute the jump instruction that follows it */ 760/* for test instructions, execute the jump instruction that follows it */
761#define donextjump(ci) { i = *pc; dojump(ci, i, 1); } 761#define donextjump() { i = *pc; dojump(i, 1); }
762 762
763/* 763/*
764** Whenever code can raise errors (including memory errors), the global 764** Whenever code can raise errors (including memory errors), the global
@@ -1286,7 +1286,7 @@ void luaV_execute (lua_State *L) {
1286 vmbreak; 1286 vmbreak;
1287 } 1287 }
1288 vmcase(OP_JMP) { 1288 vmcase(OP_JMP) {
1289 dojump(ci, i, 0); 1289 dojump(i, 0);
1290 vmbreak; 1290 vmbreak;
1291 } 1291 }
1292 vmcase(OP_EQ) { 1292 vmcase(OP_EQ) {
@@ -1296,7 +1296,7 @@ void luaV_execute (lua_State *L) {
1296 if (luaV_equalobj(L, rb, rc) != GETARG_A(i)) 1296 if (luaV_equalobj(L, rb, rc) != GETARG_A(i))
1297 pc++; 1297 pc++;
1298 else 1298 else
1299 donextjump(ci); 1299 donextjump();
1300 ) 1300 )
1301 vmbreak; 1301 vmbreak;
1302 } 1302 }
@@ -1312,7 +1312,7 @@ void luaV_execute (lua_State *L) {
1312 if (res != GETARG_A(i)) 1312 if (res != GETARG_A(i))
1313 pc++; 1313 pc++;
1314 else 1314 else
1315 donextjump(ci); 1315 donextjump();
1316 vmbreak; 1316 vmbreak;
1317 } 1317 }
1318 vmcase(OP_LE) { 1318 vmcase(OP_LE) {
@@ -1327,14 +1327,14 @@ void luaV_execute (lua_State *L) {
1327 if (res != GETARG_A(i)) 1327 if (res != GETARG_A(i))
1328 pc++; 1328 pc++;
1329 else 1329 else
1330 donextjump(ci); 1330 donextjump();
1331 vmbreak; 1331 vmbreak;
1332 } 1332 }
1333 vmcase(OP_TEST) { 1333 vmcase(OP_TEST) {
1334 if (GETARG_C(i) ? l_isfalse(s2v(ra)) : !l_isfalse(s2v(ra))) 1334 if (GETARG_C(i) ? l_isfalse(s2v(ra)) : !l_isfalse(s2v(ra)))
1335 pc++; 1335 pc++;
1336 else 1336 else
1337 donextjump(ci); 1337 donextjump();
1338 vmbreak; 1338 vmbreak;
1339 } 1339 }
1340 vmcase(OP_TESTSET) { 1340 vmcase(OP_TESTSET) {
@@ -1343,7 +1343,7 @@ void luaV_execute (lua_State *L) {
1343 pc++; 1343 pc++;
1344 else { 1344 else {
1345 setobj2s(L, ra, rb); 1345 setobj2s(L, ra, rb);
1346 donextjump(ci); 1346 donextjump();
1347 } 1347 }
1348 vmbreak; 1348 vmbreak;
1349 } 1349 }
@@ -1377,9 +1377,7 @@ void luaV_execute (lua_State *L) {
1377 } 1377 }
1378 else { 1378 else {
1379 /* tail call: put called frame (n) in place of caller one (o) */ 1379 /* tail call: put called frame (n) in place of caller one (o) */
1380 CallInfo *nci = L->ci; /* called frame (new) */ 1380 StkId nfunc = L->func; /* called function */
1381 CallInfo *oci = nci->previous; /* caller frame (old) */
1382 StkId nfunc = nci->func; /* called function */
1383 StkId ofunc = nfunc - nfunc->stkci.previous; /* caller function */ 1381 StkId ofunc = nfunc - nfunc->stkci.previous; /* caller function */
1384 /* last stack slot filled by 'precall' */ 1382 /* last stack slot filled by 'precall' */
1385 StkId lim = nfunc + 1 + getproto(s2v(nfunc))->numparams; 1383 StkId lim = nfunc + 1 + getproto(s2v(nfunc))->numparams;
@@ -1393,7 +1391,7 @@ void luaV_execute (lua_State *L) {
1393 L->top = functop(ofunc); /* correct top */ 1391 L->top = functop(ofunc); /* correct top */
1394 ofunc->stkci.u.l.savedpc = nfunc->stkci.u.l.savedpc; 1392 ofunc->stkci.u.l.savedpc = nfunc->stkci.u.l.savedpc;
1395 callstatus(ofunc) |= CIST_TAIL; /* function was tail called */ 1393 callstatus(ofunc) |= CIST_TAIL; /* function was tail called */
1396 ci = L->ci = oci; /* remove new frame */ 1394 ci = L->ci = L->ci->previous; /* remove new frame */
1397 base = ofunc + 1; 1395 base = ofunc + 1;
1398 L->func = ofunc; 1396 L->func = ofunc;
1399 lua_assert(L->top == base + getproto(s2v(ofunc))->maxstacksize); 1397 lua_assert(L->top == base + getproto(s2v(ofunc))->maxstacksize);