NCBI C++ ToolKit
sljitConfigInternal.h
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /*
2  * Stack-less Just-In-Time compiler
3  *
4  * Copyright 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 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) \
31  || (defined SLJIT_DEBUG && SLJIT_DEBUG && (!defined(SLJIT_ASSERT) || !defined(SLJIT_UNREACHABLE)))
32 #include <stdio.h>
33 #endif
34 
35 #if (defined SLJIT_DEBUG && SLJIT_DEBUG \
36  && (!defined(SLJIT_ASSERT) || !defined(SLJIT_UNREACHABLE) || !defined(SLJIT_HALT_PROCESS)))
37 #include <stdlib.h>
38 #endif
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  SLJIT defines the following architecture dependent types and macros:
46 
47  Types:
48  sljit_s8, sljit_u8 : signed and unsigned 8 bit integer type
49  sljit_s16, sljit_u16 : signed and unsigned 16 bit integer type
50  sljit_s32, sljit_u32 : signed and unsigned 32 bit integer type
51  sljit_sw, sljit_uw : signed and unsigned machine word, enough to store a pointer
52  sljit_sp, sljit_up : signed and unsigned pointer value (usually the same as
53  sljit_uw, but some 64 bit ABIs may use 32 bit pointers)
54  sljit_f32 : 32 bit single precision floating point value
55  sljit_f64 : 64 bit double precision floating point value
56 
57  Macros for feature detection (boolean):
58  SLJIT_32BIT_ARCHITECTURE : 32 bit architecture
59  SLJIT_64BIT_ARCHITECTURE : 64 bit architecture
60  SLJIT_LITTLE_ENDIAN : little endian architecture
61  SLJIT_BIG_ENDIAN : big endian architecture
62  SLJIT_UNALIGNED : unaligned memory accesses for non-fpu operations are supported
63  SLJIT_FPU_UNALIGNED : unaligned memory accesses for fpu operations are supported
64  SLJIT_MASKED_SHIFT : all word shifts are always masked
65  SLJIT_MASKED_SHIFT32 : all 32 bit shifts are always masked
66  SLJIT_INDIRECT_CALL : see SLJIT_FUNC_ADDR() for more information
67 
68  Constants:
69  SLJIT_NUMBER_OF_REGISTERS : number of available registers
70  SLJIT_NUMBER_OF_SCRATCH_REGISTERS : number of available scratch registers
71  SLJIT_NUMBER_OF_SAVED_REGISTERS : number of available saved registers
72  SLJIT_NUMBER_OF_FLOAT_REGISTERS : number of available floating point registers
73  SLJIT_NUMBER_OF_SCRATCH_FLOAT_REGISTERS : number of available floating point scratch registers
74  SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS : number of available floating point saved registers
75  SLJIT_NUMBER_OF_TEMPORARY_REGISTERS : number of available temporary registers
76  SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS : number of available temporary floating point registers
77  SLJIT_WORD_SHIFT : the shift required to apply when accessing a sljit_sw/sljit_uw array by index
78  SLJIT_F32_SHIFT : the shift required to apply when accessing
79  a single precision floating point array by index
80  SLJIT_F64_SHIFT : the shift required to apply when accessing
81  a double precision floating point array by index
82  SLJIT_PREF_SHIFT_REG : x86 systems prefers ecx for shifting by register
83  the scratch register index of ecx is stored in this variable
84  SLJIT_LOCALS_OFFSET : local space starting offset (SLJIT_SP + SLJIT_LOCALS_OFFSET)
85  SLJIT_RETURN_ADDRESS_OFFSET : a return instruction always adds this offset to the return address
86  SLJIT_CONV_MAX_FLOAT : result when a floating point value is converted to integer
87  and the floating point value is higher than the maximum integer value
88  (possible values: SLJIT_CONV_RESULT_MAX_INT or SLJIT_CONV_RESULT_MIN_INT)
89  SLJIT_CONV_MIN_FLOAT : result when a floating point value is converted to integer
90  and the floating point value is lower than the minimum integer value
91  (possible values: SLJIT_CONV_RESULT_MAX_INT or SLJIT_CONV_RESULT_MIN_INT)
92  SLJIT_CONV_NAN_FLOAT : result when a NaN floating point value is converted to integer
93  (possible values: SLJIT_CONV_RESULT_MAX_INT, SLJIT_CONV_RESULT_MIN_INT,
94  or SLJIT_CONV_RESULT_ZERO)
95 
96  Other macros:
97  SLJIT_TMP_R0 .. R9 : accessing temporary registers
98  SLJIT_TMP_R(i) : accessing temporary registers
99  SLJIT_TMP_FR0 .. FR9 : accessing temporary floating point registers
100  SLJIT_TMP_FR(i) : accessing temporary floating point registers
101  SLJIT_TMP_DEST_REG : a temporary register for results
102  SLJIT_TMP_MEM_REG : a temporary base register for accessing memory
103  (can be the same as SLJIT_TMP_DEST_REG)
104  SLJIT_TMP_DEST_FREG : a temporary register for float results
105  SLJIT_FUNC : calling convention attribute for both calling JIT from C and C calling back from JIT
106  SLJIT_W(number) : defining 64 bit constants on 64 bit architectures (platform independent helper)
107  SLJIT_F64_SECOND(reg) : provides the register index of the second 32 bit part of a 64 bit
108  floating point register when SLJIT_HAS_F64_AS_F32_PAIR returns non-zero
109 */
110 
111 /***********************************************************/
112 /* Intel Control-flow Enforcement Technology (CET) spport. */
113 /***********************************************************/
114 
115 #ifdef SLJIT_CONFIG_X86
116 
117 #if defined(__CET__) && !(defined SLJIT_CONFIG_X86_CET && SLJIT_CONFIG_X86_CET)
118 #define SLJIT_CONFIG_X86_CET 1
119 #endif
120 
121 #if (defined SLJIT_CONFIG_X86_CET && SLJIT_CONFIG_X86_CET) && defined(__GNUC__)
122 #include <x86intrin.h>
123 #endif
124 
125 #endif /* SLJIT_CONFIG_X86 */
126 
127 /**********************************/
128 /* External function definitions. */
129 /**********************************/
130 
131 /* General macros:
132  Note: SLJIT is designed to be independent from them as possible.
133 
134  In release mode (SLJIT_DEBUG is not defined) only the following
135  external functions are needed:
136 */
137 
138 #ifndef SLJIT_MALLOC
139 #define SLJIT_MALLOC(size, allocator_data) (malloc(size))
140 #endif
141 
142 #ifndef SLJIT_FREE
143 #define SLJIT_FREE(ptr, allocator_data) (free(ptr))
144 #endif
145 
146 #ifndef SLJIT_MEMCPY
147 #define SLJIT_MEMCPY(dest, src, len) (memcpy(dest, src, len))
148 #endif
149 
150 #ifndef SLJIT_MEMMOVE
151 #define SLJIT_MEMMOVE(dest, src, len) (memmove(dest, src, len))
152 #endif
153 
154 #ifndef SLJIT_ZEROMEM
155 #define SLJIT_ZEROMEM(dest, len) (memset(dest, 0, len))
156 #endif
157 
158 /***************************/
159 /* Compiler helper macros. */
160 /***************************/
161 
162 #if !defined(SLJIT_LIKELY) && !defined(SLJIT_UNLIKELY)
163 
164 #if defined(__GNUC__) && (__GNUC__ >= 3)
165 #define SLJIT_LIKELY(x) __builtin_expect((x), 1)
166 #define SLJIT_UNLIKELY(x) __builtin_expect((x), 0)
167 #else
168 #define SLJIT_LIKELY(x) (x)
169 #define SLJIT_UNLIKELY(x) (x)
170 #endif
171 
172 #endif /* !defined(SLJIT_LIKELY) && !defined(SLJIT_UNLIKELY) */
173 
174 #ifndef SLJIT_INLINE
175 /* Inline functions. Some old compilers do not support them. */
176 #ifdef __SUNPRO_C
177 #if __SUNPRO_C < 0x560
178 #define SLJIT_INLINE
179 #else
180 #define SLJIT_INLINE inline
181 #endif /* __SUNPRO_C */
182 #else
183 #define SLJIT_INLINE __inline
184 #endif
185 #endif /* !SLJIT_INLINE */
186 
187 #ifndef SLJIT_NOINLINE
188 /* Not inline functions. */
189 #if defined(__GNUC__)
190 #define SLJIT_NOINLINE __attribute__ ((noinline))
191 #else
192 #define SLJIT_NOINLINE
193 #endif
194 #endif /* !SLJIT_INLINE */
195 
196 #ifndef SLJIT_UNUSED_ARG
197 /* Unused arguments. */
198 #define SLJIT_UNUSED_ARG(arg) (void)arg
199 #endif
200 
201 /*********************************/
202 /* Type of public API functions. */
203 /*********************************/
204 
205 #ifndef SLJIT_API_FUNC_ATTRIBUTE
206 #if (defined SLJIT_CONFIG_STATIC && SLJIT_CONFIG_STATIC)
207 /* Static ABI functions. For all-in-one programs. */
208 
209 #if defined(__GNUC__)
210 /* Disable unused warnings in gcc. */
211 #define SLJIT_API_FUNC_ATTRIBUTE static __attribute__((unused))
212 #else
213 #define SLJIT_API_FUNC_ATTRIBUTE static
214 #endif
215 
216 #else
217 #define SLJIT_API_FUNC_ATTRIBUTE
218 #endif /* (defined SLJIT_CONFIG_STATIC && SLJIT_CONFIG_STATIC) */
219 #endif /* defined SLJIT_API_FUNC_ATTRIBUTE */
220 
221 /****************************/
222 /* Instruction cache flush. */
223 /****************************/
224 
225 #ifdef __APPLE__
226 #include <AvailabilityMacros.h>
227 #endif
228 
229 /*
230  * TODO:
231  *
232  * clang >= 15 could be safe to enable below
233  * older versions are known to abort in some targets
234  * https://github.com/PhilipHazel/pcre2/issues/92
235  *
236  * beware some vendors (ex: Microsoft, Apple) are known to have
237  * removed the code to support this builtin even if the call for
238  * __has_builtin reports it is available.
239  *
240  * make sure linking doesn't fail because __clear_cache() is
241  * missing before changing it or add an exception so that the
242  * system provided method that should be defined below is used
243  * instead.
244  */
245 #if (!defined SLJIT_CACHE_FLUSH && defined __has_builtin)
246 #if __has_builtin(__builtin___clear_cache) && !defined(__clang__)
247 
248 /*
249  * https://gcc.gnu.org/bugzilla//show_bug.cgi?id=91248
250  * https://gcc.gnu.org/bugzilla//show_bug.cgi?id=93811
251  * gcc's clear_cache builtin for power is broken
252  */
253 #if !defined(SLJIT_CONFIG_PPC)
254 #define SLJIT_CACHE_FLUSH(from, to) \
255  __builtin___clear_cache((char*)(from), (char*)(to))
256 #endif
257 
258 #endif /* gcc >= 10 */
259 #endif /* (!defined SLJIT_CACHE_FLUSH && defined __has_builtin) */
260 
261 #ifndef SLJIT_CACHE_FLUSH
262 
263 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) \
264  || (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
265 
266 /* Not required to implement on archs with unified caches. */
267 #define SLJIT_CACHE_FLUSH(from, to)
268 
269 #elif defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
270 
271 /* Supported by all macs since Mac OS 10.5.
272  However, it does not work on non-jailbroken iOS devices,
273  although the compilation is successful. */
274 #include <libkern/OSCacheControl.h>
275 #define SLJIT_CACHE_FLUSH(from, to) \
276  sys_icache_invalidate((void*)(from), (size_t)((char*)(to) - (char*)(from)))
277 
278 #elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
279 
280 /* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */
281 #define SLJIT_CACHE_FLUSH(from, to) \
282  ppc_cache_flush((from), (to))
283 #define SLJIT_CACHE_FLUSH_OWN_IMPL 1
284 
285 #elif defined(_WIN32)
286 
287 #define SLJIT_CACHE_FLUSH(from, to) \
288  FlushInstructionCache(GetCurrentProcess(), (void*)(from), (char*)(to) - (char*)(from))
289 
290 #elif (defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || defined(__clang__)
291 
292 #define SLJIT_CACHE_FLUSH(from, to) \
293  __builtin___clear_cache((char*)(from), (char*)(to))
294 
295 #elif defined __ANDROID__
296 
297 /* Android ARMv7 with gcc lacks __clear_cache; use cacheflush instead. */
298 #include <sys/cachectl.h>
299 #define SLJIT_CACHE_FLUSH(from, to) \
300  cacheflush((long)(from), (long)(to), 0)
301 
302 #else
303 
304 /* Call __ARM_NR_cacheflush on ARM-Linux or the corresponding MIPS syscall. */
305 #define SLJIT_CACHE_FLUSH(from, to) \
306  __clear_cache((char*)(from), (char*)(to))
307 
308 #endif
309 
310 #endif /* !SLJIT_CACHE_FLUSH */
311 
312 /******************************************************/
313 /* Integer and floating point type definitions. */
314 /******************************************************/
315 
316 /* 8 bit byte type. */
317 typedef unsigned char sljit_u8;
318 typedef signed char sljit_s8;
319 
320 /* 16 bit half-word type. */
321 typedef unsigned short int sljit_u16;
322 typedef signed short int sljit_s16;
323 
324 /* 32 bit integer type. */
325 typedef unsigned int sljit_u32;
326 typedef signed int sljit_s32;
327 
328 /* Machine word type. Enough for storing a pointer.
329  32 bit for 32 bit machines.
330  64 bit for 64 bit machines. */
331 #if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
332 /* Just to have something. */
333 #define SLJIT_WORD_SHIFT 0
334 typedef unsigned int sljit_uw;
335 typedef int sljit_sw;
336 #elif !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \
337  && !(defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
338  && !(defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \
339  && !(defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) \
340  && !(defined SLJIT_CONFIG_RISCV_64 && SLJIT_CONFIG_RISCV_64) \
341  && !(defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X) \
342  && !(defined SLJIT_CONFIG_LOONGARCH_64 && SLJIT_CONFIG_LOONGARCH_64)
343 #define SLJIT_32BIT_ARCHITECTURE 1
344 #define SLJIT_WORD_SHIFT 2
345 typedef unsigned int sljit_uw;
346 typedef int sljit_sw;
347 #else
348 #define SLJIT_64BIT_ARCHITECTURE 1
349 #define SLJIT_WORD_SHIFT 3
350 #ifdef _WIN32
351 #ifdef __GNUC__
352 /* These types do not require windows.h */
353 typedef unsigned long long sljit_uw;
354 typedef long long sljit_sw;
355 #else
356 typedef unsigned __int64 sljit_uw;
357 typedef __int64 sljit_sw;
358 #endif
359 #else /* !_WIN32 */
360 typedef unsigned long int sljit_uw;
361 typedef long int sljit_sw;
362 #endif /* _WIN32 */
363 #endif
364 
367 
368 /* Floating point types. */
369 typedef float sljit_f32;
370 typedef double sljit_f64;
371 
372 /* Shift for pointer sized data. */
373 #define SLJIT_POINTER_SHIFT SLJIT_WORD_SHIFT
374 
375 /* Shift for double precision sized data. */
376 #define SLJIT_F32_SHIFT 2
377 #define SLJIT_F64_SHIFT 3
378 
379 #define SLJIT_CONV_RESULT_MAX_INT 0
380 #define SLJIT_CONV_RESULT_MIN_INT 1
381 #define SLJIT_CONV_RESULT_ZERO 2
382 
383 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
384 #define SLJIT_CONV_MAX_FLOAT SLJIT_CONV_RESULT_MIN_INT
385 #define SLJIT_CONV_MIN_FLOAT SLJIT_CONV_RESULT_MIN_INT
386 #define SLJIT_CONV_NAN_FLOAT SLJIT_CONV_RESULT_MIN_INT
387 #elif (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM)
388 #define SLJIT_CONV_MAX_FLOAT SLJIT_CONV_RESULT_MAX_INT
389 #define SLJIT_CONV_MIN_FLOAT SLJIT_CONV_RESULT_MIN_INT
390 #define SLJIT_CONV_NAN_FLOAT SLJIT_CONV_RESULT_ZERO
391 #elif (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
392 #define SLJIT_CONV_MAX_FLOAT SLJIT_CONV_RESULT_MAX_INT
393 #define SLJIT_CONV_MIN_FLOAT SLJIT_CONV_RESULT_MAX_INT
394 #define SLJIT_CONV_NAN_FLOAT SLJIT_CONV_RESULT_MAX_INT
395 #elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
396 #define SLJIT_CONV_MAX_FLOAT SLJIT_CONV_RESULT_MAX_INT
397 #define SLJIT_CONV_MIN_FLOAT SLJIT_CONV_RESULT_MIN_INT
398 #define SLJIT_CONV_NAN_FLOAT SLJIT_CONV_RESULT_MIN_INT
399 #elif (defined SLJIT_CONFIG_RISCV && SLJIT_CONFIG_RISCV)
400 #define SLJIT_CONV_MAX_FLOAT SLJIT_CONV_RESULT_MAX_INT
401 #define SLJIT_CONV_MIN_FLOAT SLJIT_CONV_RESULT_MIN_INT
402 #define SLJIT_CONV_NAN_FLOAT SLJIT_CONV_RESULT_MAX_INT
403 #elif (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
404 #define SLJIT_CONV_MAX_FLOAT SLJIT_CONV_RESULT_MAX_INT
405 #define SLJIT_CONV_MIN_FLOAT SLJIT_CONV_RESULT_MIN_INT
406 #define SLJIT_CONV_NAN_FLOAT SLJIT_CONV_RESULT_MIN_INT
407 #elif (defined SLJIT_CONFIG_LOONGARCH && SLJIT_CONFIG_LOONGARCH)
408 #define SLJIT_CONV_MAX_FLOAT SLJIT_CONV_RESULT_MAX_INT
409 #define SLJIT_CONV_MIN_FLOAT SLJIT_CONV_RESULT_MIN_INT
410 #define SLJIT_CONV_NAN_FLOAT SLJIT_CONV_RESULT_ZERO
411 #else
412 #error "Result for float to integer conversion is not defined"
413 #endif
414 
415 #ifndef SLJIT_W
416 
417 /* Defining long constants. */
418 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
419 #ifdef _WIN64
420 #define SLJIT_W(w) (w##ll)
421 #else /* !windows */
422 #define SLJIT_W(w) (w##l)
423 #endif /* windows */
424 #else /* 32 bit */
425 #define SLJIT_W(w) (w)
426 #endif /* unknown */
427 
428 #endif /* !SLJIT_W */
429 
430 /*************************/
431 /* Endianness detection. */
432 /*************************/
433 
434 #if !defined(SLJIT_BIG_ENDIAN) && !defined(SLJIT_LITTLE_ENDIAN)
435 
436 /* These macros are mostly useful for the applications. */
437 #if (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
438 
439 #ifdef __LITTLE_ENDIAN__
440 #define SLJIT_LITTLE_ENDIAN 1
441 #else
442 #define SLJIT_BIG_ENDIAN 1
443 #endif
444 
445 #elif (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
446 
447 #ifdef __MIPSEL__
448 #define SLJIT_LITTLE_ENDIAN 1
449 #else
450 #define SLJIT_BIG_ENDIAN 1
451 #endif
452 
453 #ifndef SLJIT_MIPS_REV
454 
455 /* Auto detecting mips revision. */
456 #if (defined __mips_isa_rev) && (__mips_isa_rev >= 6)
457 #define SLJIT_MIPS_REV 6
458 #elif defined(__mips_isa_rev) && __mips_isa_rev >= 1
459 #define SLJIT_MIPS_REV __mips_isa_rev
460 #elif defined(__clang__) \
461  && (defined(_MIPS_ARCH_OCTEON) || defined(_MIPS_ARCH_P5600))
462 /* clang either forgets to define (clang-7) __mips_isa_rev at all
463  * or sets it to zero (clang-8,-9) for -march=octeon (MIPS64 R2+)
464  * and -march=p5600 (MIPS32 R5).
465  * It also sets the __mips macro to 64 or 32 for -mipsN when N <= 5
466  * (should be set to N exactly) so we cannot rely on this too.
467  */
468 #define SLJIT_MIPS_REV 1
469 #endif
470 
471 #endif /* !SLJIT_MIPS_REV */
472 
473 #elif (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
474 
475 #define SLJIT_BIG_ENDIAN 1
476 
477 #else
478 #define SLJIT_LITTLE_ENDIAN 1
479 #endif
480 
481 #endif /* !defined(SLJIT_BIG_ENDIAN) && !defined(SLJIT_LITTLE_ENDIAN) */
482 
483 /* Sanity check. */
484 #if (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN) && (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
485 #error "Exactly one endianness must be selected"
486 #endif
487 
488 #if !(defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN) && !(defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
489 #error "Exactly one endianness must be selected"
490 #endif
491 
492 #ifndef SLJIT_UNALIGNED
493 
494 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) \
495  || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
496  || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) \
497  || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
498  || (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC) \
499  || (defined SLJIT_CONFIG_RISCV && SLJIT_CONFIG_RISCV) \
500  || (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X) \
501  || (defined SLJIT_CONFIG_LOONGARCH && SLJIT_CONFIG_LOONGARCH)
502 #define SLJIT_UNALIGNED 1
503 #endif
504 
505 #endif /* !SLJIT_UNALIGNED */
506 
507 #ifndef SLJIT_FPU_UNALIGNED
508 
509 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) \
510  || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
511  || (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC) \
512  || (defined SLJIT_CONFIG_RISCV && SLJIT_CONFIG_RISCV) \
513  || (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X) \
514  || (defined SLJIT_CONFIG_LOONGARCH && SLJIT_CONFIG_LOONGARCH)
515 #define SLJIT_FPU_UNALIGNED 1
516 #endif
517 
518 #endif /* !SLJIT_FPU_UNALIGNED */
519 
520 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
521 /* Auto detect SSE2 support using CPUID.
522  On 64 bit x86 cpus, sse2 must be present. */
523 #define SLJIT_DETECT_SSE2 1
524 #endif
525 
526 /*****************************************************************************************/
527 /* Calling convention of functions generated by SLJIT or called from the generated code. */
528 /*****************************************************************************************/
529 
530 #ifndef SLJIT_FUNC
531 #define SLJIT_FUNC
532 #endif /* !SLJIT_FUNC */
533 
534 #ifndef SLJIT_INDIRECT_CALL
535 #if ((defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) && (!defined _CALL_ELF || _CALL_ELF == 1)) \
536  || ((defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) && defined _AIX)
537 /* It seems certain ppc compilers use an indirect addressing for functions
538  which makes things complicated. */
539 #define SLJIT_INDIRECT_CALL 1
540 #endif
541 #endif /* SLJIT_INDIRECT_CALL */
542 
543 /* The offset which needs to be subtracted from the return address to
544 determine the next executed instruction after return. */
545 #ifndef SLJIT_RETURN_ADDRESS_OFFSET
546 #define SLJIT_RETURN_ADDRESS_OFFSET 0
547 #endif /* SLJIT_RETURN_ADDRESS_OFFSET */
548 
549 /***************************************************/
550 /* Functions of the built-in executable allocator. */
551 /***************************************************/
552 
553 #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
557 #define SLJIT_BUILTIN_MALLOC_EXEC(size, exec_allocator_data) sljit_malloc_exec(size)
558 #define SLJIT_BUILTIN_FREE_EXEC(ptr, exec_allocator_data) sljit_free_exec(ptr)
559 
560 #ifndef SLJIT_MALLOC_EXEC
561 #define SLJIT_MALLOC_EXEC(size, exec_allocator_data) SLJIT_BUILTIN_MALLOC_EXEC((size), (exec_allocator_data))
562 #endif /* SLJIT_MALLOC_EXEC */
563 
564 #ifndef SLJIT_FREE_EXEC
565 #define SLJIT_FREE_EXEC(ptr, exec_allocator_data) SLJIT_BUILTIN_FREE_EXEC((ptr), (exec_allocator_data))
566 #endif /* SLJIT_FREE_EXEC */
567 
568 #if (defined SLJIT_PROT_EXECUTABLE_ALLOCATOR && SLJIT_PROT_EXECUTABLE_ALLOCATOR)
569 SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
570 #define SLJIT_EXEC_OFFSET(code) sljit_exec_offset(code)
571 #endif /* SLJIT_PROT_EXECUTABLE_ALLOCATOR */
572 
573 #endif /* SLJIT_EXECUTABLE_ALLOCATOR */
574 
575 #ifndef SLJIT_EXEC_OFFSET
576 #define SLJIT_EXEC_OFFSET(ptr) 0
577 #endif
578 
579 /**********************************************/
580 /* Registers and locals offset determination. */
581 /**********************************************/
582 
583 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
584 
585 #define SLJIT_NUMBER_OF_REGISTERS 12
586 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 7
587 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 1
588 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 7
589 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 0
590 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 1
591 #define SLJIT_TMP_DEST_REG SLJIT_TMP_R0
592 #define SLJIT_TMP_MEM_REG SLJIT_TMP_R0
593 #define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
594 #define SLJIT_LOCALS_OFFSET_BASE (8 * SSIZE_OF(sw))
595 #define SLJIT_PREF_SHIFT_REG SLJIT_R2
596 #define SLJIT_MASKED_SHIFT 1
597 #define SLJIT_MASKED_SHIFT32 1
598 
599 #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
600 
601 #define SLJIT_NUMBER_OF_REGISTERS 13
602 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 2
603 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 15
604 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 1
605 #ifndef _WIN64
606 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 6
607 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 0
608 #define SLJIT_LOCALS_OFFSET_BASE 0
609 #else /* _WIN64 */
610 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
611 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 10
612 #define SLJIT_LOCALS_OFFSET_BASE (4 * SSIZE_OF(sw))
613 #endif /* !_WIN64 */
614 #define SLJIT_TMP_DEST_REG SLJIT_TMP_R0
615 #define SLJIT_TMP_MEM_REG SLJIT_TMP_R0
616 #define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
617 #define SLJIT_PREF_SHIFT_REG SLJIT_R3
618 #define SLJIT_MASKED_SHIFT 1
619 #define SLJIT_MASKED_SHIFT32 1
620 
621 #elif (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32)
622 
623 #define SLJIT_NUMBER_OF_REGISTERS 12
624 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
625 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 2
626 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 14
627 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 8
628 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 2
629 #define SLJIT_TMP_DEST_REG SLJIT_TMP_R1
630 #define SLJIT_TMP_MEM_REG SLJIT_TMP_R1
631 #define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
632 #define SLJIT_LOCALS_OFFSET_BASE 0
633 
634 #elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
635 
636 #define SLJIT_NUMBER_OF_REGISTERS 26
637 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 10
638 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 3
639 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 30
640 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 8
641 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 2
642 #define SLJIT_TMP_DEST_REG SLJIT_TMP_R0
643 #define SLJIT_TMP_MEM_REG SLJIT_TMP_R0
644 #define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
645 #define SLJIT_LOCALS_OFFSET_BASE (2 * (sljit_s32)sizeof(sljit_sw))
646 #define SLJIT_MASKED_SHIFT 1
647 #define SLJIT_MASKED_SHIFT32 1
648 
649 #elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
650 
651 #define SLJIT_NUMBER_OF_REGISTERS 23
652 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 17
653 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 3
654 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 30
655 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 18
656 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 2
657 #define SLJIT_TMP_DEST_REG SLJIT_TMP_R1
658 #define SLJIT_TMP_MEM_REG SLJIT_TMP_R1
659 #define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
660 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) || (defined _AIX)
661 #define SLJIT_LOCALS_OFFSET_BASE ((6 + 8) * (sljit_s32)sizeof(sljit_sw))
662 #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
663 /* Add +1 for double alignment. */
664 #define SLJIT_LOCALS_OFFSET_BASE ((3 + 1) * (sljit_s32)sizeof(sljit_sw))
665 #else
666 #define SLJIT_LOCALS_OFFSET_BASE (3 * (sljit_s32)sizeof(sljit_sw))
667 #endif /* SLJIT_CONFIG_PPC_64 || _AIX */
668 
669 #elif (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
670 
671 #define SLJIT_NUMBER_OF_REGISTERS 21
672 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
673 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
674 #define SLJIT_LOCALS_OFFSET_BASE (4 * (sljit_s32)sizeof(sljit_sw))
675 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 13
676 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 6
677 #else
678 #define SLJIT_LOCALS_OFFSET_BASE 0
679 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 29
680 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 8
681 #endif
682 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 5
683 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 3
684 #define SLJIT_TMP_DEST_REG SLJIT_TMP_R1
685 #define SLJIT_TMP_MEM_REG SLJIT_TMP_R1
686 #define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
687 #define SLJIT_MASKED_SHIFT 1
688 #define SLJIT_MASKED_SHIFT32 1
689 
690 #elif (defined SLJIT_CONFIG_RISCV && SLJIT_CONFIG_RISCV)
691 
692 #define SLJIT_NUMBER_OF_REGISTERS 23
693 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 12
694 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 5
695 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 30
696 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 12
697 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 2
698 #define SLJIT_TMP_DEST_REG SLJIT_TMP_R1
699 #define SLJIT_TMP_MEM_REG SLJIT_TMP_R1
700 #define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
701 #define SLJIT_LOCALS_OFFSET_BASE 0
702 #define SLJIT_MASKED_SHIFT 1
703 #define SLJIT_MASKED_SHIFT32 1
704 
705 #elif (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
706 
707 /*
708  * https://refspecs.linuxbase.org/ELF/zSeries/lzsabi0_zSeries.html#STACKFRAME
709  *
710  * 160
711  * .. FR6
712  * .. FR4
713  * .. FR2
714  * 128 FR0
715  * 120 R15 (used for SP)
716  * 112 R14
717  * 104 R13
718  * 96 R12
719  * ..
720  * 48 R6
721  * ..
722  * 16 R2
723  * 8 RESERVED
724  * 0 SP
725  */
726 #define SLJIT_S390X_DEFAULT_STACK_FRAME_SIZE 160
727 
728 #define SLJIT_NUMBER_OF_REGISTERS 12
729 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
730 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 3
731 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 15
732 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 8
733 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 1
734 #define SLJIT_TMP_DEST_REG SLJIT_TMP_R0
735 #define SLJIT_TMP_MEM_REG SLJIT_TMP_R2
736 #define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
737 #define SLJIT_LOCALS_OFFSET_BASE SLJIT_S390X_DEFAULT_STACK_FRAME_SIZE
738 #define SLJIT_MASKED_SHIFT 1
739 
740 #elif (defined SLJIT_CONFIG_LOONGARCH && SLJIT_CONFIG_LOONGARCH)
741 
742 #define SLJIT_NUMBER_OF_REGISTERS 23
743 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 10
744 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 5
745 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 30
746 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 12
747 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 2
748 #define SLJIT_TMP_DEST_REG SLJIT_TMP_R1
749 #define SLJIT_TMP_MEM_REG SLJIT_TMP_R1
750 #define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
751 #define SLJIT_LOCALS_OFFSET_BASE 0
752 #define SLJIT_MASKED_SHIFT 1
753 #define SLJIT_MASKED_SHIFT32 1
754 
755 #elif (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
756 
757 /* Just to have something. */
758 #define SLJIT_NUMBER_OF_REGISTERS 0
759 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 0
760 #define SLJIT_NUMBER_OF_TEMPORARY_REGISTERS 0
761 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 0
762 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 0
763 #define SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS 0
764 #define SLJIT_TMP_DEST_REG 0
765 #define SLJIT_TMP_MEM_REG 0
766 #define SLJIT_TMP_DEST_FREG 0
767 #define SLJIT_LOCALS_OFFSET_BASE 0
768 
769 #endif
770 
771 #define SLJIT_LOCALS_OFFSET (SLJIT_LOCALS_OFFSET_BASE)
772 
773 #define SLJIT_NUMBER_OF_SCRATCH_REGISTERS \
774  (SLJIT_NUMBER_OF_REGISTERS - SLJIT_NUMBER_OF_SAVED_REGISTERS)
775 
776 #define SLJIT_NUMBER_OF_SCRATCH_FLOAT_REGISTERS \
777  (SLJIT_NUMBER_OF_FLOAT_REGISTERS - SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS)
778 
779 /**********************************/
780 /* Temporary register management. */
781 /**********************************/
782 
783 #define SLJIT_TMP_REGISTER_BASE (SLJIT_NUMBER_OF_REGISTERS + 2)
784 #define SLJIT_TMP_FREGISTER_BASE (SLJIT_NUMBER_OF_FLOAT_REGISTERS + 1)
785 
786 /* WARNING: Accessing temporary registers is not recommended, because they
787  are also used by the JIT compiler for various computations. Using them
788  might have any side effects including incorrect operations and crashes,
789  so use them at your own risk. The machine registers themselves might have
790  limitations, e.g. the r0 register on s390x / ppc cannot be used as
791  base address for memory operations. */
792 
793 /* Temporary registers */
794 #define SLJIT_TMP_R0 (SLJIT_TMP_REGISTER_BASE + 0)
795 #define SLJIT_TMP_R1 (SLJIT_TMP_REGISTER_BASE + 1)
796 #define SLJIT_TMP_R2 (SLJIT_TMP_REGISTER_BASE + 2)
797 #define SLJIT_TMP_R3 (SLJIT_TMP_REGISTER_BASE + 3)
798 #define SLJIT_TMP_R4 (SLJIT_TMP_REGISTER_BASE + 4)
799 #define SLJIT_TMP_R5 (SLJIT_TMP_REGISTER_BASE + 5)
800 #define SLJIT_TMP_R6 (SLJIT_TMP_REGISTER_BASE + 6)
801 #define SLJIT_TMP_R7 (SLJIT_TMP_REGISTER_BASE + 7)
802 #define SLJIT_TMP_R8 (SLJIT_TMP_REGISTER_BASE + 8)
803 #define SLJIT_TMP_R9 (SLJIT_TMP_REGISTER_BASE + 9)
804 #define SLJIT_TMP_R(i) (SLJIT_TMP_REGISTER_BASE + (i))
805 
806 #define SLJIT_TMP_FR0 (SLJIT_TMP_FREGISTER_BASE + 0)
807 #define SLJIT_TMP_FR1 (SLJIT_TMP_FREGISTER_BASE + 1)
808 #define SLJIT_TMP_FR2 (SLJIT_TMP_FREGISTER_BASE + 2)
809 #define SLJIT_TMP_FR3 (SLJIT_TMP_FREGISTER_BASE + 3)
810 #define SLJIT_TMP_FR4 (SLJIT_TMP_FREGISTER_BASE + 4)
811 #define SLJIT_TMP_FR5 (SLJIT_TMP_FREGISTER_BASE + 5)
812 #define SLJIT_TMP_FR6 (SLJIT_TMP_FREGISTER_BASE + 6)
813 #define SLJIT_TMP_FR7 (SLJIT_TMP_FREGISTER_BASE + 7)
814 #define SLJIT_TMP_FR8 (SLJIT_TMP_FREGISTER_BASE + 8)
815 #define SLJIT_TMP_FR9 (SLJIT_TMP_FREGISTER_BASE + 9)
816 #define SLJIT_TMP_FR(i) (SLJIT_TMP_FREGISTER_BASE + (i))
817 
818 /********************************/
819 /* CPU status flags management. */
820 /********************************/
821 
822 #if (defined SLJIT_CONFIG_ARM && SLJIT_CONFIG_ARM) \
823  || (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC) \
824  || (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS) \
825  || (defined SLJIT_CONFIG_RISCV && SLJIT_CONFIG_RISCV) \
826  || (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X) \
827  || (defined SLJIT_CONFIG_LOONGARCH && SLJIT_CONFIG_LOONGARCH)
828 #define SLJIT_HAS_STATUS_FLAGS_STATE 1
829 #endif
830 
831 /***************************************/
832 /* Floating point register management. */
833 /***************************************/
834 
835 #if (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32) \
836  || (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
837 #define SLJIT_F64_SECOND(reg) \
838  ((reg) + SLJIT_FS0 + SLJIT_NUMBER_OF_TEMPORARY_FLOAT_REGISTERS)
839 #else /* !SLJIT_CONFIG_ARM_32 && !SLJIT_CONFIG_MIPS_32 */
840 #define SLJIT_F64_SECOND(reg) \
841  (reg)
842 #endif /* SLJIT_CONFIG_ARM_32 || SLJIT_CONFIG_MIPS_32 */
843 
844 /*************************************/
845 /* Debug and verbose related macros. */
846 /*************************************/
847 
848 #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
849 
850 #if !defined(SLJIT_ASSERT) || !defined(SLJIT_UNREACHABLE)
851 
852 /* SLJIT_HALT_PROCESS must halt the process. */
853 #ifndef SLJIT_HALT_PROCESS
854 #define SLJIT_HALT_PROCESS() \
855  abort();
856 #endif /* !SLJIT_HALT_PROCESS */
857 
858 #endif /* !SLJIT_ASSERT || !SLJIT_UNREACHABLE */
859 
860 /* Feel free to redefine these two macros. */
861 #ifndef SLJIT_ASSERT
862 
863 #define SLJIT_ASSERT(x) \
864  do { \
865  if (SLJIT_UNLIKELY(!(x))) { \
866  printf("Assertion failed at " __FILE__ ":%d\n", __LINE__); \
867  SLJIT_HALT_PROCESS(); \
868  } \
869  } while (0)
870 
871 #endif /* !SLJIT_ASSERT */
872 
873 #ifndef SLJIT_UNREACHABLE
874 
875 #define SLJIT_UNREACHABLE() \
876  do { \
877  printf("Should never been reached " __FILE__ ":%d\n", __LINE__); \
878  SLJIT_HALT_PROCESS(); \
879  } while (0)
880 
881 #endif /* !SLJIT_UNREACHABLE */
882 
883 #else /* (defined SLJIT_DEBUG && SLJIT_DEBUG) */
884 
885 /* Forcing empty, but valid statements. */
886 #undef SLJIT_ASSERT
887 #undef SLJIT_UNREACHABLE
888 
889 #define SLJIT_ASSERT(x) \
890  do { } while (0)
891 #define SLJIT_UNREACHABLE() \
892  do { } while (0)
893 
894 #endif /* (defined SLJIT_DEBUG && SLJIT_DEBUG) */
895 
896 #ifndef SLJIT_COMPILE_ASSERT
897 
898 #define SLJIT_COMPILE_ASSERT(x, description) \
899  switch(0) { case 0: case ((x) ? 1 : 0): break; }
900 
901 #endif /* !SLJIT_COMPILE_ASSERT */
902 
903 #ifdef __cplusplus
904 } /* extern "C" */
905 #endif
906 
907 #endif /* SLJIT_CONFIG_INTERNAL_H_ */
const struct ncbi::grid::netcache::search::fields::SIZE size
sljit_uw sljit_up
unsigned short int sljit_u16
signed short int sljit_s16
#define SLJIT_API_FUNC_ATTRIBUTE
unsigned int sljit_uw
unsigned char sljit_u8
sljit_sw sljit_sp
signed int sljit_s32
unsigned int sljit_u32
signed char sljit_s8
float sljit_f32
double sljit_f64
int sljit_sw
SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void *ptr)
SLJIT_API_FUNC_ATTRIBUTE void * sljit_malloc_exec(sljit_uw size)
SLJIT_API_FUNC_ATTRIBUTE void sljit_free_unused_memory_exec(void)
#define __int64
Definition: sse2neon.h:208
Definition: inftrees.h:24
Modified on Fri Sep 20 14:57:50 2024 by modify_doxy.py rev. 669887