diff options
-rw-r--r-- | ldo.c | 13 | ||||
-rw-r--r-- | lvm.c | 5 | ||||
-rw-r--r-- | lvm.h | 4 |
3 files changed, 11 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.174 2017/11/23 16:35:54 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.175 2017/11/23 18:29:41 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -468,7 +468,7 @@ void luaD_call (lua_State *L, StkId func, int nresults) { | |||
468 | ci->callstatus = CIST_LUA; | 468 | ci->callstatus = CIST_LUA; |
469 | if (L->hookmask) | 469 | if (L->hookmask) |
470 | callhook(L, ci, 0); | 470 | callhook(L, ci, 0); |
471 | luaV_execute(L); /* run the function */ | 471 | luaV_execute(L, ci); /* run the function */ |
472 | break; | 472 | break; |
473 | } | 473 | } |
474 | default: { /* not a function */ | 474 | default: { /* not a function */ |
@@ -525,14 +525,15 @@ static void finishCcall (lua_State *L, int status) { | |||
525 | ** status is LUA_YIELD). | 525 | ** status is LUA_YIELD). |
526 | */ | 526 | */ |
527 | static void unroll (lua_State *L, void *ud) { | 527 | static void unroll (lua_State *L, void *ud) { |
528 | CallInfo *ci; | ||
528 | if (ud != NULL) /* error status? */ | 529 | if (ud != NULL) /* error status? */ |
529 | finishCcall(L, *(int *)ud); /* finish 'lua_pcallk' callee */ | 530 | finishCcall(L, *(int *)ud); /* finish 'lua_pcallk' callee */ |
530 | while (L->ci != &L->base_ci) { /* something in the stack */ | 531 | while ((ci = L->ci) != &L->base_ci) { /* something in the stack */ |
531 | if (!isLua(L->ci)) /* C function? */ | 532 | if (!isLua(ci)) /* C function? */ |
532 | finishCcall(L, LUA_YIELD); /* complete its execution */ | 533 | finishCcall(L, LUA_YIELD); /* complete its execution */ |
533 | else { /* Lua function */ | 534 | else { /* Lua function */ |
534 | luaV_finishOp(L); /* finish interrupted instruction */ | 535 | luaV_finishOp(L); /* finish interrupted instruction */ |
535 | luaV_execute(L); /* execute down to higher C 'boundary' */ | 536 | luaV_execute(L, ci); /* execute down to higher C 'boundary' */ |
536 | } | 537 | } |
537 | } | 538 | } |
538 | } | 539 | } |
@@ -606,7 +607,7 @@ static void resume (lua_State *L, void *ud) { | |||
606 | lua_assert(L->status == LUA_YIELD); | 607 | lua_assert(L->status == LUA_YIELD); |
607 | L->status = LUA_OK; /* mark that it is running (again) */ | 608 | L->status = LUA_OK; /* mark that it is running (again) */ |
608 | if (isLua(ci)) /* yielded inside a hook? */ | 609 | if (isLua(ci)) /* yielded inside a hook? */ |
609 | luaV_execute(L); /* just continue running Lua code */ | 610 | luaV_execute(L, ci); /* just continue running Lua code */ |
610 | else { /* 'common' yield */ | 611 | else { /* 'common' yield */ |
611 | if (ci->u.c.k != NULL) { /* does it have a continuation function? */ | 612 | if (ci->u.c.k != NULL) { /* does it have a continuation function? */ |
612 | lua_unlock(L); | 613 | lua_unlock(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.319 2017/11/28 12:58:18 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.320 2017/11/28 14:51:00 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 | */ |
@@ -823,8 +823,7 @@ void luaV_finishOp (lua_State *L) { | |||
823 | #define vmbreak break | 823 | #define vmbreak break |
824 | 824 | ||
825 | 825 | ||
826 | void luaV_execute (lua_State *L) { | 826 | void luaV_execute (lua_State *L, CallInfo *ci) { |
827 | CallInfo *ci = L->ci; | ||
828 | LClosure *cl = clLvalue(s2v(ci->func)); | 827 | LClosure *cl = clLvalue(s2v(ci->func)); |
829 | TValue *k = cl->p->k; | 828 | TValue *k = cl->p->k; |
830 | StkId base = ci->func + 1; | 829 | StkId base = ci->func + 1; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.h,v 2.46 2017/07/07 16:34:32 roberto Exp roberto $ | 2 | ** $Id: lvm.h,v 2.47 2017/11/08 14:50:23 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 | */ |
@@ -112,7 +112,7 @@ LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, | |||
112 | LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, | 112 | LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, |
113 | TValue *val, const TValue *slot); | 113 | TValue *val, const TValue *slot); |
114 | LUAI_FUNC void luaV_finishOp (lua_State *L); | 114 | LUAI_FUNC void luaV_finishOp (lua_State *L); |
115 | LUAI_FUNC void luaV_execute (lua_State *L); | 115 | LUAI_FUNC void luaV_execute (lua_State *L, CallInfo *ci); |
116 | LUAI_FUNC void luaV_concat (lua_State *L, int total); | 116 | LUAI_FUNC void luaV_concat (lua_State *L, int total); |
117 | LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); | 117 | LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); |
118 | LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); | 118 | LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); |