2009-12-08 18:46:35 +00:00
|
|
|
/*
|
|
|
|
** Trace management.
|
2016-03-03 11:02:22 +00:00
|
|
|
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
|
2009-12-08 18:46:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LJ_TRACE_H
|
|
|
|
#define _LJ_TRACE_H
|
|
|
|
|
|
|
|
#include "lj_obj.h"
|
2010-11-30 17:32:22 +00:00
|
|
|
|
|
|
|
#if LJ_HASJIT
|
2009-12-08 18:46:35 +00:00
|
|
|
#include "lj_jit.h"
|
|
|
|
#include "lj_dispatch.h"
|
|
|
|
|
|
|
|
/* Trace errors. */
|
|
|
|
typedef enum {
|
|
|
|
#define TREDEF(name, msg) LJ_TRERR_##name,
|
|
|
|
#include "lj_traceerr.h"
|
|
|
|
LJ_TRERR__MAX
|
|
|
|
} TraceError;
|
|
|
|
|
|
|
|
LJ_FUNC_NORET void lj_trace_err(jit_State *J, TraceError e);
|
|
|
|
LJ_FUNC_NORET void lj_trace_err_info(jit_State *J, TraceError e);
|
|
|
|
|
|
|
|
/* Trace management. */
|
2010-04-25 01:32:29 +00:00
|
|
|
LJ_FUNC void LJ_FASTCALL lj_trace_free(global_State *g, GCtrace *T);
|
2009-12-08 18:46:35 +00:00
|
|
|
LJ_FUNC void lj_trace_reenableproto(GCproto *pt);
|
|
|
|
LJ_FUNC void lj_trace_flushproto(global_State *g, GCproto *pt);
|
2010-04-25 01:32:29 +00:00
|
|
|
LJ_FUNC void lj_trace_flush(jit_State *J, TraceNo traceno);
|
2009-12-08 18:46:35 +00:00
|
|
|
LJ_FUNC int lj_trace_flushall(lua_State *L);
|
2010-02-24 22:17:17 +00:00
|
|
|
LJ_FUNC void lj_trace_initstate(global_State *g);
|
2009-12-08 18:46:35 +00:00
|
|
|
LJ_FUNC void lj_trace_freestate(global_State *g);
|
|
|
|
|
|
|
|
/* Event handling. */
|
2010-02-15 15:41:52 +00:00
|
|
|
LJ_FUNC void lj_trace_ins(jit_State *J, const BCIns *pc);
|
2009-12-27 16:42:41 +00:00
|
|
|
LJ_FUNCA void LJ_FASTCALL lj_trace_hot(jit_State *J, const BCIns *pc);
|
2013-12-25 01:55:25 +00:00
|
|
|
LJ_FUNCA void LJ_FASTCALL lj_trace_stitch(jit_State *J, const BCIns *pc);
|
2010-02-19 02:13:48 +00:00
|
|
|
LJ_FUNCA int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr);
|
2009-12-08 18:46:35 +00:00
|
|
|
|
|
|
|
/* Signal asynchronous abort of trace or end of trace. */
|
|
|
|
#define lj_trace_abort(g) (G2J(g)->state &= ~LJ_TRACE_ACTIVE)
|
|
|
|
#define lj_trace_end(J) (J->state = LJ_TRACE_END)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define lj_trace_flushall(L) (UNUSED(L), 0)
|
2010-02-24 22:17:17 +00:00
|
|
|
#define lj_trace_initstate(g) UNUSED(g)
|
2009-12-08 18:46:35 +00:00
|
|
|
#define lj_trace_freestate(g) UNUSED(g)
|
|
|
|
#define lj_trace_abort(g) UNUSED(g)
|
|
|
|
#define lj_trace_end(J) UNUSED(J)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|