From 4c6afbcb01d1cae72d829af5301df5f592fa2079 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 30 Jul 2024 10:16:19 -0300 Subject: Struct 'transferinfo' moved to "lua_State" That reduces the size of "CallInfo". Moreover, bit CIST_HOOKED from call status is not needed. When in a hook, 'transferinfo' is always valid, being zero when the hook is not call/return. --- lstate.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'lstate.h') diff --git a/lstate.h b/lstate.h index aa9687ae..e12ca154 100644 --- a/lstate.h +++ b/lstate.h @@ -183,8 +183,6 @@ typedef struct stringtable { ** yield (from the yield until the next resume); ** - field 'nres' is used only while closing tbc variables when ** returning from a function; -** - field 'transferinfo' is used only during call/returnhooks, -** before the function starts or after it ends. */ struct CallInfo { StkIdRel func; /* function index in the stack */ @@ -206,10 +204,6 @@ struct CallInfo { int funcidx; /* called-function index */ int nyield; /* number of values yielded */ int nres; /* number of values returned */ - struct { /* info about transferred values (for call/return hooks) */ - int ftransfer; /* offset of first value transferred */ - int ntransfer; /* number of values transferred */ - } transferinfo; } u2; l_uint32 callstatus; }; @@ -236,15 +230,13 @@ struct CallInfo { #define CIST_HOOKYIELD (cast(l_uint32, 1) << 14) /* function "called" a finalizer */ #define CIST_FIN (cast(l_uint32, 1) << 15) -/* 'ci' has transfer information */ -#define CIST_TRAN (cast(l_uint32, 1) << 16) /* function is closing tbc variables */ -#define CIST_CLSRET (cast(l_uint32, 1) << 17) -/* Bits 18-20 are used for CIST_RECST (see below) */ -#define CIST_RECST 18 /* the offset, not the mask */ +#define CIST_CLSRET (cast(l_uint32, 1) << 16) +/* Bits 17-19 are used for CIST_RECST (see below) */ +#define CIST_RECST 17 /* the offset, not the mask */ #if defined(LUA_COMPAT_LT_LE) /* using __lt for __le */ -#define CIST_LEQ (cast(l_uint32, 1) << 21) +#define CIST_LEQ (cast(l_uint32, 1) << 20) #endif @@ -354,6 +346,10 @@ struct lua_State { int basehookcount; int hookcount; volatile l_signalT hookmask; + struct { /* info about transferred values (for call/return hooks) */ + int ftransfer; /* offset of first value transferred */ + int ntransfer; /* number of values transferred */ + } transferinfo; }; -- cgit v1.2.3-55-g6feb