|
version 1.1.1.1, 2012/02/21 23:05:52
|
version 1.1.1.3, 2012/10/09 09:19:18
|
|
Line 1
|
Line 1
|
| /* |
/* |
| * Stack-less Just-In-Time compiler |
* Stack-less Just-In-Time compiler |
| * |
* |
| * Copyright 2009-2010 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved. | * Copyright 2009-2012 Zoltan Herczeg (hzmester@freemail.hu). All rights reserved. |
| * |
* |
| * Redistribution and use in source and binary forms, with or without modification, are |
* Redistribution and use in source and binary forms, with or without modification, are |
| * permitted provided that the following conditions are met: |
* permitted provided that the following conditions are met: |
|
Line 28
|
Line 28
|
| #define _SLJIT_CONFIG_INTERNAL_H_ |
#define _SLJIT_CONFIG_INTERNAL_H_ |
| |
|
| /* |
/* |
| SLJIT defines the following variables itself depending on the configuration: | SLJIT defines the following macros depending on the target architecture: |
| sljit_b, sljit_ub : signed and unsigned 8 bit byte | |
| sljit_h, sljit_uh : signed and unsigned 16 bit half-word (short) type | Feature detection (boolean) macros: |
| sljit_i, sljit_ui : signed and unsigned 32 bit integer type | |
| sljit_w, sljit_uw : signed and unsigned machine word, enough to store a pointer (same as intptr_t) | |
| SLJIT_CALL : C calling convention for both calling JIT and C callbacks from JIT | |
| SLJIT_32BIT_ARCHITECTURE : 32 bit architecture |
SLJIT_32BIT_ARCHITECTURE : 32 bit architecture |
| SLJIT_64BIT_ARCHITECTURE : 64 bit architecture |
SLJIT_64BIT_ARCHITECTURE : 64 bit architecture |
| SLJIT_WORD_SHIFT : the shift required to apply when accessing a sljit_w/sljit_uw array by index |
SLJIT_WORD_SHIFT : the shift required to apply when accessing a sljit_w/sljit_uw array by index |
| SLJIT_FLOAT_SHIFT : the shift required to apply when accessing a double array by index |
SLJIT_FLOAT_SHIFT : the shift required to apply when accessing a double array by index |
| SLJIT_BIG_ENDIAN : big endian architecture |
|
| SLJIT_LITTLE_ENDIAN : little endian architecture |
SLJIT_LITTLE_ENDIAN : little endian architecture |
| SLJIT_INDIRECT_CALL : see SLJIT_FUNC_OFFSET() | SLJIT_BIG_ENDIAN : big endian architecture |
| SLJIT_W : for defining 64 bit constants on 64 bit architectures (compiler workaround) | SLJIT_UNALIGNED : allows unaligned memory accesses for non-fpu operations (only!) |
| SLJIT_UNALIGNED : allows unaligned memory accesses for integer arithmetic (only!) | SLJIT_INDIRECT_CALL : see SLJIT_FUNC_OFFSET() for more information |
| | |
| | Types and useful macros: |
| | sljit_b, sljit_ub : signed and unsigned 8 bit byte |
| | sljit_h, sljit_uh : signed and unsigned 16 bit half-word (short) type |
| | sljit_i, sljit_ui : signed and unsigned 32 bit integer type |
| | sljit_w, sljit_uw : signed and unsigned machine word, enough to store a pointer (same as intptr_t) |
| | SLJIT_CALL : C calling convention define for both calling JIT form C and C callbacks for JIT |
| | SLJIT_W(number) : defining 64 bit constants on 64 bit architectures (compiler independent helper) |
| */ |
*/ |
| |
|
| #if !((defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) \ |
#if !((defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) \ |
|
Line 190
|
Line 194
|
| |
|
| #ifndef SLJIT_CACHE_FLUSH |
#ifndef SLJIT_CACHE_FLUSH |
| |
|
| #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) | #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) |
| |
|
| |
/* Not required to implement on archs with unified caches. */ |
| |
#define SLJIT_CACHE_FLUSH(from, to) |
| |
|
| |
#elif defined __APPLE__ |
| |
|
| |
/* Supported by all macs since Mac OS 10.5. |
| |
However, it does not work on non-jailbroken iOS devices, |
| |
although the compilation is successful. */ |
| |
|
| |
#define SLJIT_CACHE_FLUSH(from, to) \ |
| |
sys_icache_invalidate((char*)(from), (char*)(to) - (char*)(from)) |
| |
|
| |
#elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) |
| |
|
| /* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */ |
/* The __clear_cache() implementation of GCC is a dummy function on PowerPC. */ |
| #define SLJIT_CACHE_FLUSH(from, to) \ |
#define SLJIT_CACHE_FLUSH(from, to) \ |
| ppc_cache_flush((from), (to)) |
ppc_cache_flush((from), (to)) |
| |
|
| #elif (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) |
|
| |
|
| /* Not required to implement on archs with unified caches. */ |
|
| #define SLJIT_CACHE_FLUSH(from, to) |
|
| |
|
| #else |
#else |
| |
|
| /* Calls __ARM_NR_cacheflush on ARM-Linux. */ |
/* Calls __ARM_NR_cacheflush on ARM-Linux. */ |
|
Line 226 typedef signed int sljit_i;
|
Line 239 typedef signed int sljit_i;
|
| /* Machine word type. Can encapsulate a pointer. |
/* Machine word type. Can encapsulate a pointer. |
| 32 bit for 32 bit machines. |
32 bit for 32 bit machines. |
| 64 bit for 64 bit machines. */ |
64 bit for 64 bit machines. */ |
| #if !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !(defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) | #if (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED) |
| | /* Just to have something. */ |
| | #define SLJIT_WORD_SHIFT 0 |
| | typedef unsigned long int sljit_uw; |
| | typedef long int sljit_w; |
| | #elif !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !(defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) |
| #define SLJIT_32BIT_ARCHITECTURE 1 |
#define SLJIT_32BIT_ARCHITECTURE 1 |
| #define SLJIT_WORD_SHIFT 2 |
#define SLJIT_WORD_SHIFT 2 |
| typedef unsigned int sljit_uw; |
typedef unsigned int sljit_uw; |
|
Line 326 typedef long int sljit_w;
|
Line 344 typedef long int sljit_w;
|
| #ifndef SLJIT_SSE2 |
#ifndef SLJIT_SSE2 |
| |
|
| #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) |
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) |
| /* Turn on SSE2 support on x86 (operating on doubles). | /* Turn on SSE2 support on x86. */ |
| (Better performance than legacy fpu instructions). */ | |
| #define SLJIT_SSE2 1 |
#define SLJIT_SSE2 1 |
| |
|
| #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) |
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) |
| /* Auto detect SSE2 support using CPUID. |
/* Auto detect SSE2 support using CPUID. |
| On 64 bit x86 cpus, sse2 must be present. */ |
On 64 bit x86 cpus, sse2 must be present. */ |
| #define SLJIT_SSE2_AUTO 1 | #define SLJIT_DETECT_SSE2 1 |
| #endif |
#endif |
| |
|
| #endif /* (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) */ |
#endif /* (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) */ |