** Save line info for a new instruction. If difference from last line ** does not fit in a byte, of after that many instructions, save a new ** absolute line info; (in that case, the special value 'ABSLINEINFO' ** in 'lineinfo' signals the existence of this absolute information.) ** Otherwise, store the difference from last line in 'lineinfo'. */
| 329 | ** Otherwise, store the difference from last line in 'lineinfo'. |
| 330 | */ |
| 331 | static void savelineinfo (FuncState *fs, Proto *f, int line) { |
| 332 | int linedif = line - fs->previousline; |
| 333 | int pc = fs->pc - 1; /* last instruction coded */ |
| 334 | if (abs(linedif) >= LIMLINEDIFF || fs->iwthabs++ >= MAXIWTHABS) { |
| 335 | luaM_growvector(fs->ls->L, f->abslineinfo, fs->nabslineinfo, |
| 336 | f->sizeabslineinfo, AbsLineInfo, INT_MAX, "lines"); |
| 337 | f->abslineinfo[fs->nabslineinfo].pc = pc; |
| 338 | f->abslineinfo[fs->nabslineinfo++].line = line; |
| 339 | linedif = ABSLINEINFO; /* signal that there is absolute information */ |
| 340 | fs->iwthabs = 1; /* restart counter */ |
| 341 | } |
| 342 | luaM_growvector(fs->ls->L, f->lineinfo, pc, f->sizelineinfo, ls_byte, |
| 343 | INT_MAX, "opcodes"); |
| 344 | f->lineinfo[pc] = cast(ls_byte, linedif); |
| 345 | fs->previousline = line; /* last line saved */ |
| 346 | } |
| 347 | |
| 348 | |
| 349 | /* |
no outgoing calls
no test coverage detected