diff options
author | Mike Pall <mike> | 2010-02-16 04:04:16 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-02-16 04:04:16 +0100 |
commit | c225ee8db4300e1dbf13fcdfc15d8f44da175877 (patch) | |
tree | 529d92ad755f5753cc9c98ddb8d56ae9c3700e2c /src/lj_dispatch.c | |
parent | afa07e0c4645289c6c00541c653b190394b150a1 (diff) | |
download | luajit2-c225ee8db4300e1dbf13fcdfc15d8f44da175877.tar.gz |
Split CALL/FUNC recording.
Record __call resolving and specialization for CALL* bytecodes.
Record argument adjustment and fast functions for FUNC* bytecodes.
Avoids all pending/immediate decisions for chained fast functions.
Cleaner semantics for pcall(), xpcall() and __tostring metamethod.
Prerequisite to drop the shadow frame link stack again.
Diffstat (limited to 'src/lj_dispatch.c')
-rw-r--r-- | src/lj_dispatch.c | 11 |
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) uint8_t mode = 0; #if LJ_HASJIT mode |= (G2J(g)->flags & JIT_F_ON) ? DISPMODE_JIT : 0; - mode |= G2J(g)->state != LJ_TRACE_IDLE ? (DISPMODE_REC|DISPMODE_INS) : 0; + mode |= G2J(g)->state != LJ_TRACE_IDLE ? + (DISPMODE_REC|DISPMODE_INS|DISPMODE_CALL) : 0; #endif mode |= (g->hookmask & (LUA_MASKLINE|LUA_MASKCOUNT)) ? DISPMODE_INS : 0; mode |= (g->hookmask & LUA_MASKCALL) ? DISPMODE_CALL : 0; @@ -398,7 +399,7 @@ static void call_init(lua_State *L, GCfunc *fn) } } -/* Call dispatch. Used by call hooks and hot calls. */ +/* Call dispatch. Used by call hooks, hot calls or when recording. */ ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns *pc) { GCfunc *fn = curr_func(L); @@ -409,10 +410,14 @@ ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns *pc) #endif call_init(L, fn); #if LJ_HASJIT + J->L = L; if ((uintptr_t)pc & 1) { /* Marker for hot call. */ - J->L = L; lj_trace_hot(J, (const BCIns *)((uintptr_t)pc & ~(uintptr_t)1)); goto out; + } else if (J->state != LJ_TRACE_IDLE && + !(g->hookmask & (HOOK_GC|HOOK_VMEVENT))) { + /* Record the FUNC* bytecodes, too. */ + lj_trace_ins(J, pc-1); /* The interpreter bytecode PC is offset by 1. */ } #endif if ((g->hookmask & LUA_MASKCALL)) |