version 1.1.1.3, 2012/10/09 09:19:18
|
version 1.1.1.4, 2013/07/22 08:25:57
|
Line 33
|
Line 33
|
Feature detection (boolean) macros: |
Feature detection (boolean) macros: |
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_sw/sljit_uw array by index |
SLJIT_FLOAT_SHIFT : the shift required to apply when accessing a double array by index | SLJIT_DOUBLE_SHIFT : the shift required to apply when accessing a double array by index |
SLJIT_LITTLE_ENDIAN : little endian architecture |
SLJIT_LITTLE_ENDIAN : little endian architecture |
SLJIT_BIG_ENDIAN : big endian architecture |
SLJIT_BIG_ENDIAN : big endian architecture |
SLJIT_UNALIGNED : allows unaligned memory accesses for non-fpu operations (only!) |
SLJIT_UNALIGNED : allows unaligned memory accesses for non-fpu operations (only!) |
SLJIT_INDIRECT_CALL : see SLJIT_FUNC_OFFSET() for more information |
SLJIT_INDIRECT_CALL : see SLJIT_FUNC_OFFSET() for more information |
|
SLJIT_RETURN_ADDRESS_OFFSET : a return instruction always adds this offset to the return address |
|
|
Types and useful macros: |
Types and useful macros: |
sljit_b, sljit_ub : signed and unsigned 8 bit byte | sljit_sb, sljit_ub : signed and unsigned 8 bit byte |
sljit_h, sljit_uh : signed and unsigned 16 bit half-word (short) type | sljit_sh, sljit_uh : signed and unsigned 16 bit half-word (short) type |
sljit_i, sljit_ui : signed and unsigned 32 bit integer type | sljit_si, 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_sw, sljit_uw : signed and unsigned machine word, enough to store a pointer |
| sljit_p : unsgined pointer value (usually the same as sljit_uw, but |
| some 64 bit ABIs may use 32 bit pointers) |
| sljit_s : single precision floating point value |
| sljit_d : double precision floating point value |
SLJIT_CALL : C calling convention define for both calling JIT form C and C callbacks for JIT |
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) |
SLJIT_W(number) : defining 64 bit constants on 64 bit architectures (compiler independent helper) |
*/ |
*/ |
Line 57
|
Line 62
|
|| (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \ |
|| (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \ |
|| (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \ |
|| (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \ |
|| (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \ |
|| (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \ |
|
|| (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) \ |
|| (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO) \ |
|| (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO) \ |
|| (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)) |
|| (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)) |
#error "An architecture must be selected" |
#error "An architecture must be selected" |
Line 71
|
Line 77
|
+ (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \ |
+ (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \ |
+ (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \ |
+ (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \ |
+ (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \ |
+ (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) \ |
|
+ (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) \ |
+ (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO) \ |
+ (defined SLJIT_CONFIG_AUTO && SLJIT_CONFIG_AUTO) \ |
+ (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED) >= 2 |
+ (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED) >= 2 |
#error "Multiple architectures are selected" |
#error "Multiple architectures are selected" |
Line 93
|
Line 100
|
#else |
#else |
#define SLJIT_CONFIG_ARM_V5 1 |
#define SLJIT_CONFIG_ARM_V5 1 |
#endif |
#endif |
#elif defined(__ppc64__) || defined(__powerpc64__) | #elif defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_PPC64) || (defined(_POWER) && defined(__64BIT__)) |
#define SLJIT_CONFIG_PPC_64 1 |
#define SLJIT_CONFIG_PPC_64 1 |
#elif defined(__ppc__) || defined(__powerpc__) | #elif defined(__ppc__) || defined(__powerpc__) || defined(_ARCH_PPC) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_POWER) |
#define SLJIT_CONFIG_PPC_32 1 |
#define SLJIT_CONFIG_PPC_32 1 |
#elif defined(__mips__) | #elif defined(__mips__) && !defined(_LP64) |
#define SLJIT_CONFIG_MIPS_32 1 |
#define SLJIT_CONFIG_MIPS_32 1 |
|
#elif defined(__sparc__) || defined(__sparc) |
|
#define SLJIT_CONFIG_SPARC_32 1 |
#else |
#else |
/* Unsupported architecture */ |
/* Unsupported architecture */ |
#define SLJIT_CONFIG_UNSUPPORTED 1 |
#define SLJIT_CONFIG_UNSUPPORTED 1 |
Line 164
|
Line 173
|
#endif /* !defined(SLJIT_LIKELY) && !defined(SLJIT_UNLIKELY) */ |
#endif /* !defined(SLJIT_LIKELY) && !defined(SLJIT_UNLIKELY) */ |
|
|
#ifndef SLJIT_INLINE |
#ifndef SLJIT_INLINE |
/* Inline functions. */ | /* Inline functions. Some old compilers do not support them. */ |
| #if defined(__SUNPRO_C) && __SUNPRO_C <= 0x510 |
| #define SLJIT_INLINE |
| #else |
#define SLJIT_INLINE __inline |
#define SLJIT_INLINE __inline |
#endif |
#endif |
|
#endif /* !SLJIT_INLINE */ |
|
|
#ifndef SLJIT_CONST |
#ifndef SLJIT_CONST |
/* Const variables. */ |
/* Const variables. */ |
Line 214
|
Line 227
|
#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_SPARC_32 && SLJIT_CONFIG_SPARC_32) |
|
|
|
/* The __clear_cache() implementation of GCC is a dummy function on Sparc. */ |
|
#define SLJIT_CACHE_FLUSH(from, to) \ |
|
sparc_cache_flush((from), (to)) |
|
|
#else |
#else |
|
|
/* Calls __ARM_NR_cacheflush on ARM-Linux. */ |
/* Calls __ARM_NR_cacheflush on ARM-Linux. */ |
Line 226
|
Line 245
|
|
|
/* 8 bit byte type. */ |
/* 8 bit byte type. */ |
typedef unsigned char sljit_ub; |
typedef unsigned char sljit_ub; |
typedef signed char sljit_b; | typedef signed char sljit_sb; |
|
|
/* 16 bit half-word type. */ |
/* 16 bit half-word type. */ |
typedef unsigned short int sljit_uh; |
typedef unsigned short int sljit_uh; |
typedef signed short int sljit_h; | typedef signed short int sljit_sh; |
|
|
/* 32 bit integer type. */ |
/* 32 bit integer type. */ |
typedef unsigned int sljit_ui; |
typedef unsigned int sljit_ui; |
typedef signed int sljit_i; | typedef signed int sljit_si; |
|
|
/* 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. |
Line 243 typedef signed int sljit_i;
|
Line 262 typedef signed int sljit_i;
|
/* Just to have something. */ |
/* Just to have something. */ |
#define SLJIT_WORD_SHIFT 0 |
#define SLJIT_WORD_SHIFT 0 |
typedef unsigned long int sljit_uw; |
typedef unsigned long int sljit_uw; |
typedef long int sljit_w; | typedef long int sljit_sw; |
#elif !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) && !(defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) |
#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; |
typedef int sljit_w; | typedef int sljit_sw; |
#else |
#else |
#define SLJIT_64BIT_ARCHITECTURE 1 |
#define SLJIT_64BIT_ARCHITECTURE 1 |
#define SLJIT_WORD_SHIFT 3 |
#define SLJIT_WORD_SHIFT 3 |
#ifdef _WIN32 |
#ifdef _WIN32 |
typedef unsigned __int64 sljit_uw; |
typedef unsigned __int64 sljit_uw; |
typedef __int64 sljit_w; | typedef __int64 sljit_sw; |
#else |
#else |
typedef unsigned long int sljit_uw; |
typedef unsigned long int sljit_uw; |
typedef long int sljit_w; | typedef long int sljit_sw; |
#endif |
#endif |
#endif |
#endif |
|
|
/* Double precision. */ | typedef sljit_uw sljit_p; |
#define SLJIT_FLOAT_SHIFT 3 | |
|
|
|
/* Floating point types. */ |
|
typedef float sljit_s; |
|
typedef double sljit_d; |
|
|
|
/* Shift for pointer sized data. */ |
|
#define SLJIT_POINTER_SHIFT SLJIT_WORD_SHIFT |
|
|
|
/* Shift for double precision sized data. */ |
|
#define SLJIT_DOUBLE_SHIFT 3 |
|
|
#ifndef SLJIT_W |
#ifndef SLJIT_W |
|
|
/* Defining long constants. */ |
/* Defining long constants. */ |
Line 280 typedef long int sljit_w;
|
Line 308 typedef long int sljit_w;
|
/* ABI (Application Binary Interface) types. */ |
/* ABI (Application Binary Interface) types. */ |
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) |
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) |
|
|
#if defined(__GNUC__) | #if defined(__GNUC__) && !defined(__APPLE__) |
|
|
#define SLJIT_CALL __attribute__ ((fastcall)) |
#define SLJIT_CALL __attribute__ ((fastcall)) |
#define SLJIT_X86_32_FASTCALL 1 |
#define SLJIT_X86_32_FASTCALL 1 |
|
|
#elif defined(_WIN32) | #elif defined(_MSC_VER) |
|
|
#ifdef __BORLANDC__ |
|
#define SLJIT_CALL __msfastcall |
|
#else /* __BORLANDC__ */ |
|
#define SLJIT_CALL __fastcall |
#define SLJIT_CALL __fastcall |
#endif /* __BORLANDC__ */ |
|
#define SLJIT_X86_32_FASTCALL 1 |
#define SLJIT_X86_32_FASTCALL 1 |
|
|
#else /* defined(_WIN32) */ | #elif defined(__BORLANDC__) |
#define SLJIT_CALL __stdcall | |
| #define SLJIT_CALL __msfastcall |
| #define SLJIT_X86_32_FASTCALL 1 |
| |
| #else /* Unknown compiler. */ |
| |
| /* The cdecl attribute is the default. */ |
| #define SLJIT_CALL |
| |
#endif |
#endif |
|
|
#else /* Other architectures. */ | #else /* Non x86-32 architectures. */ |
|
|
#define SLJIT_CALL |
#define SLJIT_CALL |
|
|
Line 309 typedef long int sljit_w;
|
Line 341 typedef long int sljit_w;
|
#if !defined(SLJIT_BIG_ENDIAN) && !defined(SLJIT_LITTLE_ENDIAN) |
#if !defined(SLJIT_BIG_ENDIAN) && !defined(SLJIT_LITTLE_ENDIAN) |
|
|
/* These macros are useful for the application. */ |
/* These macros are useful for the application. */ |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) | #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) \ |
| || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) \ |
| || (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) |
#define SLJIT_BIG_ENDIAN 1 |
#define SLJIT_BIG_ENDIAN 1 |
|
|
#elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) |
#elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) |
Line 335 typedef long int sljit_w;
|
Line 369 typedef long int sljit_w;
|
#error "Exactly one endianness must be selected" |
#error "Exactly one endianness must be selected" |
#endif |
#endif |
|
|
#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) | #ifndef SLJIT_INDIRECT_CALL |
/* It seems ppc64 compilers use an indirect addressing for functions. | #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) || (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32 && defined _AIX) |
It makes things really complicated. */ | /* It seems certain ppc compilers use an indirect addressing for functions |
| which makes things complicated. */ |
#define SLJIT_INDIRECT_CALL 1 |
#define SLJIT_INDIRECT_CALL 1 |
#endif |
#endif |
|
#endif /* SLJIT_INDIRECT_CALL */ |
|
|
|
#ifndef SLJIT_RETURN_ADDRESS_OFFSET |
|
#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) |
|
#define SLJIT_RETURN_ADDRESS_OFFSET 8 |
|
#else |
|
#define SLJIT_RETURN_ADDRESS_OFFSET 0 |
|
#endif |
|
#endif /* SLJIT_RETURN_ADDRESS_OFFSET */ |
|
|
#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) |
Line 377 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void* pt
|
Line 421 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void* pt
|
#define SLJIT_FREE_EXEC(ptr) sljit_free_exec(ptr) |
#define SLJIT_FREE_EXEC(ptr) sljit_free_exec(ptr) |
#endif |
#endif |
|
|
#if (defined SLJIT_DEBUG && SLJIT_DEBUG) || (defined SLJIT_VERBOSE && SLJIT_VERBOSE) | #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) |
#include <stdio.h> |
#include <stdio.h> |
#endif |
#endif |
|
|
#if (defined SLJIT_DEBUG && SLJIT_DEBUG) |
#if (defined SLJIT_DEBUG && SLJIT_DEBUG) |
|
|
/* Feel free to redefine these two macros. */ | #if !defined(SLJIT_ASSERT) || !defined(SLJIT_ASSERT_STOP) |
#ifndef SLJIT_ASSERT | |
|
|
|
/* SLJIT_HALT_PROCESS must halt the process. */ |
|
#ifndef SLJIT_HALT_PROCESS |
|
#include <stdlib.h> |
|
|
#define SLJIT_HALT_PROCESS() \ |
#define SLJIT_HALT_PROCESS() \ |
*((int*)0) = 0 | abort(); |
| #endif /* !SLJIT_HALT_PROCESS */ |
|
|
|
#include <stdio.h> |
|
|
|
#endif /* !SLJIT_ASSERT || !SLJIT_ASSERT_STOP */ |
|
|
|
/* Feel free to redefine these two macros. */ |
|
#ifndef SLJIT_ASSERT |
|
|
#define SLJIT_ASSERT(x) \ |
#define SLJIT_ASSERT(x) \ |
do { \ |
do { \ |
if (SLJIT_UNLIKELY(!(x))) { \ |
if (SLJIT_UNLIKELY(!(x))) { \ |
Line 411 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void* pt
|
Line 466 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_exec(void* pt
|
|
|
#else /* (defined SLJIT_DEBUG && SLJIT_DEBUG) */ |
#else /* (defined SLJIT_DEBUG && SLJIT_DEBUG) */ |
|
|
|
/* Forcing empty, but valid statements. */ |
#undef SLJIT_ASSERT |
#undef SLJIT_ASSERT |
#undef SLJIT_ASSERT_STOP |
#undef SLJIT_ASSERT_STOP |
|
|