MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / savelineinfo

Function savelineinfo

3rd/lua-5.4.3/src/lcode.c:328–343  ·  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

326** Otherwise, store the difference from last line in 'lineinfo'.
327*/
328static void savelineinfo (FuncState *fs, Proto *f, int line) {
329 int linedif = line - fs->previousline;
330 int pc = fs->pc - 1; /* last instruction coded */
331 if (abs(linedif) >= LIMLINEDIFF || fs->iwthabs++ >= MAXIWTHABS) {
332 luaM_growvector(fs->ls->L, f->abslineinfo, fs->nabslineinfo,
333 f->sizeabslineinfo, AbsLineInfo, MAX_INT, "lines");
334 f->abslineinfo[fs->nabslineinfo].pc = pc;
335 f->abslineinfo[fs->nabslineinfo++].line = line;
336 linedif = ABSLINEINFO; /* signal that there is absolute information */
337 fs->iwthabs = 1; /* restart counter */
338 }
339 luaM_growvector(fs->ls->L, f->lineinfo, pc, f->sizelineinfo, ls_byte,
340 MAX_INT, "opcodes");
341 f->lineinfo[pc] = linedif;
342 fs->previousline = line; /* last line saved */
343}
344
345
346/*

Callers 2

luaK_codeFunction · 0.85
luaK_fixlineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected