diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-29 11:02:17 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-11-29 11:02:17 -0200 |
commit | c766e4103db888063c4f928747afd6eb448e306f (patch) | |
tree | 9d6f8a73487283054f0c07f315b0bdd3eaa9657e /ldo.c | |
parent | 36aecd4548e5cafc3b6b7ab9f6045db866cf7d9a (diff) | |
download | lua-c766e4103db888063c4f928747afd6eb448e306f.tar.gz lua-c766e4103db888063c4f928747afd6eb448e306f.tar.bz2 lua-c766e4103db888063c4f928747afd6eb448e306f.zip |
'luaV_execute' gets call info as extra argument (it is always
available on call sites)
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 13 |
1 files changed, 7 insertions, 6 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); |