diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-11-10 15:07:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-11-10 15:07:14 -0300 |
commit | e8deac5a41ffd644aaa78fda6d4bd5caa72cb077 (patch) | |
tree | f4a3d2a2f24adc6d58b4088705b85e349dd2a8e5 /ldebug.c | |
parent | bfbff3703edae789fa5efa9bf174f8e7cff4ded8 (diff) | |
download | lua-e8deac5a41ffd644aaa78fda6d4bd5caa72cb077.tar.gz lua-e8deac5a41ffd644aaa78fda6d4bd5caa72cb077.tar.bz2 lua-e8deac5a41ffd644aaa78fda6d4bd5caa72cb077.zip |
Avoid OP_VARARGPREP for active lines
when building the table 'activelines' for a vararg function, this
first instruction does not make the first line active.
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -301,7 +301,14 @@ static void collectvalidlines (lua_State *L, Closure *f) { | |||
301 | sethvalue2s(L, L->top, t); /* push it on stack */ | 301 | sethvalue2s(L, L->top, t); /* push it on stack */ |
302 | api_incr_top(L); | 302 | api_incr_top(L); |
303 | setbtvalue(&v); /* boolean 'true' to be the value of all indices */ | 303 | setbtvalue(&v); /* boolean 'true' to be the value of all indices */ |
304 | for (i = 0; i < p->sizelineinfo; i++) { /* for all instructions */ | 304 | if (!p->is_vararg) /* regular function? */ |
305 | i = 0; /* consider all instructions */ | ||
306 | else { /* vararg function */ | ||
307 | lua_assert(p->code[0] == OP_VARARGPREP); | ||
308 | currentline = nextline(p, currentline, 0); | ||
309 | i = 1; /* skip first instruction (OP_VARARGPREP) */ | ||
310 | } | ||
311 | for (; i < p->sizelineinfo; i++) { /* for each instruction */ | ||
305 | currentline = nextline(p, currentline, i); /* get its line */ | 312 | currentline = nextline(p, currentline, i); /* get its line */ |
306 | luaH_setint(L, t, currentline, &v); /* table[line] = true */ | 313 | luaH_setint(L, t, currentline, &v); /* table[line] = true */ |
307 | } | 314 | } |