jumps do not close upvalues (to be faster and simpler);

explicit instruction to close upvalues; command 'break' not
handled like a 'goto' (to optimize removal of uneeded 'close'
instructions)
This commit is contained in:
Roberto Ierusalimschy
2017-09-13 16:50:08 -03:00
parent 029d269f4d
commit 80d9b09f35
6 changed files with 139 additions and 67 deletions

11
lvm.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.290 2017/07/07 16:34:32 roberto Exp roberto $
** $Id: lvm.c,v 2.291 2017/08/14 18:33:14 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -753,10 +753,7 @@ void luaV_finishOp (lua_State *L) {
** Execute a jump instruction. The 'updatemask' allows signals to stop
** tight loops. (Without it, the local copy of 'mask' could never change.)
*/
#define dojump(ci,i,e) \
{ int a = GETARG_A(i); \
if (a != 0) luaF_close(L, ci->func + a); \
pc += GETARG_sBx(i) + e; updatemask(L); }
#define dojump(ci,i,e) { pc += GETARG_sBx(i) + e; updatemask(L); }
/* for test instructions, execute the jump instruction that follows it */
@@ -1201,6 +1198,10 @@ void luaV_execute (lua_State *L) {
L->top = ci->top; /* restore top */
vmbreak;
}
vmcase(OP_CLOSE) {
luaF_close(L, ra);
vmbreak;
}
vmcase(OP_JMP) {
dojump(ci, i, 0);
vmbreak;