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