From d61ea6c5eeef4343e40c0225f22ad39c994f84a9 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Mon, 5 Aug 2019 00:03:08 -0500 Subject: lua LCD (Lua Compact Debug) patch LCD developed 9/2015 by Terry Ellison We've already discarded the ldebug module from lua it only makes sense to discard the debug info as well adds 1.5 K to the binary saves 8 Kb on the base state once scripts start getting called i've seen 10-50Kb savings but it all depends on what exactly you are running Change-Id: Ibb74f344df1c4c96380ec6c98b010a810e9ae9cc --- apps/plugins/lua/lfunc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'apps/plugins/lua/lfunc.c') diff --git a/apps/plugins/lua/lfunc.c b/apps/plugins/lua/lfunc.c index d2ce63dc4b..ef275cecd2 100644 --- a/apps/plugins/lua/lfunc.c +++ b/apps/plugins/lua/lfunc.c @@ -128,12 +128,17 @@ Proto *luaF_newproto (lua_State *L) { f->numparams = 0; f->is_vararg = 0; f->maxstacksize = 0; - f->lineinfo = NULL; f->sizelocvars = 0; f->locvars = NULL; f->linedefined = 0; f->lastlinedefined = 0; f->source = NULL; +#ifdef LUA_OPTIMIZE_DEBUG + f->packedlineinfo = NULL; +#else + f->lineinfo = NULL; + +#endif return f; } @@ -142,7 +147,13 @@ void luaF_freeproto (lua_State *L, Proto *f) { luaM_freearray(L, f->code, f->sizecode, Instruction); luaM_freearray(L, f->p, f->sizep, Proto *); luaM_freearray(L, f->k, f->sizek, TValue); +#ifdef LUA_OPTIMIZE_DEBUG + if (f->packedlineinfo) { + luaM_freearray(L, f->packedlineinfo, f->sizelineinfo, unsigned char); + } +#else luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); +#endif luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); luaM_free(L, f); -- cgit v1.2.3