diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-11-02 09:43:17 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-11-02 09:43:17 -0200 |
commit | 07a2dcacbfb8f9a2332da19b5c5a178e87d7af21 (patch) | |
tree | 4703c1757e623f52b3fc800ce7ba08342520d655 | |
parent | c874abac98b4bbd73603c599bc8096ac800e1184 (diff) | |
download | lua-07a2dcacbfb8f9a2332da19b5c5a178e87d7af21.tar.gz lua-07a2dcacbfb8f9a2332da19b5c5a178e87d7af21.tar.bz2 lua-07a2dcacbfb8f9a2332da19b5c5a178e87d7af21.zip |
flag CIST_REENTRY changed to CIST_FRESH (its negation); fresh invocations
seem to be less frequent than reentries. (So, avoid setting flag on
the frequent case.)
-rw-r--r-- | lstate.h | 6 | ||||
-rw-r--r-- | lvm.c | 6 |
2 files changed, 6 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.124 2015/09/08 15:41:05 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.125 2015/09/22 14:18:24 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -89,8 +89,8 @@ typedef struct CallInfo { | |||
89 | #define CIST_OAH (1<<0) /* original value of 'allowhook' */ | 89 | #define CIST_OAH (1<<0) /* original value of 'allowhook' */ |
90 | #define CIST_LUA (1<<1) /* call is running a Lua function */ | 90 | #define CIST_LUA (1<<1) /* call is running a Lua function */ |
91 | #define CIST_HOOKED (1<<2) /* call is running a debug hook */ | 91 | #define CIST_HOOKED (1<<2) /* call is running a debug hook */ |
92 | #define CIST_REENTRY (1<<3) /* call is running on same invocation of | 92 | #define CIST_FRESH (1<<3) /* call is running on a fresh invocation |
93 | luaV_execute of previous call */ | 93 | of luaV_execute */ |
94 | #define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ | 94 | #define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ |
95 | #define CIST_TAIL (1<<5) /* call was tail called */ | 95 | #define CIST_TAIL (1<<5) /* call was tail called */ |
96 | #define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ | 96 | #define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.256 2015/10/22 14:40:47 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.257 2015/10/28 14:50:09 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 | */ |
@@ -764,6 +764,7 @@ void luaV_execute (lua_State *L) { | |||
764 | LClosure *cl; | 764 | LClosure *cl; |
765 | TValue *k; | 765 | TValue *k; |
766 | StkId base; | 766 | StkId base; |
767 | ci->callstatus |= CIST_FRESH; /* fresh invocation of 'luaV_execute" */ | ||
767 | newframe: /* reentry point when frame changes (call/return) */ | 768 | newframe: /* reentry point when frame changes (call/return) */ |
768 | lua_assert(ci == L->ci); | 769 | lua_assert(ci == L->ci); |
769 | cl = clLvalue(ci->func); /* local reference to function's closure */ | 770 | cl = clLvalue(ci->func); /* local reference to function's closure */ |
@@ -1118,7 +1119,6 @@ void luaV_execute (lua_State *L) { | |||
1118 | } | 1119 | } |
1119 | else { /* Lua function */ | 1120 | else { /* Lua function */ |
1120 | ci = L->ci; | 1121 | ci = L->ci; |
1121 | ci->callstatus |= CIST_REENTRY; | ||
1122 | goto newframe; /* restart luaV_execute over new Lua function */ | 1122 | goto newframe; /* restart luaV_execute over new Lua function */ |
1123 | } | 1123 | } |
1124 | vmbreak; | 1124 | vmbreak; |
@@ -1158,7 +1158,7 @@ void luaV_execute (lua_State *L) { | |||
1158 | int b = GETARG_B(i); | 1158 | int b = GETARG_B(i); |
1159 | if (cl->p->sizep > 0) luaF_close(L, base); | 1159 | if (cl->p->sizep > 0) luaF_close(L, base); |
1160 | b = luaD_poscall(L, ra, (b != 0 ? b - 1 : cast_int(L->top - ra))); | 1160 | b = luaD_poscall(L, ra, (b != 0 ? b - 1 : cast_int(L->top - ra))); |
1161 | if (!(ci->callstatus & CIST_REENTRY)) /* 'ci' still the called one */ | 1161 | if (ci->callstatus & CIST_FRESH) /* local 'ci' still from callee */ |
1162 | return; /* external invocation: return */ | 1162 | return; /* external invocation: return */ |
1163 | else { /* invocation via reentry: continue execution */ | 1163 | else { /* invocation via reentry: continue execution */ |
1164 | ci = L->ci; | 1164 | ci = L->ci; |