MCPcopy Create free account
hub / github.com/axmolengine/axmol / savelineinfo

Function savelineinfo

3rdparty/lua/plainlua/lcode.c:330–345  ·  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

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

Callers 2

luaK_codeFunction · 0.85
luaK_fixlineFunction · 0.85

Calls 1

absFunction · 0.50

Tested by

no test coverage detected