Save trace recorder state around VM event call.

Reported by Sergey Kaplun.
master
Mike Pall 2022-01-16 20:58:42 +01:00
parent c4dfb625ba
commit b5b20191f3
1 changed files with 5 additions and 1 deletions

View File

@ -587,9 +587,11 @@ static TValue *trace_state(lua_State *L, lua_CFunction dummy, void *ud)
trace_pendpatch(J, 0);
setvmstate(J2G(J), RECORD);
lj_vmevent_send_(L, RECORD,
/* Save/restore tmptv state for trace recorder. */
/* Save/restore state for trace recorder. */
TValue savetv = J2G(J)->tmptv;
TValue savetv2 = J2G(J)->tmptv2;
TraceNo parent = J->parent;
ExitNo exitno = J->exitno;
setintV(L->top++, J->cur.traceno);
setfuncV(L, L->top++, J->fn);
setintV(L->top++, J->pt ? (int32_t)proto_bcpos(J->pt, J->pc) : -1);
@ -597,6 +599,8 @@ static TValue *trace_state(lua_State *L, lua_CFunction dummy, void *ud)
,
J2G(J)->tmptv = savetv;
J2G(J)->tmptv2 = savetv2;
J->parent = parent;
J->exitno = exitno;
);
lj_record_ins(J);
break;