diff options
| -rw-r--r-- | src/lj_trace.c | 9 | ||||
| -rw-r--r-- | src/lj_vmevent.h | 12 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/lj_trace.c b/src/lj_trace.c index afaeb300..5de43f23 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c | |||
| @@ -574,11 +574,18 @@ static TValue *trace_state(lua_State *L, lua_CFunction dummy, void *ud) | |||
| 574 | case LJ_TRACE_RECORD: | 574 | case LJ_TRACE_RECORD: |
| 575 | trace_pendpatch(J, 0); | 575 | trace_pendpatch(J, 0); |
| 576 | setvmstate(J2G(J), RECORD); | 576 | setvmstate(J2G(J), RECORD); |
| 577 | lj_vmevent_send(L, RECORD, | 577 | lj_vmevent_send_(L, RECORD, |
| 578 | TValue savetv; /* Save tmptv state for trace recorder. */ | ||
| 579 | TValue savetv2; | ||
| 580 | copyTV(L, &savetv, &J2G(J)->tmptv); | ||
| 581 | copyTV(L, &savetv2, &J2G(J)->tmptv2); | ||
| 578 | setintV(L->top++, J->cur.traceno); | 582 | setintV(L->top++, J->cur.traceno); |
| 579 | setfuncV(L, L->top++, J->fn); | 583 | setfuncV(L, L->top++, J->fn); |
| 580 | setintV(L->top++, J->pt ? (int32_t)proto_bcpos(J->pt, J->pc) : -1); | 584 | setintV(L->top++, J->pt ? (int32_t)proto_bcpos(J->pt, J->pc) : -1); |
| 581 | setintV(L->top++, J->framedepth); | 585 | setintV(L->top++, J->framedepth); |
| 586 | , | ||
| 587 | copyTV(L, &J2G(J)->tmptv, &savetv); | ||
| 588 | copyTV(L, &J2G(J)->tmptv2, &savetv2); | ||
| 582 | ); | 589 | ); |
| 583 | lj_record_ins(J); | 590 | lj_record_ins(J); |
| 584 | break; | 591 | break; |
diff --git a/src/lj_vmevent.h b/src/lj_vmevent.h index 857e5be5..8a0822f2 100644 --- a/src/lj_vmevent.h +++ b/src/lj_vmevent.h | |||
| @@ -31,7 +31,8 @@ typedef enum { | |||
| 31 | } VMEvent; | 31 | } VMEvent; |
| 32 | 32 | ||
| 33 | #ifdef LUAJIT_DISABLE_VMEVENT | 33 | #ifdef LUAJIT_DISABLE_VMEVENT |
| 34 | #define lj_vmevent_send(L, ev, args) UNUSED(L) | 34 | #define lj_vmevent_send(L, ev, args) UNUSED(L) |
| 35 | #define lj_vmevent_send_(L, ev, args, post) UNUSED(L) | ||
| 35 | #else | 36 | #else |
| 36 | #define lj_vmevent_send(L, ev, args) \ | 37 | #define lj_vmevent_send(L, ev, args) \ |
| 37 | if (G(L)->vmevmask & VMEVENT_MASK(LJ_VMEVENT_##ev)) { \ | 38 | if (G(L)->vmevmask & VMEVENT_MASK(LJ_VMEVENT_##ev)) { \ |
| @@ -41,6 +42,15 @@ typedef enum { | |||
| 41 | lj_vmevent_call(L, argbase); \ | 42 | lj_vmevent_call(L, argbase); \ |
| 42 | } \ | 43 | } \ |
| 43 | } | 44 | } |
| 45 | #define lj_vmevent_send_(L, ev, args, post) \ | ||
| 46 | if (G(L)->vmevmask & VMEVENT_MASK(LJ_VMEVENT_##ev)) { \ | ||
| 47 | ptrdiff_t argbase = lj_vmevent_prepare(L, LJ_VMEVENT_##ev); \ | ||
| 48 | if (argbase) { \ | ||
| 49 | args \ | ||
| 50 | lj_vmevent_call(L, argbase); \ | ||
| 51 | post \ | ||
| 52 | } \ | ||
| 53 | } | ||
| 44 | 54 | ||
| 45 | LJ_FUNC ptrdiff_t lj_vmevent_prepare(lua_State *L, VMEvent ev); | 55 | LJ_FUNC ptrdiff_t lj_vmevent_prepare(lua_State *L, VMEvent ev); |
| 46 | LJ_FUNC void lj_vmevent_call(lua_State *L, ptrdiff_t argbase); | 56 | LJ_FUNC void lj_vmevent_call(lua_State *L, ptrdiff_t argbase); |
