diff options
author | David Walter Seikel | 2014-01-13 21:08:31 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-01-13 21:08:31 +1000 |
commit | 637177eb1397ef1800027bccd50dbdc1af29a15b (patch) | |
tree | 3670a48303d05fceb8bf3ec4ee2901b72fe62d4d /libraries/luajit-2.0/src/lj_dispatch.h | |
parent | Update Irrlicht to 1.8.1. Include actual change markers this time. lol (diff) | |
download | SledjHamr-637177eb1397ef1800027bccd50dbdc1af29a15b.zip SledjHamr-637177eb1397ef1800027bccd50dbdc1af29a15b.tar.gz SledjHamr-637177eb1397ef1800027bccd50dbdc1af29a15b.tar.bz2 SledjHamr-637177eb1397ef1800027bccd50dbdc1af29a15b.tar.xz |
Remove LuaJIT source, we can use packaged LuaJIT 2.0 release now.
Also some cleanups related to the other library removals.
Diffstat (limited to 'libraries/luajit-2.0/src/lj_dispatch.h')
-rw-r--r-- | libraries/luajit-2.0/src/lj_dispatch.h | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/libraries/luajit-2.0/src/lj_dispatch.h b/libraries/luajit-2.0/src/lj_dispatch.h deleted file mode 100644 index c50d33a..0000000 --- a/libraries/luajit-2.0/src/lj_dispatch.h +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | /* | ||
2 | ** Instruction dispatch handling. | ||
3 | ** Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h | ||
4 | */ | ||
5 | |||
6 | #ifndef _LJ_DISPATCH_H | ||
7 | #define _LJ_DISPATCH_H | ||
8 | |||
9 | #include "lj_obj.h" | ||
10 | #include "lj_bc.h" | ||
11 | #if LJ_HASJIT | ||
12 | #include "lj_jit.h" | ||
13 | #endif | ||
14 | |||
15 | /* Type of hot counter. Must match the code in the assembler VM. */ | ||
16 | /* 16 bits are sufficient. Only 0.0015% overhead with maximum slot penalty. */ | ||
17 | typedef uint16_t HotCount; | ||
18 | |||
19 | /* Number of hot counter hash table entries (must be a power of two). */ | ||
20 | #define HOTCOUNT_SIZE 64 | ||
21 | #define HOTCOUNT_PCMASK ((HOTCOUNT_SIZE-1)*sizeof(HotCount)) | ||
22 | |||
23 | /* Hotcount decrements. */ | ||
24 | #define HOTCOUNT_LOOP 2 | ||
25 | #define HOTCOUNT_CALL 1 | ||
26 | |||
27 | /* This solves a circular dependency problem -- bump as needed. Sigh. */ | ||
28 | #define GG_NUM_ASMFF 62 | ||
29 | |||
30 | #define GG_LEN_DDISP (BC__MAX + GG_NUM_ASMFF) | ||
31 | #define GG_LEN_SDISP BC_FUNCF | ||
32 | #define GG_LEN_DISP (GG_LEN_DDISP + GG_LEN_SDISP) | ||
33 | |||
34 | /* Global state, main thread and extra fields are allocated together. */ | ||
35 | typedef struct GG_State { | ||
36 | lua_State L; /* Main thread. */ | ||
37 | global_State g; /* Global state. */ | ||
38 | #if LJ_HASJIT | ||
39 | jit_State J; /* JIT state. */ | ||
40 | HotCount hotcount[HOTCOUNT_SIZE]; /* Hot counters. */ | ||
41 | #endif | ||
42 | ASMFunction dispatch[GG_LEN_DISP]; /* Instruction dispatch tables. */ | ||
43 | BCIns bcff[GG_NUM_ASMFF]; /* Bytecode for ASM fast functions. */ | ||
44 | } GG_State; | ||
45 | |||
46 | #define GG_OFS(field) ((int)offsetof(GG_State, field)) | ||
47 | #define G2GG(gl) ((GG_State *)((char *)(gl) - GG_OFS(g))) | ||
48 | #define J2GG(j) ((GG_State *)((char *)(j) - GG_OFS(J))) | ||
49 | #define L2GG(L) (G2GG(G(L))) | ||
50 | #define J2G(J) (&J2GG(J)->g) | ||
51 | #define G2J(gl) (&G2GG(gl)->J) | ||
52 | #define L2J(L) (&L2GG(L)->J) | ||
53 | #define GG_G2DISP (GG_OFS(dispatch) - GG_OFS(g)) | ||
54 | #define GG_DISP2G (GG_OFS(g) - GG_OFS(dispatch)) | ||
55 | #define GG_DISP2J (GG_OFS(J) - GG_OFS(dispatch)) | ||
56 | #define GG_DISP2HOT (GG_OFS(hotcount) - GG_OFS(dispatch)) | ||
57 | #define GG_DISP2STATIC (GG_LEN_DDISP*(int)sizeof(ASMFunction)) | ||
58 | |||
59 | #define hotcount_get(gg, pc) \ | ||
60 | (gg)->hotcount[(u32ptr(pc)>>2) & (HOTCOUNT_SIZE-1)] | ||
61 | #define hotcount_set(gg, pc, val) \ | ||
62 | (hotcount_get((gg), (pc)) = (HotCount)(val)) | ||
63 | |||
64 | /* Dispatch table management. */ | ||
65 | LJ_FUNC void lj_dispatch_init(GG_State *GG); | ||
66 | #if LJ_HASJIT | ||
67 | LJ_FUNC void lj_dispatch_init_hotcount(global_State *g); | ||
68 | #endif | ||
69 | LJ_FUNC void lj_dispatch_update(global_State *g); | ||
70 | |||
71 | /* Instruction dispatch callback for hooks or when recording. */ | ||
72 | LJ_FUNCA void LJ_FASTCALL lj_dispatch_ins(lua_State *L, const BCIns *pc); | ||
73 | LJ_FUNCA ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns*pc); | ||
74 | LJ_FUNCA void LJ_FASTCALL lj_dispatch_return(lua_State *L, const BCIns *pc); | ||
75 | |||
76 | #if LJ_HASFFI && !defined(_BUILDVM_H) | ||
77 | /* Save/restore errno and GetLastError() around hooks, exits and recording. */ | ||
78 | #include <errno.h> | ||
79 | #if LJ_TARGET_WINDOWS | ||
80 | #define WIN32_LEAN_AND_MEAN | ||
81 | #include <windows.h> | ||
82 | #define ERRNO_SAVE int olderr = errno; DWORD oldwerr = GetLastError(); | ||
83 | #define ERRNO_RESTORE errno = olderr; SetLastError(oldwerr); | ||
84 | #else | ||
85 | #define ERRNO_SAVE int olderr = errno; | ||
86 | #define ERRNO_RESTORE errno = olderr; | ||
87 | #endif | ||
88 | #else | ||
89 | #define ERRNO_SAVE | ||
90 | #define ERRNO_RESTORE | ||
91 | #endif | ||
92 | |||
93 | #endif | ||