1717** Macro to check stack size and grow stack if needed. Parameters
1818** 'pre'/'pos' allow the macro to preserve a pointer into the
1919** stack across reallocations, doing the work only when needed.
20+ ** It also allows the running of one GC step when the stack is
21+ ** reallocated.
2022** 'condmovestack' is used in heavy tests to force a stack reallocation
2123** at every check.
2224*/
2325#define luaD_checkstackaux (L ,n ,pre ,pos ) \
24- if (L->stack_last - L->top <= (n)) \
26+ if (l_unlikely( L->stack_last - L->top <= (n) )) \
2527 { pre; luaD_growstack(L, n, 1); pos; } \
2628 else { condmovestack(L,pre,pos); }
2729
3537
3638
3739/* macro to check stack size, preserving 'p' */
38- #define checkstackp (L ,n ,p ) \
40+ #define checkstackGCp (L ,n ,p ) \
3941 luaD_checkstackaux(L, n, \
4042 ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \
4143 luaC_checkGC (L ), /* stack grow uses memory */ \
4446
4547/* macro to check stack size and GC */
4648#define checkstackGC (L ,fsize ) \
47- luaD_checkstackaux(L, (fsize), (void)0, luaC_checkGC(L) )
49+ luaD_checkstackaux(L, (fsize), luaC_checkGC(L), (void)0 )
4850
4951
5052/* type of protected functions, to be ran by 'runprotected' */
@@ -56,10 +58,12 @@ LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
5658LUAI_FUNC void luaD_hook (lua_State * L , int event , int line ,
5759 int fTransfer , int nTransfer );
5860LUAI_FUNC void luaD_hookcall (lua_State * L , CallInfo * ci );
59- LUAI_FUNC void luaD_pretailcall (lua_State * L , CallInfo * ci , StkId func , int n );
61+ LUAI_FUNC int luaD_pretailcall (lua_State * L , CallInfo * ci , StkId func , int narg1 , int delta );
62+ LUAI_FUNC CallInfo * luaD_precall (lua_State * L , StkId func , int nResults );
6063LUAI_FUNC void luaD_call (lua_State * L , StkId func , int nResults );
6164LUAI_FUNC void luaD_callnoyield (lua_State * L , StkId func , int nResults );
62- LUAI_FUNC void luaD_tryfuncTM (lua_State * L , StkId func );
65+ LUAI_FUNC StkId luaD_tryfuncTM (lua_State * L , StkId func );
66+ LUAI_FUNC int luaD_closeprotected (lua_State * L , ptrdiff_t level , int status );
6367LUAI_FUNC int luaD_pcall (lua_State * L , Pfunc func , void * u ,
6468 ptrdiff_t oldtop , ptrdiff_t ef );
6569LUAI_FUNC void luaD_poscall (lua_State * L , CallInfo * ci , int nres );
0 commit comments