1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #ifndef _SLJIT_CONFIG_INTERNAL_H_
28 #define _SLJIT_CONFIG_INTERNAL_H_
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 #if !((defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) \
76 || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \
77 || (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) \
78 || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
79 || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) \
80 || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
81 || (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \
82 || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \
83 || (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \
84 || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) \
85 || (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) \
86 || (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX) \
87 || (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO) \
88 || (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED))
89 #error "An architecture must be selected"
90 #endif
91
92 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) \
93 + (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \
94 + (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) \
95 + (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
96 + (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) \
97 + (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
98 + (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \
99 + (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \
100 + (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX) \
101 + (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \
102 + (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) \
103 + (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) \
104 + (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO) \
105 + (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED) >= 2
106 #error "Multiple architectures are selected"
107 #endif
108
109
110
111
112
113 #if (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO)
114
115 #ifndef _WIN32
116
117 #if defined(__i386__) || defined(__i386)
118 #define SLJIT_CONFIG_X86_32 1
119 #elif defined(__x86_64__)
120 #define SLJIT_CONFIG_X86_64 1
121 #elif defined(__arm__) || defined(__ARM__)
122 #ifdef __thumb2__
123 #define SLJIT_CONFIG_ARM_THUMB2 1
124 #elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__)
125 #define SLJIT_CONFIG_ARM_V7 1
126 #else
127 #define SLJIT_CONFIG_ARM_V5 1
128 #endif
129 #elif defined (__aarch64__)
130 #define SLJIT_CONFIG_ARM_64 1
131 #elif defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_PPC64) || (defined(_POWER) && defined(__64BIT__))
132 #define SLJIT_CONFIG_PPC_64 1
133 #elif defined(__ppc__) || defined(__powerpc__) || defined(_ARCH_PPC) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_POWER)
134 #define SLJIT_CONFIG_PPC_32 1
135 #elif defined(__mips__) && !defined(_LP64)
136 #define SLJIT_CONFIG_MIPS_32 1
137 #elif defined(__mips64)
138 #define SLJIT_CONFIG_MIPS_64 1
139 #elif defined(__sparc__) || defined(__sparc)
140 #define SLJIT_CONFIG_SPARC_32 1
141 #elif defined(__tilegx__)
142 #define SLJIT_CONFIG_TILEGX 1
143 #else
144
145 #define SLJIT_CONFIG_UNSUPPORTED 1
146 #endif
147
148 #else
149
150 #if defined(_M_X64) || defined(__x86_64__)
151 #define SLJIT_CONFIG_X86_64 1
152 #elif defined(_ARM_)
153 #define SLJIT_CONFIG_ARM_V5 1
154 #else
155 #define SLJIT_CONFIG_X86_32 1
156 #endif
157
158 #endif
159 #endif
160
161 #if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
162 #undef SLJIT_EXECUTABLE_ALLOCATOR
163 #endif
164
165
166
167
168
169 #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
170 || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
171 #define SLJIT_CONFIG_ARM_32 1
172 #endif
173
174 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
175 #define SLJIT_CONFIG_X86 1
176 #elif (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32) || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
177 #define SLJIT_CONFIG_ARM 1
178 #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
179 #define SLJIT_CONFIG_PPC 1
180 #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
181 #define SLJIT_CONFIG_MIPS 1
182 #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) || (defined SLJIT_CONFIG_SPARC_64 && SLJIT_CONFIG_SPARC_64)
183 #define SLJIT_CONFIG_SPARC 1
184 #endif
185
186
187
188
189
190 #if !(defined SLJIT_STD_MACROS_DEFINED && SLJIT_STD_MACROS_DEFINED)
191
192
193 #include <stdlib.h>
194 #include <string.h>
195
196 #endif
197
198
199
200
201
202
203
204
205 #ifndef SLJIT_MALLOC
206 #define SLJIT_MALLOC(size, allocator_data) malloc(size)
207 #endif
208
209 #ifndef SLJIT_FREE
210 #define SLJIT_FREE(ptr, allocator_data) free(ptr)
211 #endif
212
213 #ifndef SLJIT_MEMMOVE
214 #define SLJIT_MEMMOVE(dest, src, len) memmove(dest, src, len)
215 #endif
216
217 #ifndef SLJIT_ZEROMEM
218 #define SLJIT_ZEROMEM(dest, len) memset(dest, 0, len)
219 #endif
220
221
222
223
224
225 #if !defined(SLJIT_LIKELY) && !defined(SLJIT_UNLIKELY)
226
227 #if defined(__GNUC__) && (__GNUC__ >= 3)
228 #define SLJIT_LIKELY(x) __builtin_expect((x), 1)
229 #define SLJIT_UNLIKELY(x) __builtin_expect((x), 0)
230 #else
231 #define SLJIT_LIKELY(x) (x)
232 #define SLJIT_UNLIKELY(x) (x)
233 #endif
234
235 #endif
236
237 #ifndef SLJIT_INLINE
238
239 #if defined(__SUNPRO_C) && __SUNPRO_C <= 0x510
240 #define SLJIT_INLINE
241 #else
242 #define SLJIT_INLINE __inline
243 #endif
244 #endif
245
246 #ifndef SLJIT_NOINLINE
247
248 #if defined(__GNUC__)
249 #define SLJIT_NOINLINE __attribute__ ((noinline))
250 #else
251 #define SLJIT_NOINLINE
252 #endif
253 #endif
254
255 #ifndef SLJIT_CONST
256
257 #define SLJIT_CONST const
258 #endif
259
260 #ifndef SLJIT_UNUSED_ARG
261
262 #define SLJIT_UNUSED_ARG(arg) (void)arg
263 #endif
264
265
266
267
268
269 #if (defined SLJIT_CONFIG_STATIC && SLJIT_CONFIG_STATIC)
270
271
272 #if defined(__GNUC__)
273
274 #define SLJIT_API_FUNC_ATTRIBUTE static __attribute__((unused))
275 #else
276 #define SLJIT_API_FUNC_ATTRIBUTE static
277 #endif
278
279 #else
280 #define SLJIT_API_FUNC_ATTRIBUTE
281 #endif
282
283
284
285
286
287 #ifndef SLJIT_CACHE_FLUSH
288
289 #if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
290
291
292 #define SLJIT_CACHE_FLUSH(from, to)
293
294 #elif defined __APPLE__
295
296
297
298
299
300 #define SLJIT_CACHE_FLUSH(from, to) \
301 sys_icache_invalidate((char*)(from), (char*)(to) - (char*)(from))
302
303 #elif defined __ANDROID__
304
305
306
307 #define SLJIT_CACHE_FLUSH(from, to) \
308 cacheflush((long)(from), (long)(to), 0)
309
310 #elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
311
312
313 #define SLJIT_CACHE_FLUSH(from, to) \
314 ppc_cache_flush((from), (to))
315
316 #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
317
318
319 #define SLJIT_CACHE_FLUSH(from, to) \
320 sparc_cache_flush((from), (to))
321
322 #else
323
324
325 #define SLJIT_CACHE_FLUSH(from, to) \
326 __clear_cache((char*)(from), (char*)(to))
327
328 #endif
329
330 #endif
331
332
333
334
335
336
337 typedef unsigned char sljit_ub;
338 typedef signed char sljit_sb;
339
340
341 typedef unsigned short int sljit_uh;
342 typedef signed short int sljit_sh;
343
344
345 typedef unsigned int sljit_ui;
346 typedef signed int sljit_si;
347
348
349
350
351 #if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
352
353 #define SLJIT_WORD_SHIFT 0
354 typedef unsigned long int sljit_uw;
355 typedef long int sljit_sw;
356 #elif !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \
357 && !(defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
358 && !(defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \
359 && !(defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) \
360 && !(defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
361 #define SLJIT_32BIT_ARCHITECTURE 1
362 #define SLJIT_WORD_SHIFT 2
363 typedef unsigned int sljit_uw;
364 typedef int sljit_sw;
365 #else
366 #define SLJIT_64BIT_ARCHITECTURE 1
367 #define SLJIT_WORD_SHIFT 3
368 #ifdef _WIN32
369 typedef unsigned __int64 sljit_uw;
370 typedef __int64 sljit_sw;
371 #else
372 typedef unsigned long int sljit_uw;
373 typedef long int sljit_sw;
374 #endif
375 #endif
376
377 typedef sljit_uw sljit_p;
378
379
380 typedef float sljit_s;
381 typedef double sljit_d;
382
383
384 #define SLJIT_POINTER_SHIFT SLJIT_WORD_SHIFT
385
386
387 #define SLJIT_DOUBLE_SHIFT 3
388 #define SLJIT_SINGLE_SHIFT 2
389
390 #ifndef SLJIT_W
391
392
393 #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
394 #define SLJIT_W(w) (w##ll)
395 #else
396 #define SLJIT_W(w) (w)
397 #endif
398
399 #endif
400
401
402
403
404
405 #if !defined(SLJIT_BIG_ENDIAN) && !defined(SLJIT_LITTLE_ENDIAN)
406
407
408 #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \
409 || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
410
411 #ifdef __LITTLE_ENDIAN__
412 #define SLJIT_LITTLE_ENDIAN 1
413 #else
414 #define SLJIT_BIG_ENDIAN 1
415 #endif
416
417 #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \
418 || (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
419
420 #ifdef __MIPSEL__
421 #define SLJIT_LITTLE_ENDIAN 1
422 #else
423 #define SLJIT_BIG_ENDIAN 1
424 #endif
425
426 #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
427
428 #define SLJIT_BIG_ENDIAN 1
429
430 #else
431 #define SLJIT_LITTLE_ENDIAN 1
432 #endif
433
434 #endif
435
436
437 #if (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN) && (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
438 #error "Exactly one endianness must be selected"
439 #endif
440
441 #if !(defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN) && !(defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
442 #error "Exactly one endianness must be selected"
443 #endif
444
445 #ifndef SLJIT_UNALIGNED
446
447 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) \
448 || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) \
449 || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
450 || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) \
451 || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
452 || (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \
453 || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
454 #define SLJIT_UNALIGNED 1
455 #endif
456
457 #endif
458
459 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
460
461
462 #define SLJIT_DETECT_SSE2 1
463 #endif
464
465
466
467
468
469 #ifndef SLJIT_CALL
470
471 #if (defined SLJIT_USE_CDECL_CALLING_CONVENTION && SLJIT_USE_CDECL_CALLING_CONVENTION)
472
473
474 #define SLJIT_CALL
475
476 #elif (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
477
478 #if defined(__GNUC__) && !defined(__APPLE__)
479
480 #define SLJIT_CALL __attribute__ ((fastcall))
481 #define SLJIT_X86_32_FASTCALL 1
482
483 #elif defined(_MSC_VER)
484
485 #define SLJIT_CALL __fastcall
486 #define SLJIT_X86_32_FASTCALL 1
487
488 #elif defined(__BORLANDC__)
489
490 #define SLJIT_CALL __msfastcall
491 #define SLJIT_X86_32_FASTCALL 1
492
493 #else
494
495
496 #define SLJIT_CALL
497
498 #endif
499
500 #else
501
502 #define SLJIT_CALL
503
504 #endif
505
506 #endif
507
508 #ifndef SLJIT_INDIRECT_CALL
509 #if ((defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) && (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN)) \
510 || ((defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) && defined _AIX)
511
512
513 #define SLJIT_INDIRECT_CALL 1
514 #endif
515 #endif
516
517
518
519 #ifndef SLJIT_RETURN_ADDRESS_OFFSET
520 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
521 #define SLJIT_RETURN_ADDRESS_OFFSET 8
522 #else
523 #define SLJIT_RETURN_ADDRESS_OFFSET 0
524 #endif
525 #endif
526
527
528
529
530
531 #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
532 SLJIT_API_FUNC_ATTRIBUTE void* sljit_malloc_exec(sljit_uw size);
533 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void* ptr);
534 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_unused_memory_exec(void);
535 #define SLJIT_MALLOC_EXEC(size) sljit_malloc_exec(size)
536 #define SLJIT_FREE_EXEC(ptr) sljit_free_exec(ptr)
537 #endif
538
539
540
541
542
543 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
544
545 #define SLJIT_NUMBER_OF_REGISTERS 10
546 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 7
547 #if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
548 #define SLJIT_LOCALS_OFFSET_BASE ((2 + 4) * sizeof(sljit_sw))
549 #else
550
551 #define SLJIT_LOCALS_OFFSET_BASE ((3 + 1 + 4) * sizeof(sljit_sw))
552 #endif
553
554 #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
555
556 #ifndef _WIN64
557 #define SLJIT_NUMBER_OF_REGISTERS 12
558 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 6
559 #define SLJIT_LOCALS_OFFSET_BASE (sizeof(sljit_sw))
560 #else
561 #define SLJIT_NUMBER_OF_REGISTERS 12
562 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
563 #define SLJIT_LOCALS_OFFSET_BASE ((4 + 2) * sizeof(sljit_sw))
564 #endif
565
566 #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
567
568 #define SLJIT_NUMBER_OF_REGISTERS 11
569 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
570 #define SLJIT_LOCALS_OFFSET_BASE 0
571
572 #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
573
574 #define SLJIT_NUMBER_OF_REGISTERS 11
575 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 7
576 #define SLJIT_LOCALS_OFFSET_BASE 0
577
578 #elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
579
580 #define SLJIT_NUMBER_OF_REGISTERS 25
581 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 10
582 #define SLJIT_LOCALS_OFFSET_BASE (2 * sizeof(sljit_sw))
583
584 #elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
585
586 #define SLJIT_NUMBER_OF_REGISTERS 22
587 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 17
588 #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) || (defined _AIX)
589 #define SLJIT_LOCALS_OFFSET_BASE ((6 + 8) * sizeof(sljit_sw))
590 #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
591
592 #define SLJIT_LOCALS_OFFSET_BASE ((3 + 1) * sizeof(sljit_sw))
593 #else
594 #define SLJIT_LOCALS_OFFSET_BASE (3 * sizeof(sljit_sw))
595 #endif
596
597 #elif (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
598
599 #define SLJIT_NUMBER_OF_REGISTERS 17
600 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 8
601 #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
602 #define SLJIT_LOCALS_OFFSET_BASE (4 * sizeof(sljit_sw))
603 #else
604 #define SLJIT_LOCALS_OFFSET_BASE 0
605 #endif
606
607 #elif (defined SLJIT_CONFIG_SPARC && SLJIT_CONFIG_SPARC)
608
609 #define SLJIT_NUMBER_OF_REGISTERS 18
610 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 14
611 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
612
613 #define SLJIT_LOCALS_OFFSET_BASE ((23 + 1) * sizeof(sljit_sw))
614 #endif
615
616 #elif (defined SLJIT_CONFIG_TILEGX && SLJIT_CONFIG_TILEGX)
617
618 #define SLJIT_NUMBER_OF_REGISTERS 10
619 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 5
620 #define SLJIT_LOCALS_OFFSET_BASE 0
621
622 #elif (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
623
624 #define SLJIT_NUMBER_OF_REGISTERS 0
625 #define SLJIT_NUMBER_OF_SAVED_REGISTERS 0
626 #define SLJIT_LOCALS_OFFSET_BASE 0
627
628 #endif
629
630 #define SLJIT_LOCALS_OFFSET (SLJIT_LOCALS_OFFSET_BASE)
631
632 #define SLJIT_NUMBER_OF_SCRATCH_REGISTERS \
633 (SLJIT_NUMBER_OF_REGISTERS - SLJIT_NUMBER_OF_SAVED_REGISTERS)
634
635 #define SLJIT_NUMBER_OF_FLOAT_REGISTERS 6
636 #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && (defined _WIN64)
637 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 1
638 #else
639 #define SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS 0
640 #endif
641
642 #define SLJIT_NUMBER_OF_SCRATCH_FLOAT_REGISTERS \
643 (SLJIT_NUMBER_OF_FLOAT_REGISTERS - SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS)
644
645
646
647
648
649 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
650 #include <stdio.h>
651 #endif
652
653 #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
654
655 #if !defined(SLJIT_ASSERT) || !defined(SLJIT_ASSERT_STOP)
656
657
658 #ifndef SLJIT_HALT_PROCESS
659 #include <stdlib.h>
660
661 #define SLJIT_HALT_PROCESS() \
662 abort();
663 #endif
664
665 #include <stdio.h>
666
667 #endif
668
669
670 #ifndef SLJIT_ASSERT
671
672 #define SLJIT_ASSERT(x) \
673 do { \
674 if (SLJIT_UNLIKELY(!(x))) { \
675 printf("Assertion failed at " __FILE__ ":%d\n", __LINE__); \
676 SLJIT_HALT_PROCESS(); \
677 } \
678 } while (0)
679
680 #endif
681
682 #ifndef SLJIT_ASSERT_STOP
683
684 #define SLJIT_ASSERT_STOP() \
685 do { \
686 printf("Should never been reached " __FILE__ ":%d\n", __LINE__); \
687 SLJIT_HALT_PROCESS(); \
688 } while (0)
689
690 #endif
691
692 #else
693
694
695 #undef SLJIT_ASSERT
696 #undef SLJIT_ASSERT_STOP
697
698 #define SLJIT_ASSERT(x) \
699 do { } while (0)
700 #define SLJIT_ASSERT_STOP() \
701 do { } while (0)
702
703 #endif
704
705 #ifndef SLJIT_COMPILE_ASSERT
706
707
708 #define SLJIT_COMPILE_ASSERT(x, description) \
709 SLJIT_ASSERT(x)
710
711 #endif
712
713 #endif