diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-27 08:35:31 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-27 08:35:31 -0300 |
commit | b42430fd3a6200eaaf4020be90c4d47f7e251b67 (patch) | |
tree | c47c23ac9d461b79554986769375019dc6dc469c /lundump.c | |
parent | 60a7492d249860d20098ac2f0b9d863606c38450 (diff) | |
download | lua-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 'lundump.c')
-rw-r--r-- | lundump.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.c,v 2.43 2015/09/17 15:51:05 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 2.44 2015/11/02 16:09:30 roberto Exp roberto $ |
3 | ** load precompiled Lua chunks | 3 | ** load precompiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -180,10 +180,17 @@ static void LoadUpvalues (LoadState *S, Proto *f) { | |||
180 | static void LoadDebug (LoadState *S, Proto *f) { | 180 | static void LoadDebug (LoadState *S, Proto *f) { |
181 | int i, n; | 181 | int i, n; |
182 | n = LoadInt(S); | 182 | n = LoadInt(S); |
183 | f->lineinfo = luaM_newvector(S->L, n, int); | 183 | f->lineinfo = luaM_newvector(S->L, n, ls_byte); |
184 | f->sizelineinfo = n; | 184 | f->sizelineinfo = n; |
185 | LoadVector(S, f->lineinfo, n); | 185 | LoadVector(S, f->lineinfo, n); |
186 | n = LoadInt(S); | 186 | n = LoadInt(S); |
187 | f->abslineinfo = luaM_newvector(S->L, n, AbsLineInfo); | ||
188 | f->sizeabslineinfo = n; | ||
189 | for (i = 0; i < n; i++) { | ||
190 | f->abslineinfo[i].pc = LoadInt(S); | ||
191 | f->abslineinfo[i].line = LoadInt(S); | ||
192 | } | ||
193 | n = LoadInt(S); | ||
187 | f->locvars = luaM_newvector(S->L, n, LocVar); | 194 | f->locvars = luaM_newvector(S->L, n, LocVar); |
188 | f->sizelocvars = n; | 195 | f->sizelocvars = n; |
189 | for (i = 0; i < n; i++) | 196 | for (i = 0; i < n; i++) |