From 4e47f81188d37e29027158b76271d02a781242e2 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 9 Feb 2021 14:00:05 -0300 Subject: New implementation for to-be-closed variables To-be-closed variables are linked in their own list, embedded into the stack elements. (Due to alignment, this information does not change the size of the stack elements in most architectures.) This new list does not produce garbage and avoids memory errors when creating tbc variables. --- lfunc.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lfunc.h') diff --git a/lfunc.h b/lfunc.h index 2e6df535..dc1cebcc 100644 --- a/lfunc.h +++ b/lfunc.h @@ -42,15 +42,9 @@ #define MAXMISS 10 -/* -** Special "status" for 'luaF_close' -*/ - -/* close upvalues without running their closing methods */ -#define NOCLOSINGMETH (-1) /* special status to close upvalues preserving the top of the stack */ -#define CLOSEKTOP (-2) +#define CLOSEKTOP (-1) LUAI_FUNC Proto *luaF_newproto (lua_State *L); @@ -59,6 +53,7 @@ LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals); LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_closeupval (lua_State *L, StkId level); LUAI_FUNC void luaF_close (lua_State *L, StkId level, int status, int yy); LUAI_FUNC void luaF_unlinkupval (UpVal *uv); LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); -- cgit v1.2.3-55-g6feb