aboutsummaryrefslogtreecommitdiff
path: root/lfunc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-06-27 08:35:31 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-06-27 08:35:31 -0300
commitb42430fd3a6200eaaf4020be90c4d47f7e251b67 (patch)
treec47c23ac9d461b79554986769375019dc6dc469c /lfunc.c
parent60a7492d249860d20098ac2f0b9d863606c38450 (diff)
downloadlua-b42430fd3a6200eaaf4020be90c4d47f7e251b67.tar.gz
lua-b42430fd3a6200eaaf4020be90c4d47f7e251b67.tar.bz2
lua-b42430fd3a6200eaaf4020be90c4d47f7e251b67.zip
'lineinfo' in prototypes saved as differences instead of absolute
values, so that the array can use bytes instead of ints, reducing its size. (A new array 'abslineinfo' is used when line differences do not fit in a byte.)
Diffstat (limited to 'lfunc.c')
-rw-r--r--lfunc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lfunc.c b/lfunc.c
index e84538c9..a4a4e29d 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lfunc.c,v 2.48 2017/04/30 20:43:26 roberto Exp roberto $ 2** $Id: lfunc.c,v 2.49 2017/05/24 18:54:54 roberto Exp roberto $
3** Auxiliary functions to manipulate prototypes and closures 3** Auxiliary functions to manipulate prototypes and closures
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -119,6 +119,8 @@ Proto *luaF_newproto (lua_State *L) {
119 f->sizecode = 0; 119 f->sizecode = 0;
120 f->lineinfo = NULL; 120 f->lineinfo = NULL;
121 f->sizelineinfo = 0; 121 f->sizelineinfo = 0;
122 f->abslineinfo = NULL;
123 f->sizeabslineinfo = 0;
122 f->upvalues = NULL; 124 f->upvalues = NULL;
123 f->sizeupvalues = 0; 125 f->sizeupvalues = 0;
124 f->numparams = 0; 126 f->numparams = 0;
@@ -138,6 +140,7 @@ void luaF_freeproto (lua_State *L, Proto *f) {
138 luaM_freearray(L, f->p, f->sizep); 140 luaM_freearray(L, f->p, f->sizep);
139 luaM_freearray(L, f->k, f->sizek); 141 luaM_freearray(L, f->k, f->sizek);
140 luaM_freearray(L, f->lineinfo, f->sizelineinfo); 142 luaM_freearray(L, f->lineinfo, f->sizelineinfo);
143 luaM_freearray(L, f->abslineinfo, f->sizeabslineinfo);
141 luaM_freearray(L, f->locvars, f->sizelocvars); 144 luaM_freearray(L, f->locvars, f->sizelocvars);
142 luaM_freearray(L, f->upvalues, f->sizeupvalues); 145 luaM_freearray(L, f->upvalues, f->sizeupvalues);
143 luaM_free(L, f); 146 luaM_free(L, f);