Using CIST_CLSRET instead of trick with 'nresults'

The callstatus flag CIST_CLSRET is used in all tests for the
presence of variables to be closed in C functions.
This commit is contained in:
Roberto Ierusalimschy
2024-07-19 17:34:22 -03:00
parent a546138d15
commit f407b3c4a1
4 changed files with 31 additions and 30 deletions

16
lapi.h
View File

@@ -62,20 +62,4 @@
L->tbclist.p < L->top.p - (n), \
"not enough free elements in the stack")
/*
** To reduce the overhead of returning from C functions, the presence of
** to-be-closed variables in these functions is coded in the CallInfo's
** field 'nresults', in a way that functions with no to-be-closed variables
** with zero, one, or "all" wanted results have no overhead. Functions
** with other number of wanted results, as well as functions with
** variables to be closed, have an extra check.
*/
#define hastocloseCfunc(n) ((n) < LUA_MULTRET)
/* Map [-1, inf) (range of 'nresults') into (-inf, -2] */
#define codeNresults(n) (-(n) - 3)
#define decodeNresults(n) (-(n) - 3)
#endif