Add trace stitching.
This commit is contained in:
@@ -42,6 +42,12 @@ LJ_STATIC_ASSERT(GG_NUM_ASMFF == FF_NUM_ASMFUNC);
|
||||
#include <math.h>
|
||||
LJ_FUNCA_NORET void LJ_FASTCALL lj_ffh_coroutine_wrap_err(lua_State *L,
|
||||
lua_State *co);
|
||||
#if !LJ_HASJIT
|
||||
#define lj_dispatch_stitch lj_dispatch_ins
|
||||
#endif
|
||||
#if !LJ_HASPROFILE
|
||||
#define lj_dispatch_profile lj_dispatch_ins
|
||||
#endif
|
||||
|
||||
#define GOTFUNC(name) (ASMFunction)name,
|
||||
static const ASMFunction dispatch_got[] = {
|
||||
@@ -511,6 +517,23 @@ out:
|
||||
return makeasmfunc(lj_bc_ofs[op]); /* Return static dispatch target. */
|
||||
}
|
||||
|
||||
#if LJ_HASJIT
|
||||
/* Stitch a new trace. */
|
||||
void LJ_FASTCALL lj_dispatch_stitch(jit_State *J, const BCIns *pc)
|
||||
{
|
||||
ERRNO_SAVE
|
||||
lua_State *L = J->L;
|
||||
void *cf = cframe_raw(L->cframe);
|
||||
const BCIns *oldpc = cframe_pc(cf);
|
||||
setcframe_pc(cf, pc);
|
||||
/* Before dispatch, have to bias PC by 1. */
|
||||
L->top = L->base + cur_topslot(curr_proto(L), pc+1, cframe_multres_n(cf));
|
||||
lj_trace_stitch(J, pc-1); /* Point to the CALL instruction. */
|
||||
setcframe_pc(cf, oldpc);
|
||||
ERRNO_RESTORE
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LJ_HASPROFILE
|
||||
/* Profile dispatch. */
|
||||
void LJ_FASTCALL lj_dispatch_profile(lua_State *L, const BCIns *pc)
|
||||
|
||||
Reference in New Issue
Block a user