MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / savelineinfo

Function savelineinfo

extlibs/lua/src/lcode.c:337–352  ·  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

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

Callers 2

luaK_codeFunction · 0.85
luaK_fixlineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected