fix(lua): pack TValue and TKey structs to reduce RAM usage (#7289)

This commit is contained in:
Raphael Coeffic
2026-04-27 10:01:27 +10:00
committed by GitHub
parent 7d15aa341f
commit ef3008bb37
+8 -10
View File
@@ -117,20 +117,18 @@ typedef union Value {
} Value;
#define TValuefields Value value_; int tt_
#define TValuefields Value value_; lu_byte tt_
// #ifdef LUA_USE_ESP
// # pragma pack(4)
// #endif
#if defined(__GNUC__) || defined(__clang__)
#define LUA_PACKED __attribute__((__packed__))
#else
#define LUA_PACKED
#endif
typedef struct lua_TValue {
typedef struct LUA_PACKED lua_TValue {
TValuefields;
} TValue;
// #ifdef LUA_USE_ESP
// # pragma pack()
// #endif
/* macro defining a nil value */
#define NILCONSTANT {NULL}, LUA_TNIL
@@ -509,7 +507,7 @@ typedef union Closure {
*/
typedef union TKey {
struct {
struct LUA_PACKED {
TValuefields;
int next; /* for chaining (offset for next node) */
} nk;