diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-09-13 16:50:08 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-09-13 16:50:08 -0300 |
commit | 80d9b09f351c7a9be557116e9c79ae11e9b3f032 (patch) | |
tree | a6ae7cce019e85c2f79987035c77d4e4213d07a9 /lvm.c | |
parent | 029d269f4d1afd0e9ea0f889eb3e65a7f0fab0f9 (diff) | |
download | lua-80d9b09f351c7a9be557116e9c79ae11e9b3f032.tar.gz lua-80d9b09f351c7a9be557116e9c79ae11e9b3f032.tar.bz2 lua-80d9b09f351c7a9be557116e9c79ae11e9b3f032.zip |
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)
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.290 2017/07/07 16:34:32 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.291 2017/08/14 18:33:14 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 | */ |
@@ -753,10 +753,7 @@ void luaV_finishOp (lua_State *L) { | |||
753 | ** Execute a jump instruction. The 'updatemask' allows signals to stop | 753 | ** Execute a jump instruction. The 'updatemask' allows signals to stop |
754 | ** tight loops. (Without it, the local copy of 'mask' could never change.) | 754 | ** tight loops. (Without it, the local copy of 'mask' could never change.) |
755 | */ | 755 | */ |
756 | #define dojump(ci,i,e) \ | 756 | #define dojump(ci,i,e) { pc += GETARG_sBx(i) + e; updatemask(L); } |
757 | { int a = GETARG_A(i); \ | ||
758 | if (a != 0) luaF_close(L, ci->func + a); \ | ||
759 | pc += GETARG_sBx(i) + e; updatemask(L); } | ||
760 | 757 | ||
761 | 758 | ||
762 | /* for test instructions, execute the jump instruction that follows it */ | 759 | /* for test instructions, execute the jump instruction that follows it */ |
@@ -1201,6 +1198,10 @@ void luaV_execute (lua_State *L) { | |||
1201 | L->top = ci->top; /* restore top */ | 1198 | L->top = ci->top; /* restore top */ |
1202 | vmbreak; | 1199 | vmbreak; |
1203 | } | 1200 | } |
1201 | vmcase(OP_CLOSE) { | ||
1202 | luaF_close(L, ra); | ||
1203 | vmbreak; | ||
1204 | } | ||
1204 | vmcase(OP_JMP) { | 1205 | vmcase(OP_JMP) { |
1205 | dojump(ci, i, 0); | 1206 | dojump(ci, i, 0); |
1206 | vmbreak; | 1207 | vmbreak; |