diff options
author | David Walter Seikel | 2012-01-23 23:36:30 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 23:36:30 +1000 |
commit | 6523585c66c04cea54df50013df8886b589847d8 (patch) | |
tree | 0b22aee7064166d88595eda260ca2d17c0773da5 /libraries/luajit-2.0/src/lj_arch.h | |
parent | Update the EFL to what I'm actually using, coz I'm using some stuff not yet r... (diff) | |
download | SledjHamr-6523585c66c04cea54df50013df8886b589847d8.zip SledjHamr-6523585c66c04cea54df50013df8886b589847d8.tar.gz SledjHamr-6523585c66c04cea54df50013df8886b589847d8.tar.bz2 SledjHamr-6523585c66c04cea54df50013df8886b589847d8.tar.xz |
Add luaproc and LuaJIT libraries.
Two versions of LuaJIT, the stable release, and the dev version. Try the dev version first, until ih fails badly.
Diffstat (limited to '')
-rw-r--r-- | libraries/luajit-2.0/src/lj_arch.h | 324 |
1 files changed, 324 insertions, 0 deletions
diff --git a/libraries/luajit-2.0/src/lj_arch.h b/libraries/luajit-2.0/src/lj_arch.h new file mode 100644 index 0000000..3a52c21 --- /dev/null +++ b/libraries/luajit-2.0/src/lj_arch.h | |||
@@ -0,0 +1,324 @@ | |||
1 | /* | ||
2 | ** Target architecture selection. | ||
3 | ** Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h | ||
4 | */ | ||
5 | |||
6 | #ifndef _LJ_ARCH_H | ||
7 | #define _LJ_ARCH_H | ||
8 | |||
9 | #include "lua.h" | ||
10 | |||
11 | /* Target endianess. */ | ||
12 | #define LUAJIT_LE 0 | ||
13 | #define LUAJIT_BE 1 | ||
14 | |||
15 | /* Target architectures. */ | ||
16 | #define LUAJIT_ARCH_X86 1 | ||
17 | #define LUAJIT_ARCH_x86 1 | ||
18 | #define LUAJIT_ARCH_X64 2 | ||
19 | #define LUAJIT_ARCH_x64 2 | ||
20 | #define LUAJIT_ARCH_ARM 3 | ||
21 | #define LUAJIT_ARCH_arm 3 | ||
22 | #define LUAJIT_ARCH_PPC 4 | ||
23 | #define LUAJIT_ARCH_ppc 4 | ||
24 | #define LUAJIT_ARCH_PPCSPE 5 | ||
25 | #define LUAJIT_ARCH_ppcspe 5 | ||
26 | #define LUAJIT_ARCH_MIPS 6 | ||
27 | #define LUAJIT_ARCH_mips 6 | ||
28 | |||
29 | /* Target OS. */ | ||
30 | #define LUAJIT_OS_OTHER 0 | ||
31 | #define LUAJIT_OS_WINDOWS 1 | ||
32 | #define LUAJIT_OS_LINUX 2 | ||
33 | #define LUAJIT_OS_OSX 3 | ||
34 | #define LUAJIT_OS_BSD 4 | ||
35 | #define LUAJIT_OS_POSIX 5 | ||
36 | |||
37 | /* Select native target if no target defined. */ | ||
38 | #ifndef LUAJIT_TARGET | ||
39 | |||
40 | #if defined(__i386) || defined(__i386__) || defined(_M_IX86) | ||
41 | #define LUAJIT_TARGET LUAJIT_ARCH_X86 | ||
42 | #elif defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64) | ||
43 | #define LUAJIT_TARGET LUAJIT_ARCH_X64 | ||
44 | #elif defined(__arm__) || defined(__arm) || defined(__ARM__) || defined(__ARM) | ||
45 | #define LUAJIT_TARGET LUAJIT_ARCH_ARM | ||
46 | #elif defined(__ppc__) || defined(__ppc) || defined(__PPC__) || defined(__PPC) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(__POWERPC) || defined(_M_PPC) | ||
47 | #ifdef __NO_FPRS__ | ||
48 | #define LUAJIT_TARGET LUAJIT_ARCH_PPCSPE | ||
49 | #else | ||
50 | #define LUAJIT_TARGET LUAJIT_ARCH_PPC | ||
51 | #endif | ||
52 | #elif defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(__MIPS) | ||
53 | #define LUAJIT_TARGET LUAJIT_ARCH_MIPS | ||
54 | #else | ||
55 | #error "No support for this architecture (yet)" | ||
56 | #endif | ||
57 | |||
58 | #endif | ||
59 | |||
60 | /* Select native OS if no target OS defined. */ | ||
61 | #ifndef LUAJIT_OS | ||
62 | |||
63 | #if defined(_WIN32) | ||
64 | #define LUAJIT_OS LUAJIT_OS_WINDOWS | ||
65 | #elif defined(__linux__) | ||
66 | #define LUAJIT_OS LUAJIT_OS_LINUX | ||
67 | #elif defined(__MACH__) && defined(__APPLE__) | ||
68 | #define LUAJIT_OS LUAJIT_OS_OSX | ||
69 | #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ | ||
70 | defined(__NetBSD__) || defined(__OpenBSD__) | ||
71 | #define LUAJIT_OS LUAJIT_OS_BSD | ||
72 | #elif (defined(__sun__) && defined(__svr4__)) || defined(__solaris__) || \ | ||
73 | defined(__CYGWIN__) | ||
74 | #define LUAJIT_OS LUAJIT_OS_POSIX | ||
75 | #else | ||
76 | #define LUAJIT_OS LUAJIT_OS_OTHER | ||
77 | #endif | ||
78 | |||
79 | #endif | ||
80 | |||
81 | /* Set target OS properties. */ | ||
82 | #if LUAJIT_OS == LUAJIT_OS_WINDOWS | ||
83 | #define LJ_OS_NAME "Windows" | ||
84 | #elif LUAJIT_OS == LUAJIT_OS_LINUX | ||
85 | #define LJ_OS_NAME "Linux" | ||
86 | #elif LUAJIT_OS == LUAJIT_OS_OSX | ||
87 | #define LJ_OS_NAME "OSX" | ||
88 | #elif LUAJIT_OS == LUAJIT_OS_BSD | ||
89 | #define LJ_OS_NAME "BSD" | ||
90 | #elif LUAJIT_OS == LUAJIT_OS_POSIX | ||
91 | #define LJ_OS_NAME "POSIX" | ||
92 | #else | ||
93 | #define LJ_OS_NAME "Other" | ||
94 | #endif | ||
95 | |||
96 | #define LJ_TARGET_WINDOWS (LUAJIT_OS == LUAJIT_OS_WINDOWS) | ||
97 | #define LJ_TARGET_LINUX (LUAJIT_OS == LUAJIT_OS_LINUX) | ||
98 | #define LJ_TARGET_OSX (LUAJIT_OS == LUAJIT_OS_OSX) | ||
99 | #define LJ_TARGET_POSIX (LUAJIT_OS > LUAJIT_OS_WINDOWS) | ||
100 | #define LJ_TARGET_DLOPEN LJ_TARGET_POSIX | ||
101 | |||
102 | #define LJ_NUMMODE_SINGLE 0 /* Single-number mode only. */ | ||
103 | #define LJ_NUMMODE_SINGLE_DUAL 1 /* Default to single-number mode. */ | ||
104 | #define LJ_NUMMODE_DUAL 2 /* Dual-number mode only. */ | ||
105 | #define LJ_NUMMODE_DUAL_SINGLE 3 /* Default to dual-number mode. */ | ||
106 | |||
107 | /* Set target architecture properties. */ | ||
108 | #if LUAJIT_TARGET == LUAJIT_ARCH_X86 | ||
109 | |||
110 | #define LJ_ARCH_NAME "x86" | ||
111 | #define LJ_ARCH_BITS 32 | ||
112 | #define LJ_ARCH_ENDIAN LUAJIT_LE | ||
113 | #define LJ_ARCH_HASFPU 1 | ||
114 | #define LJ_ABI_WIN LJ_TARGET_WINDOWS | ||
115 | #define LJ_TARGET_X86 1 | ||
116 | #define LJ_TARGET_X86ORX64 1 | ||
117 | #define LJ_TARGET_EHRETREG 0 | ||
118 | #define LJ_TARGET_MASKSHIFT 1 | ||
119 | #define LJ_TARGET_MASKROT 1 | ||
120 | #define LJ_ARCH_NUMMODE LJ_NUMMODE_SINGLE_DUAL | ||
121 | |||
122 | #elif LUAJIT_TARGET == LUAJIT_ARCH_X64 | ||
123 | |||
124 | #define LJ_ARCH_NAME "x64" | ||
125 | #define LJ_ARCH_BITS 64 | ||
126 | #define LJ_ARCH_ENDIAN LUAJIT_LE | ||
127 | #define LJ_ARCH_HASFPU 1 | ||
128 | #define LJ_ABI_WIN LJ_TARGET_WINDOWS | ||
129 | #define LJ_TARGET_X64 1 | ||
130 | #define LJ_TARGET_X86ORX64 1 | ||
131 | #define LJ_TARGET_EHRETREG 0 | ||
132 | #define LJ_TARGET_JUMPRANGE 31 /* +-2^31 = +-2GB */ | ||
133 | #define LJ_TARGET_MASKSHIFT 1 | ||
134 | #define LJ_TARGET_MASKROT 1 | ||
135 | #define LJ_ARCH_NUMMODE LJ_NUMMODE_SINGLE_DUAL | ||
136 | |||
137 | #elif LUAJIT_TARGET == LUAJIT_ARCH_ARM | ||
138 | |||
139 | #define LJ_ARCH_NAME "arm" | ||
140 | #define LJ_ARCH_BITS 32 | ||
141 | #define LJ_ARCH_ENDIAN LUAJIT_LE | ||
142 | #define LJ_ARCH_HASFPU 0 | ||
143 | #define LJ_ABI_SOFTFP 1 | ||
144 | #define LJ_ABI_EABI 1 | ||
145 | #define LJ_TARGET_ARM 1 | ||
146 | #define LJ_TARGET_EHRETREG 0 | ||
147 | #define LJ_TARGET_JUMPRANGE 25 /* +-2^25 = +-32MB */ | ||
148 | #define LJ_TARGET_MASKSHIFT 0 | ||
149 | #define LJ_TARGET_MASKROT 1 | ||
150 | #define LJ_TARGET_UNIFYROT 2 /* Want only IR_BROR. */ | ||
151 | #define LJ_ARCH_NUMMODE LJ_NUMMODE_DUAL | ||
152 | #if LJ_TARGET_OSX | ||
153 | /* Runtime code generation is restricted on iOS. Complain to Apple, not me. */ | ||
154 | #define LJ_ARCH_NOJIT 1 | ||
155 | #endif | ||
156 | |||
157 | #elif LUAJIT_TARGET == LUAJIT_ARCH_PPC | ||
158 | |||
159 | #define LJ_ARCH_NAME "ppc" | ||
160 | #define LJ_ARCH_BITS 32 | ||
161 | #define LJ_ARCH_ENDIAN LUAJIT_BE | ||
162 | #define LJ_ARCH_HASFPU 1 | ||
163 | #define LJ_TARGET_PPC 1 | ||
164 | #define LJ_TARGET_EHRETREG 3 | ||
165 | #define LJ_TARGET_JUMPRANGE 25 /* +-2^25 = +-32MB */ | ||
166 | #define LJ_TARGET_MASKSHIFT 0 | ||
167 | #define LJ_TARGET_MASKROT 1 | ||
168 | #define LJ_TARGET_UNIFYROT 1 /* Want only IR_BROL. */ | ||
169 | #define LJ_ARCH_NUMMODE LJ_NUMMODE_DUAL_SINGLE | ||
170 | |||
171 | #elif LUAJIT_TARGET == LUAJIT_ARCH_PPCSPE | ||
172 | |||
173 | #define LJ_ARCH_NAME "ppcspe" | ||
174 | #define LJ_ARCH_BITS 32 | ||
175 | #define LJ_ARCH_ENDIAN LUAJIT_BE | ||
176 | #define LJ_ARCH_HASFPU 1 | ||
177 | #define LJ_ABI_SOFTFP 1 | ||
178 | #define LJ_ABI_EABI 1 | ||
179 | #define LJ_TARGET_PPCSPE 1 | ||
180 | #define LJ_TARGET_EHRETREG 3 | ||
181 | #define LJ_TARGET_JUMPRANGE 25 /* +-2^25 = +-32MB */ | ||
182 | #define LJ_TARGET_MASKSHIFT 0 | ||
183 | #define LJ_TARGET_MASKROT 1 | ||
184 | #define LJ_TARGET_UNIFYROT 1 /* Want only IR_BROL. */ | ||
185 | #define LJ_ARCH_NUMMODE LJ_NUMMODE_SINGLE | ||
186 | #define LJ_ARCH_NOFFI 1 /* NYI: comparisons, calls. */ | ||
187 | #define LJ_ARCH_NOJIT 1 | ||
188 | |||
189 | #elif LUAJIT_TARGET == LUAJIT_ARCH_MIPS | ||
190 | |||
191 | #define LJ_ARCH_NAME "mips" | ||
192 | #define LJ_ARCH_BITS 32 | ||
193 | #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) | ||
194 | #define LJ_ARCH_ENDIAN LUAJIT_LE | ||
195 | #else | ||
196 | #define LJ_ARCH_ENDIAN LUAJIT_BE | ||
197 | #endif | ||
198 | #define LJ_ARCH_HASFPU 1 | ||
199 | #define LJ_TARGET_MIPS 1 | ||
200 | #define LJ_TARGET_EHRETREG 4 | ||
201 | #define LJ_TARGET_JUMPRANGE 27 /* 2*2^27 = 256MB-aligned region */ | ||
202 | #define LJ_TARGET_MASKSHIFT 1 | ||
203 | #define LJ_TARGET_MASKROT 1 | ||
204 | #define LJ_TARGET_UNIFYROT 2 /* Want only IR_BROR. */ | ||
205 | #define LJ_ARCH_NUMMODE LJ_NUMMODE_SINGLE | ||
206 | #define LJ_ARCH_NOFFI 1 | ||
207 | #define LJ_ARCH_NOJIT 1 | ||
208 | |||
209 | #else | ||
210 | #error "No target architecture defined" | ||
211 | #endif | ||
212 | |||
213 | #ifndef LJ_PAGESIZE | ||
214 | #define LJ_PAGESIZE 4096 | ||
215 | #endif | ||
216 | |||
217 | /* Check for minimum required compiler versions. */ | ||
218 | #if defined(__GNUC__) | ||
219 | #if LJ_TARGET_X64 | ||
220 | #if __GNUC__ < 4 | ||
221 | #error "Need at least GCC 4.0 or newer" | ||
222 | #endif | ||
223 | #elif LJ_TARGET_ARM | ||
224 | #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 2) | ||
225 | #error "Need at least GCC 4.2 or newer" | ||
226 | #endif | ||
227 | #elif LJ_TARGET_PPC | ||
228 | #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 3) | ||
229 | #error "Need at least GCC 4.3 or newer" | ||
230 | #endif | ||
231 | #else | ||
232 | #if (__GNUC__ < 3) || ((__GNUC__ == 3) && __GNUC_MINOR__ < 4) | ||
233 | #error "Need at least GCC 3.4 or newer" | ||
234 | #endif | ||
235 | #endif | ||
236 | #endif | ||
237 | |||
238 | /* Check target-specific constraints. */ | ||
239 | #ifndef _BUILDVM_H | ||
240 | #if LJ_TARGET_ARM | ||
241 | #if defined(__ARMEB__) | ||
242 | #error "No support for big-endian ARM" | ||
243 | #endif | ||
244 | #if defined(__ARM_PCS_VFP) | ||
245 | #error "No support for ARM hard-float ABI (yet)" | ||
246 | #endif | ||
247 | #if !(__ARM_EABI__ || LJ_TARGET_OSX) | ||
248 | #error "Only ARM EABI or iOS 3.0+ ABI is supported" | ||
249 | #endif | ||
250 | #elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE | ||
251 | #if defined(_SOFT_FLOAT) || defined(_SOFT_DOUBLE) | ||
252 | #error "No support for PowerPC CPUs without double-precision FPU" | ||
253 | #endif | ||
254 | #if defined(_LITTLE_ENDIAN) | ||
255 | #error "No support for little-endian PowerPC" | ||
256 | #endif | ||
257 | #if defined(_LP64) | ||
258 | #error "No support for PowerPC 64 bit mode" | ||
259 | #endif | ||
260 | #endif | ||
261 | #endif | ||
262 | |||
263 | /* Enable or disable the dual-number mode for the VM. */ | ||
264 | #if (LJ_ARCH_NUMMODE == LJ_NUMMODE_SINGLE && LUAJIT_NUMMODE == 2) || \ | ||
265 | (LJ_ARCH_NUMMODE == LJ_NUMMODE_DUAL && LUAJIT_NUMMODE == 1) | ||
266 | #error "No support for this number mode on this architecture" | ||
267 | #endif | ||
268 | #if LJ_ARCH_NUMMODE == LJ_NUMMODE_DUAL || \ | ||
269 | (LJ_ARCH_NUMMODE == LJ_NUMMODE_DUAL_SINGLE && LUAJIT_NUMMODE != 1) || \ | ||
270 | (LJ_ARCH_NUMMODE == LJ_NUMMODE_SINGLE_DUAL && LUAJIT_NUMMODE == 2) | ||
271 | #define LJ_DUALNUM 1 | ||
272 | #else | ||
273 | #define LJ_DUALNUM 0 | ||
274 | #endif | ||
275 | |||
276 | /* Disable or enable the JIT compiler. */ | ||
277 | #if defined(LUAJIT_DISABLE_JIT) || defined(LJ_ARCH_NOJIT) | ||
278 | #define LJ_HASJIT 0 | ||
279 | #else | ||
280 | #define LJ_HASJIT 1 | ||
281 | #endif | ||
282 | |||
283 | /* Disable or enable the FFI extension. */ | ||
284 | #if defined(LUAJIT_DISABLE_FFI) || defined(LJ_ARCH_NOFFI) | ||
285 | #define LJ_HASFFI 0 | ||
286 | #else | ||
287 | #define LJ_HASFFI 1 | ||
288 | #endif | ||
289 | |||
290 | #define LJ_SOFTFP (!LJ_ARCH_HASFPU) | ||
291 | |||
292 | #if LJ_ARCH_ENDIAN == LUAJIT_BE | ||
293 | #define LJ_LE 0 | ||
294 | #define LJ_BE 1 | ||
295 | #define LJ_ENDIAN_SELECT(le, be) be | ||
296 | #define LJ_ENDIAN_LOHI(lo, hi) hi lo | ||
297 | #else | ||
298 | #define LJ_LE 1 | ||
299 | #define LJ_BE 0 | ||
300 | #define LJ_ENDIAN_SELECT(le, be) le | ||
301 | #define LJ_ENDIAN_LOHI(lo, hi) lo hi | ||
302 | #endif | ||
303 | |||
304 | #if LJ_ARCH_BITS == 32 | ||
305 | #define LJ_32 1 | ||
306 | #define LJ_64 0 | ||
307 | #else | ||
308 | #define LJ_32 0 | ||
309 | #define LJ_64 1 | ||
310 | #endif | ||
311 | |||
312 | /* Various workarounds for embedded operating systems. */ | ||
313 | #if defined(__ANDROID__) || defined(__symbian__) | ||
314 | #define LUAJIT_NO_LOG2 | ||
315 | #endif | ||
316 | #if defined(__symbian__) | ||
317 | #define LUAJIT_NO_EXP2 | ||
318 | #endif | ||
319 | |||
320 | #if defined(__symbian__) || (LJ_TARGET_ARM && LJ_TARGET_OSX) | ||
321 | #define LUAJIT_NO_UNWIND | ||
322 | #endif | ||
323 | |||
324 | #endif | ||