aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2011-11-25 19:25:44 +0100
committerMike Pall <mike>2011-11-25 19:35:58 +0100
commitb3f16cb64d8eef247d3763eb90ece38810f29781 (patch)
treee66dcd807fc5dab764f5cfdf5bdeb820405cdcca
parent90c445851ffb697adc680c4ffd735d940536cfa5 (diff)
downloadluajit-b3f16cb64d8eef247d3763eb90ece38810f29781.tar.gz
luajit-b3f16cb64d8eef247d3763eb90ece38810f29781.tar.bz2
luajit-b3f16cb64d8eef247d3763eb90ece38810f29781.zip
FFI: Fix line info for result conversion errors in callbacks.
-rw-r--r--src/lj_ccallback.c2
-rw-r--r--src/lj_debug.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/lj_ccallback.c b/src/lj_ccallback.c
index 597b3c11..f8d95d39 100644
--- a/src/lj_ccallback.c
+++ b/src/lj_ccallback.c
@@ -377,7 +377,7 @@ void LJ_FASTCALL lj_ccallback_leave(CTState *cts, TValue *o)
377 fn = curr_func(L); 377 fn = curr_func(L);
378 if (isluafunc(fn)) { 378 if (isluafunc(fn)) {
379 GCproto *pt = funcproto(fn); 379 GCproto *pt = funcproto(fn);
380 setcframe_pc(L->cframe, proto_bc(pt)+pt->sizebc); 380 setcframe_pc(L->cframe, proto_bc(pt)+pt->sizebc+1);
381 } 381 }
382 callback_conv_result(cts, L, o); 382 callback_conv_result(cts, L, o);
383 /* Finally drop C frame and continuation frame. */ 383 /* Finally drop C frame and continuation frame. */
diff --git a/src/lj_debug.c b/src/lj_debug.c
index 4038e209..89434aaf 100644
--- a/src/lj_debug.c
+++ b/src/lj_debug.c
@@ -90,7 +90,7 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
90 pt = funcproto(fn); 90 pt = funcproto(fn);
91 pos = proto_bcpos(pt, ins) - 1; 91 pos = proto_bcpos(pt, ins) - 1;
92#if LJ_HASJIT 92#if LJ_HASJIT
93 if (pos >= pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */ 93 if (pos > pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */
94 GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins)); 94 GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins));
95 lua_assert(bc_isret(bc_op(ins[-1]))); 95 lua_assert(bc_isret(bc_op(ins[-1])));
96 pos = proto_bcpos(pt, mref(T->startpc, const BCIns)); 96 pos = proto_bcpos(pt, mref(T->startpc, const BCIns));
@@ -105,9 +105,9 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
105BCLine LJ_FASTCALL lj_debug_line(GCproto *pt, BCPos pc) 105BCLine LJ_FASTCALL lj_debug_line(GCproto *pt, BCPos pc)
106{ 106{
107 const void *lineinfo = proto_lineinfo(pt); 107 const void *lineinfo = proto_lineinfo(pt);
108 if (pc < pt->sizebc && lineinfo) { 108 if (pc <= pt->sizebc && lineinfo) {
109 BCLine first = pt->firstline; 109 BCLine first = pt->firstline;
110 if (pc == pt->sizebc-1) return first + pt->numline; 110 if (pc == pt->sizebc) return first + pt->numline;
111 if (pc-- == 0) return first; 111 if (pc-- == 0) return first;
112 if (pt->numline < 256) 112 if (pt->numline < 256)
113 return first + (BCLine)((const uint8_t *)lineinfo)[pc]; 113 return first + (BCLine)((const uint8_t *)lineinfo)[pc];