diff --git a/src/jit/dump.lua b/src/jit/dump.lua index a8bc2af2..1adf7095 100644 --- a/src/jit/dump.lua +++ b/src/jit/dump.lua @@ -556,7 +556,7 @@ local function dump_trace(what, tr, func, pc, otr, oex) if what == "start" then if dumpmode.H then out:write('
\n') end out:write("---- TRACE ", tr, " ", what) - if otr then out:write(" ", otr, "/", oex) end + if otr then out:write(" ", otr, "/", oex == -1 and "stitch" or oex) end out:write(" ", fmtfunc(func, pc), "\n") elseif what == "stop" or what == "abort" then out:write("---- TRACE ", tr, " ", what) diff --git a/src/jit/v.lua b/src/jit/v.lua index 60c8b05a..b07ec7c0 100644 --- a/src/jit/v.lua +++ b/src/jit/v.lua @@ -99,7 +99,7 @@ end local function dump_trace(what, tr, func, pc, otr, oex) if what == "start" then startloc = fmtfunc(func, pc) - startex = otr and "("..otr.."/"..oex..") " or "" + startex = otr and "("..otr.."/"..(oex == -1 and "stitch" or oex)..") " or "" else if what == "abort" then local loc = fmtfunc(func, pc) diff --git a/src/lj_trace.c b/src/lj_trace.c index 87146832..11e54d97 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c @@ -446,6 +446,12 @@ static void trace_start(jit_State *J) if (J->parent) { setintV(L->top++, J->parent); setintV(L->top++, J->exitno); + } else { + BCOp op = bc_op(*J->pc); + if (op == BC_CALLM || op == BC_CALL || op == BC_ITERC) { + setintV(L->top++, J->exitno); /* Parent of stitched trace. */ + setintV(L->top++, -1); + } } ); lj_record_setup(J);