summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-23 14:29:03 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-24 10:15:31 +0200
commit48b7f1bbe33dee7785fdfa5bb7418191efd02761 (patch)
treec13b24e46cab3fbd8d53e454be968b44efaf3d50 /src
parent4350d195b636676ab55439551cc8fae5ee70fad3 (diff)
downloadfengari-48b7f1bbe33dee7785fdfa5bb7418191efd02761.tar.gz
fengari-48b7f1bbe33dee7785fdfa5bb7418191efd02761.tar.bz2
fengari-48b7f1bbe33dee7785fdfa5bb7418191efd02761.zip
Fixed bad lineinfo index in luaG_traceexec
Diffstat (limited to 'src')
-rw-r--r--src/ldebug.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ldebug.js b/src/ldebug.js
index 74a04db..ba1e6e3 100644
--- a/src/ldebug.js
+++ b/src/ldebug.js
@@ -625,11 +625,11 @@ const luaG_traceexec = function(L) {
ldo.luaD_hook(L, defs.LUA_HOOKCOUNT, -1); /* call count hook */
if (mask & defs.LUA_MASKLINE) {
let p = ci.func.value.p;
- let npc = ci.l_savedpc; // pcRel(ci.u.l.savedpc, p);
+ let npc = ci.l_savedpc - 1; // pcRel(ci.u.l.savedpc, p);
let newline = p.lineinfo.length !== 0 ? p.lineinfo[npc] : -1;
if (npc === 0 || /* call linehook when enter a new function, */
ci.l_savedpc <= L.oldpc || /* when jump back (loop), or when */
- newline !== p.lineinfo.length !== 0 ? p.lineinfo[L.oldpc] : -1) /* enter a new line */
+ newline !== p.lineinfo.length !== 0 ? p.lineinfo[L.oldpc - 1] : -1) /* enter a new line */
ldo.luaD_hook(L, defs.LUA_HOOKLINE, newline); /* call line hook */
}
L.oldpc = ci.l_savedpc;
@@ -638,7 +638,7 @@ const luaG_traceexec = function(L) {
L.hookcount = 1; /* undo decrement to zero */
ci.l_savedpc--; /* undo increment (resume will increment it again) */
ci.callstatus |= lstate.CIST_HOOKYIELD; /* mark that it yielded */
- ci.func = L.top - 1; /* protect stack below results */
+ ci.func = L.stack[L.top - 1]; /* protect stack below results */
ldo.luaD_throw(L, TS.LUA_YIELD);
}
};