/[pcre]/code/trunk/sljit/sljitConfigInternal.h
ViewVC logotype

Contents of /code/trunk/sljit/sljitConfigInternal.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1483 - (show annotations)
Tue Jun 17 15:48:37 2014 UTC (5 years, 3 months ago) by zherczeg
File MIME type: text/plain
File size: 16954 byte(s)
Error occurred while calculating annotation data.
Major JIT compiler update. 
1 /*
2 * Stack-less Just-In-Time compiler
3 *
4 * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without modification, are
7 * permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice, this list of
10 * conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
13 * of conditions and the following disclaimer in the documentation and/or other materials
14 * provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19 * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 #ifndef _SLJIT_CONFIG_INTERNAL_H_
28 #define _SLJIT_CONFIG_INTERNAL_H_
29
30 /*
31 SLJIT defines the following macros depending on the target architecture:
32
33 Feature detection (boolean) macros:
34 SLJIT_32BIT_ARCHITECTURE : 32 bit architecture
35 SLJIT_64BIT_ARCHITECTURE : 64 bit architecture
36 SLJIT_WORD_SHIFT : the shift required to apply when accessing a sljit_sw/sljit_uw array by index
37 SLJIT_DOUBLE_SHIFT : the shift required to apply when accessing a double precision floating point array by index
38 SLJIT_SINGLE_SHIFT : the shift required to apply when accessing a single precision floating point array by index
39 SLJIT_LITTLE_ENDIAN : little endian architecture
40 SLJIT_BIG_ENDIAN : big endian architecture
41 SLJIT_UNALIGNED : allows unaligned memory accesses for non-fpu operations (only!)
42 SLJIT_INDIRECT_CALL : see SLJIT_FUNC_OFFSET() for more information
43 SLJIT_RETURN_ADDRESS_OFFSET : a return instruction always adds this offset to the return address
44
45 Types and useful macros:
46 sljit_sb, sljit_ub : signed and unsigned 8 bit byte
47 sljit_sh, sljit_uh : signed and unsigned 16 bit half-word (short) type
48 sljit_si, sljit_ui : signed and unsigned 32 bit integer type
49 sljit_sw, sljit_uw : signed and unsigned machine word, enough to store a pointer
50 sljit_p : unsgined pointer value (usually the same as sljit_uw, but
51 some 64 bit ABIs may use 32 bit pointers)
52 sljit_s : single precision floating point value
53 sljit_d : double precision floating point value
54 SLJIT_CALL : C calling convention define for both calling JIT form C and C callbacks for JIT
55 SLJIT_W(number) : defining 64 bit constants on 64 bit architectures (compiler independent helper)
56 */
57
58 #if !((defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) \
59 || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \
60 || (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) \
61 || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
62 || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) \
63 || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
64 || (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \
65 || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \
66 || (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \
67 || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) \
68 || (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) \
69 || (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX) \
70 || (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO) \
71 || (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED))
72 #error "An architecture must be selected"
73 #endif
74
75 /* Sanity check. */
76 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) \
77 + (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \
78 + (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) \
79 + (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
80 + (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) \
81 + (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
82 + (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \
83 + (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \
84 + (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX) \
85 + (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \
86 + (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) \
87 + (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) \
88 + (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO) \
89 + (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED) >= 2
90 #error "Multiple architectures are selected"
91 #endif
92
93 /* Auto select option (requires compiler support) */
94 #if (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO)
95
96 #ifndef _WIN32
97
98 #if defined(__i386__) || defined(__i386)
99 #define SLJIT_CONFIG_X86_32 1
100 #elif defined(__x86_64__)
101 #define SLJIT_CONFIG_X86_64 1
102 #elif defined(__arm__) || defined(__ARM__)
103 #ifdef __thumb2__
104 #define SLJIT_CONFIG_ARM_THUMB2 1
105 #elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__)
106 #define SLJIT_CONFIG_ARM_V7 1
107 #else
108 #define SLJIT_CONFIG_ARM_V5 1
109 #endif
110 #elif defined (__aarch64__)
111 #define SLJIT_CONFIG_ARM_64 1
112 #elif defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_PPC64) || (defined(_POWER) && defined(__64BIT__))
113 #define SLJIT_CONFIG_PPC_64 1
114 #elif defined(__ppc__) || defined(__powerpc__) || defined(_ARCH_PPC) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_POWER)
115 #define SLJIT_CONFIG_PPC_32 1
116 #elif defined(__mips__) && !defined(_LP64)
117 #define SLJIT_CONFIG_MIPS_32 1
118 #elif defined(__mips64)
119 #define SLJIT_CONFIG_MIPS_64 1
120 #elif defined(__sparc__) || defined(__sparc)
121 #define SLJIT_CONFIG_SPARC_32 1
122 #elif defined(__tilegx__)
123 #define SLJIT_CONFIG_TILEGX 1
124 #else
125 /* Unsupported architecture */
126 #define SLJIT_CONFIG_UNSUPPORTED 1
127 #endif
128
129 #else /* !_WIN32 */
130
131 #if defined(_M_X64) || defined(__x86_64__)
132 #define SLJIT_CONFIG_X86_64 1
133 #elif defined(_ARM_)
134 #define SLJIT_CONFIG_ARM_V5 1
135 #else
136 #define SLJIT_CONFIG_X86_32 1
137 #endif
138
139 #endif /* !WIN32 */
140 #endif /* SLJIT_CONFIG_AUTO */
141
142 #if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
143 #undef SLJIT_EXECUTABLE_ALLOCATOR
144 #endif
145
146 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
147 #define SLJIT_CONFIG_X86 1
148 #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
149 || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
150 #define SLJIT_CONFIG_ARM 1
151 #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
152 #define SLJIT_CONFIG_PPC 1
153 #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
154 #define SLJIT_CONFIG_MIPS 1
155 #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) || (defined SLJIT_CONFIG_SPARC_64 && SLJIT_CONFIG_SPARC_64)
156 #define SLJIT_CONFIG_SPARC 1
157 #endif
158
159 #if !(defined SLJIT_STD_MACROS_DEFINED && SLJIT_STD_MACROS_DEFINED)
160
161 /* These libraries are needed for the macros below. */
162 #include <stdlib.h>
163 #include <string.h>
164
165 #endif /* STD_MACROS_DEFINED */
166
167 /* General macros:
168 Note: SLJIT is designed to be independent from them as possible.
169
170 In release mode (SLJIT_DEBUG is not defined) only the following macros are needed:
171 */
172
173 #ifndef SLJIT_MALLOC
174 #define SLJIT_MALLOC(size) malloc(size)
175 #endif
176
177 #ifndef SLJIT_FREE
178 #define SLJIT_FREE(ptr) free(ptr)
179 #endif
180
181 #ifndef SLJIT_MEMMOVE
182 #define SLJIT_MEMMOVE(dest, src, len) memmove(dest, src, len)
183 #endif
184
185 #ifndef SLJIT_ZEROMEM
186 #define SLJIT_ZEROMEM(dest, len) memset(dest, 0, len)
187 #endif
188
189 #if !defined(SLJIT_LIKELY) && !defined(SLJIT_UNLIKELY)
190
191 #if defined(__GNUC__) && (__GNUC__ >= 3)
192 #define SLJIT_LIKELY(x) __builtin_expect((x), 1)
193 #define SLJIT_UNLIKELY(x) __builtin_expect((x), 0)
194 #else
195 #define SLJIT_LIKELY(x) (x)
196 #define SLJIT_UNLIKELY(x) (x)
197 #endif
198
199 #endif /* !defined(SLJIT_LIKELY) && !defined(SLJIT_UNLIKELY) */
200
201 #ifndef SLJIT_INLINE
202 /* Inline functions. Some old compilers do not support them. */
203 #if defined(__SUNPRO_C) && __SUNPRO_C <= 0x510
204 #define SLJIT_INLINE
205 #else
206 #define SLJIT_INLINE __inline
207 #endif
208 #endif /* !SLJIT_INLINE */
209
210 #ifndef SLJIT_CONST
211 /* Const variables. */
212 #define SLJIT_CONST const
213 #endif
214
215 #ifndef SLJIT_UNUSED_ARG
216 /* Unused arguments. */
217 #define SLJIT_UNUSED_ARG(arg) (void)arg
218 #endif
219
220 #if (defined SLJIT_CONFIG_STATIC && SLJIT_CONFIG_STATIC)
221 /* Static ABI functions. For all-in-one programs. */
222
223 #if defined(__GNUC__)
224 /* Disable unused warnings in gcc. */
225 #define SLJIT_API_FUNC_ATTRIBUTE static __attribute__((unused))
226 #else
227 #define SLJIT_API_FUNC_ATTRIBUTE static
228 #endif
229
230 #else
231 #define SLJIT_API_FUNC_ATTRIBUTE
232 #endif /* (defined SLJIT_CONFIG_STATIC && SLJIT_CONFIG_STATIC) */
233
234 #ifndef SLJIT_CACHE_FLUSH
235
236 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
237
238 /* Not required to implement on archs with unified caches. */
239 #define SLJIT_CACHE_FLUSH(from, to)
240
241 #elif defined __APPLE__
242
243 /* Supported by all macs since Mac OS 10.5.
244 However, it does not work on non-jailbroken iOS devices,
245 although the compilation is successful. */
246
247 #define SLJIT_CACHE_FLUSH(from, to) \
248 sys_icache_invalidate((char*)(from), (char*)(to) - (char*)(from))
249
250 #elif defined __ANDROID__
251
252 /* Android lacks __clear_cache; instead, cacheflush should be used. */
253
254 #define SLJIT_CACHE_FLUSH(from, to) \
255 cacheflush((long)(from), (long)(to), 0)
256
257 #elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
258
259 /* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */
260 #define SLJIT_CACHE_FLUSH(from, to) \
261 ppc_cache_flush((from), (to))
262
263 #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
264
265 /* The __clear_cache() implementation of GCC is a dummy function on Sparc. */
266 #define SLJIT_CACHE_FLUSH(from, to) \
267 sparc_cache_flush((from), (to))
268
269 #else
270
271 /* Calls __ARM_NR_cacheflush on ARM-Linux. */
272 #define SLJIT_CACHE_FLUSH(from, to) \
273 __clear_cache((char*)(from), (char*)(to))
274
275 #endif
276
277 #endif /* !SLJIT_CACHE_FLUSH */
278
279 /* 8 bit byte type. */
280 typedef unsigned char sljit_ub;
281 typedef signed char sljit_sb;
282
283 /* 16 bit half-word type. */
284 typedef unsigned short int sljit_uh;
285 typedef signed short int sljit_sh;
286
287 /* 32 bit integer type. */
288 typedef unsigned int sljit_ui;
289 typedef signed int sljit_si;
290
291 /* Machine word type. Can encapsulate a pointer.
292 32 bit for 32 bit machines.
293 64 bit for 64 bit machines. */
294 #if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
295 /* Just to have something. */
296 #define SLJIT_WORD_SHIFT 0
297 typedef unsigned long int sljit_uw;
298 typedef long int sljit_sw;
299 #elif !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \
300 && !(defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
301 && !(defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \
302 && !(defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) \
303 && !(defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
304 #define SLJIT_32BIT_ARCHITECTURE 1
305 #define SLJIT_WORD_SHIFT 2
306 typedef unsigned int sljit_uw;
307 typedef int sljit_sw;
308 #else
309 #define SLJIT_64BIT_ARCHITECTURE 1
310 #define SLJIT_WORD_SHIFT 3
311 #ifdef _WIN32
312 typedef unsigned __int64 sljit_uw;
313 typedef __int64 sljit_sw;
314 #else
315 typedef unsigned long int sljit_uw;
316 typedef long int sljit_sw;
317 #endif
318 #endif
319
320 typedef sljit_uw sljit_p;
321
322 /* Floating point types. */
323 typedef float sljit_s;
324 typedef double sljit_d;
325
326 /* Shift for pointer sized data. */
327 #define SLJIT_POINTER_SHIFT SLJIT_WORD_SHIFT
328
329 /* Shift for double precision sized data. */
330 #define SLJIT_DOUBLE_SHIFT 3
331 #define SLJIT_SINGLE_SHIFT 2
332
333 #ifndef SLJIT_W
334
335 /* Defining long constants. */
336 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
337 #define SLJIT_W(w) (w##ll)
338 #else
339 #define SLJIT_W(w) (w)
340 #endif
341
342 #endif /* !SLJIT_W */
343
344 #ifndef SLJIT_CALL
345
346 /* ABI (Application Binary Interface) types. */
347 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
348
349 #if defined(__GNUC__) && !defined(__APPLE__)
350
351 #define SLJIT_CALL __attribute__ ((fastcall))
352 #define SLJIT_X86_32_FASTCALL 1
353
354 #elif defined(_MSC_VER)
355
356 #define SLJIT_CALL __fastcall
357 #define SLJIT_X86_32_FASTCALL 1
358
359 #elif defined(__BORLANDC__)
360
361 #define SLJIT_CALL __msfastcall
362 #define SLJIT_X86_32_FASTCALL 1
363
364 #else /* Unknown compiler. */
365
366 /* The cdecl attribute is the default. */
367 #define SLJIT_CALL
368
369 #endif
370
371 #else /* Non x86-32 architectures. */
372
373 #define SLJIT_CALL
374
375 #endif /* SLJIT_CONFIG_X86_32 */
376
377 #endif /* !SLJIT_CALL */
378
379 #if !defined(SLJIT_BIG_ENDIAN) && !defined(SLJIT_LITTLE_ENDIAN)
380
381 /* These macros are useful for the applications. */
382 #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \
383 || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
384
385 #ifdef __LITTLE_ENDIAN__
386 #define SLJIT_LITTLE_ENDIAN 1
387 #else
388 #define SLJIT_BIG_ENDIAN 1
389 #endif
390
391 #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \
392 || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
393
394 #ifdef __MIPSEL__
395 #define SLJIT_LITTLE_ENDIAN 1
396 #else
397 #define SLJIT_BIG_ENDIAN 1
398 #endif
399
400 #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
401
402 #define SLJIT_BIG_ENDIAN 1
403
404 #else
405 #define SLJIT_LITTLE_ENDIAN 1
406 #endif
407
408 #endif /* !defined(SLJIT_BIG_ENDIAN) && !defined(SLJIT_LITTLE_ENDIAN) */
409
410 /* Sanity check. */
411 #if (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN) && (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
412 #error "Exactly one endianness must be selected"
413 #endif
414
415 #if !(defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN) && !(defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
416 #error "Exactly one endianness must be selected"
417 #endif
418
419 #ifndef SLJIT_INDIRECT_CALL
420 #if ((defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) && (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN)) \
421 || ((defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) && defined _AIX)
422 /* It seems certain ppc compilers use an indirect addressing for functions
423 which makes things complicated. */
424 #define SLJIT_INDIRECT_CALL 1
425 #endif
426 #endif /* SLJIT_INDIRECT_CALL */
427
428 #ifndef SLJIT_RETURN_ADDRESS_OFFSET
429 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
430 #define SLJIT_RETURN_ADDRESS_OFFSET 8
431 #else
432 #define SLJIT_RETURN_ADDRESS_OFFSET 0
433 #endif
434 #endif /* SLJIT_RETURN_ADDRESS_OFFSET */
435
436 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
437 /* Auto detect SSE2 support using CPUID.
438 On 64 bit x86 cpus, sse2 must be present. */
439 #define SLJIT_DETECT_SSE2 1
440 #endif
441
442 #ifndef SLJIT_UNALIGNED
443
444 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) \
445 || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \
446 || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
447 || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) \
448 || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
449 || (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \
450 || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
451 #define SLJIT_UNALIGNED 1
452 #endif
453
454 #endif /* !SLJIT_UNALIGNED */
455
456 #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
457 SLJIT_API_FUNC_ATTRIBUTE void* sljit_malloc_exec(sljit_uw size);
458 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void* ptr);
459 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_unused_memory_exec(void);
460 #define SLJIT_MALLOC_EXEC(size) sljit_malloc_exec(size)
461 #define SLJIT_FREE_EXEC(ptr) sljit_free_exec(ptr)
462 #endif
463
464 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
465 #include <stdio.h>
466 #endif
467
468 #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
469
470 #if !defined(SLJIT_ASSERT) || !defined(SLJIT_ASSERT_STOP)
471
472 /* SLJIT_HALT_PROCESS must halt the process. */
473 #ifndef SLJIT_HALT_PROCESS
474 #include <stdlib.h>
475
476 #define SLJIT_HALT_PROCESS() \
477 abort();
478 #endif /* !SLJIT_HALT_PROCESS */
479
480 #include <stdio.h>
481
482 #endif /* !SLJIT_ASSERT || !SLJIT_ASSERT_STOP */
483
484 /* Feel free to redefine these two macros. */
485 #ifndef SLJIT_ASSERT
486
487 #define SLJIT_ASSERT(x) \
488 do { \
489 if (SLJIT_UNLIKELY(!(x))) { \
490 printf("Assertion failed at " __FILE__ ":%d\n", __LINE__); \
491 SLJIT_HALT_PROCESS(); \
492 } \
493 } while (0)
494
495 #endif /* !SLJIT_ASSERT */
496
497 #ifndef SLJIT_ASSERT_STOP
498
499 #define SLJIT_ASSERT_STOP() \
500 do { \
501 printf("Should never been reached " __FILE__ ":%d\n", __LINE__); \
502 SLJIT_HALT_PROCESS(); \
503 } while (0)
504
505 #endif /* !SLJIT_ASSERT_STOP */
506
507 #else /* (defined SLJIT_DEBUG && SLJIT_DEBUG) */
508
509 /* Forcing empty, but valid statements. */
510 #undef SLJIT_ASSERT
511 #undef SLJIT_ASSERT_STOP
512
513 #define SLJIT_ASSERT(x) \
514 do { } while (0)
515 #define SLJIT_ASSERT_STOP() \
516 do { } while (0)
517
518 #endif /* (defined SLJIT_DEBUG && SLJIT_DEBUG) */
519
520 #ifndef SLJIT_COMPILE_ASSERT
521
522 /* Should be improved eventually. */
523 #define SLJIT_COMPILE_ASSERT(x, description) \
524 SLJIT_ASSERT(x)
525
526 #endif /* !SLJIT_COMPILE_ASSERT */
527
528 #endif

  ViewVC Help
Powered by ViewVC 1.1.5