]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Save tmptv state for trace recorder across RECORD vmevent.
authorMike Pall <mike>
Thu, 13 Oct 2011 22:43:17 +0000 (00:43 +0200)
committerMike Pall <mike>
Thu, 13 Oct 2011 22:43:17 +0000 (00:43 +0200)
src/lj_trace.c
src/lj_vmevent.h

index afaeb3000f4af234c9944c4adf0e327e330ed1d2..5de43f23279b33489da85c06bc634254774f288f 100644 (file)
@@ -574,11 +574,18 @@ static TValue *trace_state(lua_State *L, lua_CFunction dummy, void *ud)
     case LJ_TRACE_RECORD:
       trace_pendpatch(J, 0);
       setvmstate(J2G(J), RECORD);
-      lj_vmevent_send(L, RECORD,
+      lj_vmevent_send_(L, RECORD,
+       TValue savetv;  /* Save tmptv state for trace recorder. */
+       TValue savetv2;
+       copyTV(L, &savetv, &J2G(J)->tmptv);
+       copyTV(L, &savetv2, &J2G(J)->tmptv2);
        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);
        setintV(L->top++, J->framedepth);
+      ,
+       copyTV(L, &J2G(J)->tmptv, &savetv);
+       copyTV(L, &J2G(J)->tmptv2, &savetv2);
       );
       lj_record_ins(J);
       break;
index 857e5be52701c1245802d1783988df933dd226e8..8a0822f2c5192b17b46bf0008beb8dc0dbb414ef 100644 (file)
@@ -31,7 +31,8 @@ typedef enum {
 } VMEvent;
 
 #ifdef LUAJIT_DISABLE_VMEVENT
-#define lj_vmevent_send(L, ev, args)   UNUSED(L)
+#define lj_vmevent_send(L, ev, args)           UNUSED(L)
+#define lj_vmevent_send_(L, ev, args, post)    UNUSED(L)
 #else
 #define lj_vmevent_send(L, ev, args) \
   if (G(L)->vmevmask & VMEVENT_MASK(LJ_VMEVENT_##ev)) { \
@@ -41,6 +42,15 @@ typedef enum {
       lj_vmevent_call(L, argbase); \
     } \
   }
+#define lj_vmevent_send_(L, ev, args, post) \
+  if (G(L)->vmevmask & VMEVENT_MASK(LJ_VMEVENT_##ev)) { \
+    ptrdiff_t argbase = lj_vmevent_prepare(L, LJ_VMEVENT_##ev); \
+    if (argbase) { \
+      args \
+      lj_vmevent_call(L, argbase); \
+      post \
+    } \
+  }
 
 LJ_FUNC ptrdiff_t lj_vmevent_prepare(lua_State *L, VMEvent ev);
 LJ_FUNC void lj_vmevent_call(lua_State *L, ptrdiff_t argbase);