aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2011-10-14 00:43:17 +0200
committerMike Pall <mike>2011-10-14 00:43:17 +0200
commit4c9318792f455c776a840ad2cf011db152ff48e9 (patch)
treedf39f5d7984cd71d90417967216c97734df662b4 /src
parent882537a8744a75681355fb520923e6e867f99d23 (diff)
downloadluajit-4c9318792f455c776a840ad2cf011db152ff48e9.tar.gz
luajit-4c9318792f455c776a840ad2cf011db152ff48e9.tar.bz2
luajit-4c9318792f455c776a840ad2cf011db152ff48e9.zip
Save tmptv state for trace recorder across RECORD vmevent.
Diffstat (limited to 'src')
-rw-r--r--src/lj_trace.c9
-rw-r--r--src/lj_vmevent.h12
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
45LJ_FUNC ptrdiff_t lj_vmevent_prepare(lua_State *L, VMEvent ev); 55LJ_FUNC ptrdiff_t lj_vmevent_prepare(lua_State *L, VMEvent ev);
46LJ_FUNC void lj_vmevent_call(lua_State *L, ptrdiff_t argbase); 56LJ_FUNC void lj_vmevent_call(lua_State *L, ptrdiff_t argbase);