diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-05-26 15:14:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-05-26 15:14:54 -0300 |
commit | d61b0c60287c38008d312ddd11724a15b1737f7b (patch) | |
tree | cbba214daaf712ac78547d136aa24b12d1308294 /ldo.c | |
parent | 196bb94d66e727e0aec053a0276c3ad701500762 (diff) | |
download | lua-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.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 | */ |
606 | l_sinline void ccall (lua_State *L, StkId func, int nResults, int inc) { | 609 | l_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 */ |