ljx

FORK: LuaJIT with native 5.2 and 5.3 support
git clone https://git.neptards.moe/neptards/ljx.git
Log | Files | Refs | README

lj_trace.h (1651B)


      1 /*
      2 ** Trace management.
      3 ** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
      4 */
      5 
      6 #ifndef _LJ_TRACE_H
      7 #define _LJ_TRACE_H
      8 
      9 #include "lj_obj.h"
     10 
     11 #if LJ_HASJIT
     12 #include "lj_jit.h"
     13 #include "lj_dispatch.h"
     14 
     15 /* Trace errors. */
     16 typedef enum {
     17 #define TREDEF(name, msg)	LJ_TRERR_##name,
     18 #include "lj_traceerr.h"
     19   LJ_TRERR__MAX
     20 } TraceError;
     21 
     22 LJ_FUNC_NORET void lj_trace_err(jit_State *J, TraceError e);
     23 LJ_FUNC_NORET void lj_trace_err_info(jit_State *J, TraceError e);
     24 
     25 /* Trace management. */
     26 LJ_FUNC GCtrace * LJ_FASTCALL lj_trace_alloc(lua_State *L, GCtrace *T);
     27 LJ_FUNC void LJ_FASTCALL lj_trace_free(global_State *g, GCtrace *T);
     28 LJ_FUNC void lj_trace_reenableproto(GCproto *pt);
     29 LJ_FUNC void lj_trace_flushproto(global_State *g, GCproto *pt);
     30 LJ_FUNC void lj_trace_flush(jit_State *J, TraceNo traceno);
     31 LJ_FUNC int lj_trace_flushall(lua_State *L);
     32 LJ_FUNC void lj_trace_initstate(global_State *g);
     33 LJ_FUNC void lj_trace_freestate(global_State *g);
     34 
     35 /* Event handling. */
     36 LJ_FUNC void lj_trace_ins(jit_State *J, const BCIns *pc);
     37 LJ_FUNCA void LJ_FASTCALL lj_trace_hot(jit_State *J, const BCIns *pc);
     38 LJ_FUNCA void LJ_FASTCALL lj_trace_stitch(jit_State *J, const BCIns *pc);
     39 LJ_FUNCA int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr);
     40 
     41 /* Signal asynchronous abort of trace or end of trace. */
     42 #define lj_trace_abort(g)	(G2J(g)->state &= ~LJ_TRACE_ACTIVE)
     43 #define lj_trace_end(J)		(J->state = LJ_TRACE_END)
     44 
     45 #else
     46 
     47 #define lj_trace_flushall(L)	(UNUSED(L), 0)
     48 #define lj_trace_initstate(g)	UNUSED(g)
     49 #define lj_trace_freestate(g)	UNUSED(g)
     50 #define lj_trace_abort(g)	UNUSED(g)
     51 #define lj_trace_end(J)		UNUSED(J)
     52 
     53 #endif
     54 
     55 #endif