MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / savelineinfo

Function savelineinfo

third-party/lua-5.5.0/src/lcode.c:331–346  ·  view source on GitHub ↗

** 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'. */

Source from the content-addressed store, hash-verified

329** Otherwise, store the difference from last line in 'lineinfo'.
330*/
331static 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/*

Callers 2

luaK_codeFunction · 0.70
luaK_fixlineFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected