aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-05-26 15:14:54 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2022-05-26 15:14:54 -0300
commitd61b0c60287c38008d312ddd11724a15b1737f7b (patch)
treecbba214daaf712ac78547d136aa24b12d1308294 /ldo.c
parent196bb94d66e727e0aec053a0276c3ad701500762 (diff)
downloadlua-d61b0c60287c38008d312ddd11724a15b1737f7b.tar.gz
lua-d61b0c60287c38008d312ddd11724a15b1737f7b.tar.bz2
lua-d61b0c60287c38008d312ddd11724a15b1737f7b.zip
More checks and documentation for uses of EXTRA_STACK
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ldo.c b/ldo.c
index 13498905..419b3db9 100644
--- a/ldo.c
+++ b/ldo.c
@@ -602,12 +602,17 @@ CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) {
602** Call a function (C or Lua) through C. 'inc' can be 1 (increment 602** Call a function (C or Lua) through C. 'inc' can be 1 (increment
603** number of recursive invocations in the C stack) or nyci (the same 603** number of recursive invocations in the C stack) or nyci (the same
604** plus increment number of non-yieldable calls). 604** plus increment number of non-yieldable calls).
605** This function can be called with some use of EXTRA_STACK, so it should
606** check the stack before doing anything else. 'luaD_precall' already
607** does that.
605*/ 608*/
606l_sinline void ccall (lua_State *L, StkId func, int nResults, int inc) { 609l_sinline void ccall (lua_State *L, StkId func, int nResults, int inc) {
607 CallInfo *ci; 610 CallInfo *ci;
608 L->nCcalls += inc; 611 L->nCcalls += inc;
609 if (l_unlikely(getCcalls(L) >= LUAI_MAXCCALLS)) 612 if (l_unlikely(getCcalls(L) >= LUAI_MAXCCALLS)) {
613 checkstackp(L, 0, func); /* free any use of EXTRA_STACK */
610 luaE_checkcstack(L); 614 luaE_checkcstack(L);
615 }
611 if ((ci = luaD_precall(L, func, nResults)) != NULL) { /* Lua function? */ 616 if ((ci = luaD_precall(L, func, nResults)) != NULL) { /* Lua function? */
612 ci->callstatus = CIST_FRESH; /* mark that it is a "fresh" execute */ 617 ci->callstatus = CIST_FRESH; /* mark that it is a "fresh" execute */
613 luaV_execute(L, ci); /* call it */ 618 luaV_execute(L, ci); /* call it */