summaryrefslogtreecommitdiff
path: root/src/lj_dispatch.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_dispatch.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/lj_dispatch.h b/src/lj_dispatch.h
index cb5e5f64..bbbfa0be 100644
--- a/src/lj_dispatch.h
+++ b/src/lj_dispatch.h
@@ -7,7 +7,6 @@
7#define _LJ_DISPATCH_H 7#define _LJ_DISPATCH_H
8 8
9#include "lj_obj.h" 9#include "lj_obj.h"
10#include "lj_bc.h"
11#if LJ_HASJIT 10#if LJ_HASJIT
12#include "lj_jit.h" 11#include "lj_jit.h"
13#endif 12#endif
@@ -30,24 +29,22 @@ typedef struct GG_State {
30 jit_State J; /* JIT state. */ 29 jit_State J; /* JIT state. */
31 HotCount hotcount[HOTCOUNT_SIZE]; /* Hot counters. */ 30 HotCount hotcount[HOTCOUNT_SIZE]; /* Hot counters. */
32#endif 31#endif
33 ASMFunction dispatch[2*BC__MAX]; /* Instruction dispatch tables. */ 32 /* Instruction dispatch tables follow. */
34} GG_State; 33} GG_State;
35 34
36#define GG_DISP_STATIC BC__MAX
37
38#define GG_OFS(field) ((int)offsetof(GG_State, field)) 35#define GG_OFS(field) ((int)offsetof(GG_State, field))
39#define G2GG(gl) \ 36#define GG_OFS_DISP ((int)sizeof(GG_State))
40 ((GG_State *)(((char *)(gl))-((char *)(&((GG_State *)0)->g)))) 37#define GG2DISP(gg) ((ASMFunction *)((char *)(gg) + GG_OFS_DISP))
41#define J2GG(j) \ 38#define G2GG(gl) ((GG_State *)((char *)(gl) - GG_OFS(g)))
42 ((GG_State *)(((char *)(j))-((char *)(&((GG_State *)0)->J)))) 39#define J2GG(j) ((GG_State *)((char *)(j) - GG_OFS(J)))
43#define L2GG(L) G2GG(G(L)) 40#define L2GG(L) (G2GG(G(L)))
44#define J2G(J) (&J2GG(J)->g) 41#define J2G(J) (&J2GG(J)->g)
45#define G2J(gl) (&G2GG(gl)->J) 42#define G2J(gl) (&G2GG(gl)->J)
46#define L2J(L) (&L2GG(L)->J) 43#define L2J(L) (&L2GG(L)->J)
47#define GG_G2DISP (GG_OFS(dispatch) - GG_OFS(g)) 44#define GG_G2DISP (GG_OFS_DISP - GG_OFS(g))
48#define GG_DISP2G (GG_OFS(g) - GG_OFS(dispatch)) 45#define GG_DISP2G (GG_OFS(g) - GG_OFS_DISP)
49#define GG_DISP2J (GG_OFS(J) - GG_OFS(dispatch)) 46#define GG_DISP2J (GG_OFS(J) - GG_OFS_DISP)
50#define GG_DISP2HOT (GG_OFS(hotcount) - GG_OFS(dispatch)) 47#define GG_DISP2HOT (GG_OFS(hotcount) - GG_OFS_DISP)
51 48
52#define hotcount_get(gg, pc) \ 49#define hotcount_get(gg, pc) \
53 (gg)->hotcount[(u32ptr(pc)>>2) & (HOTCOUNT_SIZE-1)] 50 (gg)->hotcount[(u32ptr(pc)>>2) & (HOTCOUNT_SIZE-1)]