mirror of
https://github.com/lua/lua
synced 2024-11-22 21:01:26 +03:00
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.)
This commit is contained in:
parent
c874abac98
commit
07a2dcacbf
6
lstate.h
6
lstate.h
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lstate.h,v 2.124 2015/09/08 15:41:05 roberto Exp roberto $
|
||||
** $Id: lstate.h,v 2.125 2015/09/22 14:18:24 roberto Exp roberto $
|
||||
** Global State
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -89,8 +89,8 @@ typedef struct CallInfo {
|
||||
#define CIST_OAH (1<<0) /* original value of 'allowhook' */
|
||||
#define CIST_LUA (1<<1) /* call is running a Lua function */
|
||||
#define CIST_HOOKED (1<<2) /* call is running a debug hook */
|
||||
#define CIST_REENTRY (1<<3) /* call is running on same invocation of
|
||||
luaV_execute of previous call */
|
||||
#define CIST_FRESH (1<<3) /* call is running on a fresh invocation
|
||||
of luaV_execute */
|
||||
#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */
|
||||
#define CIST_TAIL (1<<5) /* call was tail called */
|
||||
#define CIST_HOOKYIELD (1<<6) /* last hook called yielded */
|
||||
|
6
lvm.c
6
lvm.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 2.256 2015/10/22 14:40:47 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 2.257 2015/10/28 14:50:09 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -764,6 +764,7 @@ void luaV_execute (lua_State *L) {
|
||||
LClosure *cl;
|
||||
TValue *k;
|
||||
StkId base;
|
||||
ci->callstatus |= CIST_FRESH; /* fresh invocation of 'luaV_execute" */
|
||||
newframe: /* reentry point when frame changes (call/return) */
|
||||
lua_assert(ci == L->ci);
|
||||
cl = clLvalue(ci->func); /* local reference to function's closure */
|
||||
@ -1118,7 +1119,6 @@ void luaV_execute (lua_State *L) {
|
||||
}
|
||||
else { /* Lua function */
|
||||
ci = L->ci;
|
||||
ci->callstatus |= CIST_REENTRY;
|
||||
goto newframe; /* restart luaV_execute over new Lua function */
|
||||
}
|
||||
vmbreak;
|
||||
@ -1158,7 +1158,7 @@ void luaV_execute (lua_State *L) {
|
||||
int b = GETARG_B(i);
|
||||
if (cl->p->sizep > 0) luaF_close(L, base);
|
||||
b = luaD_poscall(L, ra, (b != 0 ? b - 1 : cast_int(L->top - ra)));
|
||||
if (!(ci->callstatus & CIST_REENTRY)) /* 'ci' still the called one */
|
||||
if (ci->callstatus & CIST_FRESH) /* local 'ci' still from callee */
|
||||
return; /* external invocation: return */
|
||||
else { /* invocation via reentry: continue execution */
|
||||
ci = L->ci;
|
||||
|
Loading…
Reference in New Issue
Block a user