summaryrefslogtreecommitdiff
path: root/src/lj_dispatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_dispatch.c')
-rw-r--r--src/lj_dispatch.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lj_dispatch.c b/src/lj_dispatch.c
index 29b06438..4629fb7e 100644
--- a/src/lj_dispatch.c
+++ b/src/lj_dispatch.c
@@ -71,7 +71,8 @@ void lj_dispatch_update(global_State *g)
71 uint8_t mode = 0; 71 uint8_t mode = 0;
72#if LJ_HASJIT 72#if LJ_HASJIT
73 mode |= (G2J(g)->flags & JIT_F_ON) ? DISPMODE_JIT : 0; 73 mode |= (G2J(g)->flags & JIT_F_ON) ? DISPMODE_JIT : 0;
74 mode |= G2J(g)->state != LJ_TRACE_IDLE ? (DISPMODE_REC|DISPMODE_INS) : 0; 74 mode |= G2J(g)->state != LJ_TRACE_IDLE ?
75 (DISPMODE_REC|DISPMODE_INS|DISPMODE_CALL) : 0;
75#endif 76#endif
76 mode |= (g->hookmask & (LUA_MASKLINE|LUA_MASKCOUNT)) ? DISPMODE_INS : 0; 77 mode |= (g->hookmask & (LUA_MASKLINE|LUA_MASKCOUNT)) ? DISPMODE_INS : 0;
77 mode |= (g->hookmask & LUA_MASKCALL) ? DISPMODE_CALL : 0; 78 mode |= (g->hookmask & LUA_MASKCALL) ? DISPMODE_CALL : 0;
@@ -398,7 +399,7 @@ static void call_init(lua_State *L, GCfunc *fn)
398 } 399 }
399} 400}
400 401
401/* Call dispatch. Used by call hooks and hot calls. */ 402/* Call dispatch. Used by call hooks, hot calls or when recording. */
402ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns *pc) 403ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns *pc)
403{ 404{
404 GCfunc *fn = curr_func(L); 405 GCfunc *fn = curr_func(L);
@@ -409,10 +410,14 @@ ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns *pc)
409#endif 410#endif
410 call_init(L, fn); 411 call_init(L, fn);
411#if LJ_HASJIT 412#if LJ_HASJIT
413 J->L = L;
412 if ((uintptr_t)pc & 1) { /* Marker for hot call. */ 414 if ((uintptr_t)pc & 1) { /* Marker for hot call. */
413 J->L = L;
414 lj_trace_hot(J, (const BCIns *)((uintptr_t)pc & ~(uintptr_t)1)); 415 lj_trace_hot(J, (const BCIns *)((uintptr_t)pc & ~(uintptr_t)1));
415 goto out; 416 goto out;
417 } else if (J->state != LJ_TRACE_IDLE &&
418 !(g->hookmask & (HOOK_GC|HOOK_VMEVENT))) {
419 /* Record the FUNC* bytecodes, too. */
420 lj_trace_ins(J, pc-1); /* The interpreter bytecode PC is offset by 1. */
416 } 421 }
417#endif 422#endif
418 if ((g->hookmask & LUA_MASKCALL)) 423 if ((g->hookmask & LUA_MASKCALL))