Home | History | Annotate | Line # | Download | only in sljit_src
sljitConfig.h revision 1.16
      1  1.16  riastrad /*	$NetBSD: sljitConfig.h,v 1.16 2020/03/05 08:08:33 riastradh Exp $	*/
      2  1.10     alnsn 
      3   1.1     alnsn /*
      4   1.1     alnsn  *    Stack-less Just-In-Time compiler
      5   1.1     alnsn  *
      6  1.15     alnsn  *    Copyright Zoltan Herczeg (hzmester (at) freemail.hu). All rights reserved.
      7   1.1     alnsn  *
      8   1.1     alnsn  * Redistribution and use in source and binary forms, with or without modification, are
      9   1.1     alnsn  * permitted provided that the following conditions are met:
     10   1.1     alnsn  *
     11   1.1     alnsn  *   1. Redistributions of source code must retain the above copyright notice, this list of
     12   1.1     alnsn  *      conditions and the following disclaimer.
     13   1.1     alnsn  *
     14   1.1     alnsn  *   2. Redistributions in binary form must reproduce the above copyright notice, this list
     15   1.1     alnsn  *      of conditions and the following disclaimer in the documentation and/or other materials
     16   1.1     alnsn  *      provided with the distribution.
     17   1.1     alnsn  *
     18   1.1     alnsn  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
     19   1.1     alnsn  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20   1.1     alnsn  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
     21   1.1     alnsn  * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     22   1.1     alnsn  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
     23   1.1     alnsn  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     24   1.1     alnsn  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25   1.1     alnsn  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     26   1.1     alnsn  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27   1.1     alnsn  */
     28   1.1     alnsn 
     29   1.1     alnsn #ifndef _SLJIT_CONFIG_H_
     30   1.1     alnsn #define _SLJIT_CONFIG_H_
     31   1.1     alnsn 
     32   1.1     alnsn /* --------------------------------------------------------------------- */
     33   1.1     alnsn /*  Custom defines                                                       */
     34   1.1     alnsn /* --------------------------------------------------------------------- */
     35   1.1     alnsn 
     36   1.1     alnsn /* Put your custom defines here. This empty section will never change
     37   1.1     alnsn    which helps maintaining patches (with diff / patch utilities). */
     38   1.1     alnsn 
     39   1.1     alnsn /* --------------------------------------------------------------------- */
     40   1.1     alnsn /*  Architecture                                                         */
     41   1.1     alnsn /* --------------------------------------------------------------------- */
     42   1.1     alnsn 
     43   1.1     alnsn /* Architecture selection. */
     44   1.1     alnsn /* #define SLJIT_CONFIG_X86_32 1 */
     45   1.1     alnsn /* #define SLJIT_CONFIG_X86_64 1 */
     46   1.1     alnsn /* #define SLJIT_CONFIG_ARM_V5 1 */
     47   1.1     alnsn /* #define SLJIT_CONFIG_ARM_V7 1 */
     48   1.1     alnsn /* #define SLJIT_CONFIG_ARM_THUMB2 1 */
     49   1.9     alnsn /* #define SLJIT_CONFIG_ARM_64 1 */
     50   1.1     alnsn /* #define SLJIT_CONFIG_PPC_32 1 */
     51   1.1     alnsn /* #define SLJIT_CONFIG_PPC_64 1 */
     52   1.1     alnsn /* #define SLJIT_CONFIG_MIPS_32 1 */
     53   1.9     alnsn /* #define SLJIT_CONFIG_MIPS_64 1 */
     54   1.5     alnsn /* #define SLJIT_CONFIG_SPARC_32 1 */
     55   1.9     alnsn /* #define SLJIT_CONFIG_TILEGX 1 */
     56   1.1     alnsn 
     57   1.1     alnsn /* #define SLJIT_CONFIG_AUTO 1 */
     58   1.1     alnsn /* #define SLJIT_CONFIG_UNSUPPORTED 1 */
     59   1.1     alnsn 
     60  1.12     alnsn #include <machine/sljit_machdep.h>
     61   1.2     alnsn 
     62   1.2     alnsn #if defined(_KERNEL) && !defined(SLJIT_MALLOC)
     63  1.14     alnsn #define SLJIT_MALLOC(size, allocator_data) malloc((size), M_TEMP, M_WAITOK)
     64   1.2     alnsn #endif
     65   1.2     alnsn 
     66   1.2     alnsn #if defined(_KERNEL) && !defined(SLJIT_FREE)
     67  1.14     alnsn #define SLJIT_FREE(ptr, allocator_data) free((ptr), M_TEMP)
     68   1.2     alnsn #endif
     69   1.2     alnsn 
     70   1.2     alnsn #if defined(_KERNEL) && !defined(SLJIT_CACHE_FLUSH)
     71   1.7     alnsn #error "SLJIT_CACHE_FLUSH must be defined."
     72   1.2     alnsn #endif
     73   1.2     alnsn 
     74   1.2     alnsn 
     75   1.2     alnsn #ifdef _KERNEL
     76   1.6     alnsn 
     77  1.16  riastrad #ifdef _KERNEL_OPT
     78  1.16  riastrad #include "opt_diagnostic.h"
     79  1.16  riastrad #endif
     80  1.16  riastrad 
     81   1.2     alnsn #ifdef DIAGNOSTIC
     82   1.2     alnsn #define SLJIT_DEBUG 1
     83   1.2     alnsn #else
     84   1.2     alnsn #define SLJIT_DEBUG 0
     85   1.2     alnsn #endif
     86   1.6     alnsn 
     87   1.6     alnsn #define SLJIT_ASSERT(x) KASSERT(x)
     88   1.6     alnsn #define SLJIT_ASSERT_STOP() \
     89   1.6     alnsn 	panic("Should never been reached " __FILE__ ":%d\n", __LINE__)
     90   1.2     alnsn #endif
     91   1.2     alnsn 
     92   1.2     alnsn #ifdef _KERNEL
     93   1.2     alnsn #define SLJIT_VERBOSE 0
     94   1.2     alnsn #endif
     95   1.2     alnsn 
     96   1.2     alnsn #ifdef _KERNEL
     97  1.11     alnsn #define SLJIT_IS_FPU_AVAILABLE 0
     98  1.11     alnsn #endif
     99  1.11     alnsn 
    100  1.11     alnsn #ifdef _KERNEL
    101   1.2     alnsn #include <sys/cdefs.h>
    102   1.2     alnsn #include <sys/malloc.h>
    103   1.4     alnsn #include <sys/param.h>
    104   1.2     alnsn #endif
    105   1.2     alnsn 
    106   1.1     alnsn /* --------------------------------------------------------------------- */
    107   1.1     alnsn /*  Utilities                                                            */
    108   1.1     alnsn /* --------------------------------------------------------------------- */
    109   1.1     alnsn 
    110   1.1     alnsn /* Useful for thread-safe compiling of global functions. */
    111   1.1     alnsn #ifndef SLJIT_UTIL_GLOBAL_LOCK
    112   1.1     alnsn /* Enabled by default */
    113   1.1     alnsn #define SLJIT_UTIL_GLOBAL_LOCK 1
    114   1.1     alnsn #endif
    115   1.1     alnsn 
    116   1.1     alnsn /* Implements a stack like data structure (by using mmap / VirtualAlloc). */
    117   1.1     alnsn #ifndef SLJIT_UTIL_STACK
    118   1.1     alnsn /* Enabled by default */
    119   1.1     alnsn #define SLJIT_UTIL_STACK 1
    120   1.1     alnsn #endif
    121   1.1     alnsn 
    122   1.1     alnsn /* Single threaded application. Does not require any locks. */
    123   1.1     alnsn #ifndef SLJIT_SINGLE_THREADED
    124   1.1     alnsn /* Disabled by default. */
    125   1.1     alnsn #define SLJIT_SINGLE_THREADED 0
    126   1.1     alnsn #endif
    127   1.1     alnsn 
    128   1.1     alnsn /* --------------------------------------------------------------------- */
    129   1.1     alnsn /*  Configuration                                                        */
    130   1.1     alnsn /* --------------------------------------------------------------------- */
    131   1.1     alnsn 
    132   1.1     alnsn /* If SLJIT_STD_MACROS_DEFINED is not defined, the application should
    133  1.15     alnsn    define SLJIT_MALLOC, SLJIT_FREE, SLJIT_MEMCPY, and NULL. */
    134   1.1     alnsn #ifndef SLJIT_STD_MACROS_DEFINED
    135   1.1     alnsn /* Disabled by default. */
    136   1.1     alnsn #define SLJIT_STD_MACROS_DEFINED 0
    137   1.1     alnsn #endif
    138   1.1     alnsn 
    139   1.1     alnsn /* Executable code allocation:
    140   1.1     alnsn    If SLJIT_EXECUTABLE_ALLOCATOR is not defined, the application should
    141  1.15     alnsn    define SLJIT_MALLOC_EXEC, SLJIT_FREE_EXEC, and SLJIT_EXEC_OFFSET. */
    142   1.1     alnsn #ifndef SLJIT_EXECUTABLE_ALLOCATOR
    143   1.1     alnsn /* Enabled by default. */
    144   1.1     alnsn #define SLJIT_EXECUTABLE_ALLOCATOR 1
    145  1.15     alnsn 
    146  1.15     alnsn /* When SLJIT_PROT_EXECUTABLE_ALLOCATOR is enabled SLJIT uses
    147  1.15     alnsn    an allocator which does not set writable and executable
    148  1.15     alnsn    permission flags at the same time. The trade-of is increased
    149  1.15     alnsn    memory consumption and disabled dynamic code modifications. */
    150  1.15     alnsn #ifndef SLJIT_PROT_EXECUTABLE_ALLOCATOR
    151  1.15     alnsn /* Disabled by default. */
    152  1.15     alnsn #define SLJIT_PROT_EXECUTABLE_ALLOCATOR 0
    153  1.15     alnsn #endif
    154  1.15     alnsn 
    155   1.1     alnsn #endif
    156   1.1     alnsn 
    157  1.13     alnsn /* Force cdecl calling convention even if a better calling
    158  1.13     alnsn    convention (e.g. fastcall) is supported by the C compiler.
    159  1.13     alnsn    If this option is enabled, C functions without
    160  1.13     alnsn    SLJIT_CALL can also be called from JIT code. */
    161  1.13     alnsn #ifndef SLJIT_USE_CDECL_CALLING_CONVENTION
    162  1.13     alnsn /* Disabled by default */
    163  1.13     alnsn #define SLJIT_USE_CDECL_CALLING_CONVENTION 0
    164  1.13     alnsn #endif
    165  1.13     alnsn 
    166  1.13     alnsn /* Return with error when an invalid argument is passed. */
    167  1.13     alnsn #ifndef SLJIT_ARGUMENT_CHECKS
    168  1.13     alnsn /* Disabled by default */
    169  1.13     alnsn #define SLJIT_ARGUMENT_CHECKS 0
    170  1.13     alnsn #endif
    171  1.13     alnsn 
    172   1.1     alnsn /* Debug checks (assertions, etc.). */
    173   1.1     alnsn #ifndef SLJIT_DEBUG
    174   1.1     alnsn /* Enabled by default */
    175   1.1     alnsn #define SLJIT_DEBUG 1
    176   1.1     alnsn #endif
    177   1.1     alnsn 
    178  1.13     alnsn /* Verbose operations. */
    179   1.1     alnsn #ifndef SLJIT_VERBOSE
    180   1.1     alnsn /* Enabled by default */
    181   1.1     alnsn #define SLJIT_VERBOSE 1
    182   1.1     alnsn #endif
    183   1.1     alnsn 
    184   1.9     alnsn /*
    185   1.9     alnsn   SLJIT_IS_FPU_AVAILABLE
    186   1.9     alnsn     The availability of the FPU can be controlled by SLJIT_IS_FPU_AVAILABLE.
    187   1.9     alnsn       zero value - FPU is NOT present.
    188   1.9     alnsn       nonzero value - FPU is present.
    189   1.9     alnsn */
    190   1.9     alnsn 
    191   1.9     alnsn /* For further configurations, see the beginning of sljitConfigInternal.h */
    192   1.1     alnsn 
    193   1.1     alnsn #endif
    194