mirror of https://github.com/rusefi/lua.git
'luaV_execute' gets call info as extra argument (it is always
available on call sites)
This commit is contained in:
parent
36aecd4548
commit
c766e4103d
13
ldo.c
13
ldo.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: ldo.c,v 2.174 2017/11/23 16:35:54 roberto Exp roberto $
|
||||
** $Id: ldo.c,v 2.175 2017/11/23 18:29:41 roberto Exp roberto $
|
||||
** Stack and Call structure of Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -468,7 +468,7 @@ void luaD_call (lua_State *L, StkId func, int nresults) {
|
|||
ci->callstatus = CIST_LUA;
|
||||
if (L->hookmask)
|
||||
callhook(L, ci, 0);
|
||||
luaV_execute(L); /* run the function */
|
||||
luaV_execute(L, ci); /* run the function */
|
||||
break;
|
||||
}
|
||||
default: { /* not a function */
|
||||
|
@ -525,14 +525,15 @@ static void finishCcall (lua_State *L, int status) {
|
|||
** status is LUA_YIELD).
|
||||
*/
|
||||
static void unroll (lua_State *L, void *ud) {
|
||||
CallInfo *ci;
|
||||
if (ud != NULL) /* error status? */
|
||||
finishCcall(L, *(int *)ud); /* finish 'lua_pcallk' callee */
|
||||
while (L->ci != &L->base_ci) { /* something in the stack */
|
||||
if (!isLua(L->ci)) /* C function? */
|
||||
while ((ci = L->ci) != &L->base_ci) { /* something in the stack */
|
||||
if (!isLua(ci)) /* C function? */
|
||||
finishCcall(L, LUA_YIELD); /* complete its execution */
|
||||
else { /* Lua function */
|
||||
luaV_finishOp(L); /* finish interrupted instruction */
|
||||
luaV_execute(L); /* execute down to higher C 'boundary' */
|
||||
luaV_execute(L, ci); /* execute down to higher C 'boundary' */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -606,7 +607,7 @@ static void resume (lua_State *L, void *ud) {
|
|||
lua_assert(L->status == LUA_YIELD);
|
||||
L->status = LUA_OK; /* mark that it is running (again) */
|
||||
if (isLua(ci)) /* yielded inside a hook? */
|
||||
luaV_execute(L); /* just continue running Lua code */
|
||||
luaV_execute(L, ci); /* just continue running Lua code */
|
||||
else { /* 'common' yield */
|
||||
if (ci->u.c.k != NULL) { /* does it have a continuation function? */
|
||||
lua_unlock(L);
|
||||
|
|
5
lvm.c
5
lvm.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lvm.c,v 2.319 2017/11/28 12:58:18 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 2.320 2017/11/28 14:51:00 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -823,8 +823,7 @@ void luaV_finishOp (lua_State *L) {
|
|||
#define vmbreak break
|
||||
|
||||
|
||||
void luaV_execute (lua_State *L) {
|
||||
CallInfo *ci = L->ci;
|
||||
void luaV_execute (lua_State *L, CallInfo *ci) {
|
||||
LClosure *cl = clLvalue(s2v(ci->func));
|
||||
TValue *k = cl->p->k;
|
||||
StkId base = ci->func + 1;
|
||||
|
|
4
lvm.h
4
lvm.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lvm.h,v 2.46 2017/07/07 16:34:32 roberto Exp roberto $
|
||||
** $Id: lvm.h,v 2.47 2017/11/08 14:50:23 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -112,7 +112,7 @@ LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key,
|
|||
LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
|
||||
TValue *val, const TValue *slot);
|
||||
LUAI_FUNC void luaV_finishOp (lua_State *L);
|
||||
LUAI_FUNC void luaV_execute (lua_State *L);
|
||||
LUAI_FUNC void luaV_execute (lua_State *L, CallInfo *ci);
|
||||
LUAI_FUNC void luaV_concat (lua_State *L, int total);
|
||||
LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y);
|
||||
LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y);
|
||||
|
|
Loading…
Reference in New Issue