Home | History | Annotate | Line # | Download | only in sljit_src
sljitConfig.h revision 1.4
      1  1.1  alnsn /*
      2  1.1  alnsn  *    Stack-less Just-In-Time compiler
      3  1.1  alnsn  *
      4  1.1  alnsn  *    Copyright 2009-2012 Zoltan Herczeg (hzmester (at) freemail.hu). All rights reserved.
      5  1.1  alnsn  *
      6  1.1  alnsn  * Redistribution and use in source and binary forms, with or without modification, are
      7  1.1  alnsn  * permitted provided that the following conditions are met:
      8  1.1  alnsn  *
      9  1.1  alnsn  *   1. Redistributions of source code must retain the above copyright notice, this list of
     10  1.1  alnsn  *      conditions and the following disclaimer.
     11  1.1  alnsn  *
     12  1.1  alnsn  *   2. Redistributions in binary form must reproduce the above copyright notice, this list
     13  1.1  alnsn  *      of conditions and the following disclaimer in the documentation and/or other materials
     14  1.1  alnsn  *      provided with the distribution.
     15  1.1  alnsn  *
     16  1.1  alnsn  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
     17  1.1  alnsn  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.1  alnsn  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
     19  1.1  alnsn  * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.1  alnsn  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
     21  1.1  alnsn  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     22  1.1  alnsn  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23  1.1  alnsn  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     24  1.1  alnsn  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     25  1.1  alnsn  */
     26  1.1  alnsn 
     27  1.1  alnsn #ifndef _SLJIT_CONFIG_H_
     28  1.1  alnsn #define _SLJIT_CONFIG_H_
     29  1.1  alnsn 
     30  1.1  alnsn /* --------------------------------------------------------------------- */
     31  1.1  alnsn /*  Custom defines                                                       */
     32  1.1  alnsn /* --------------------------------------------------------------------- */
     33  1.1  alnsn 
     34  1.1  alnsn /* Put your custom defines here. This empty section will never change
     35  1.1  alnsn    which helps maintaining patches (with diff / patch utilities). */
     36  1.1  alnsn 
     37  1.1  alnsn /* --------------------------------------------------------------------- */
     38  1.1  alnsn /*  Architecture                                                         */
     39  1.1  alnsn /* --------------------------------------------------------------------- */
     40  1.1  alnsn 
     41  1.1  alnsn /* Architecture selection. */
     42  1.1  alnsn /* #define SLJIT_CONFIG_X86_32 1 */
     43  1.1  alnsn /* #define SLJIT_CONFIG_X86_64 1 */
     44  1.1  alnsn /* #define SLJIT_CONFIG_ARM_V5 1 */
     45  1.1  alnsn /* #define SLJIT_CONFIG_ARM_V7 1 */
     46  1.1  alnsn /* #define SLJIT_CONFIG_ARM_THUMB2 1 */
     47  1.1  alnsn /* #define SLJIT_CONFIG_PPC_32 1 */
     48  1.1  alnsn /* #define SLJIT_CONFIG_PPC_64 1 */
     49  1.1  alnsn /* #define SLJIT_CONFIG_MIPS_32 1 */
     50  1.1  alnsn 
     51  1.1  alnsn /* #define SLJIT_CONFIG_AUTO 1 */
     52  1.1  alnsn /* #define SLJIT_CONFIG_UNSUPPORTED 1 */
     53  1.1  alnsn 
     54  1.2  alnsn #include <machine/sljitarch.h>
     55  1.2  alnsn 
     56  1.2  alnsn #if defined(_KERNEL) && !defined(SLJIT_MALLOC)
     57  1.2  alnsn #define SLJIT_MALLOC(size) malloc((size), M_TEMP, M_WAITOK)
     58  1.2  alnsn #endif
     59  1.2  alnsn 
     60  1.2  alnsn #if defined(_KERNEL) && !defined(SLJIT_FREE)
     61  1.2  alnsn #define SLJIT_FREE(ptr) free((ptr), M_TEMP)
     62  1.2  alnsn #endif
     63  1.2  alnsn 
     64  1.2  alnsn #if defined(_KERNEL) && !defined(SLJIT_CACHE_FLUSH)
     65  1.2  alnsn #define SLJIT_CACHE_FLUSH(from, to)
     66  1.2  alnsn #endif
     67  1.2  alnsn 
     68  1.2  alnsn #if defined(_KERNEL)
     69  1.2  alnsn #define SLJIT_UTIL_GLOBAL_LOCK 0
     70  1.2  alnsn #define SLJIT_EXECUTABLE_ALLOCATOR 0
     71  1.2  alnsn #define SLJIT_MALLOC_EXEC(sz) SLJIT_MALLOC(sz)
     72  1.2  alnsn #define SLJIT_FREE_EXEC(ptr) SLJIT_FREE(ptr)
     73  1.2  alnsn #endif
     74  1.2  alnsn 
     75  1.2  alnsn #ifdef _KERNEL
     76  1.2  alnsn #ifdef DIAGNOSTIC
     77  1.2  alnsn #define SLJIT_DEBUG 1
     78  1.2  alnsn #else
     79  1.2  alnsn #define SLJIT_DEBUG 0
     80  1.2  alnsn #endif
     81  1.2  alnsn #endif
     82  1.2  alnsn 
     83  1.2  alnsn #ifdef _KERNEL
     84  1.2  alnsn #define SLJIT_VERBOSE 0
     85  1.2  alnsn #endif
     86  1.2  alnsn 
     87  1.2  alnsn #ifdef _KERNEL
     88  1.2  alnsn #include <sys/cdefs.h>
     89  1.2  alnsn #include <sys/malloc.h>
     90  1.4  alnsn #include <sys/param.h>
     91  1.2  alnsn #endif
     92  1.2  alnsn 
     93  1.1  alnsn /* --------------------------------------------------------------------- */
     94  1.1  alnsn /*  Utilities                                                            */
     95  1.1  alnsn /* --------------------------------------------------------------------- */
     96  1.1  alnsn 
     97  1.1  alnsn /* Useful for thread-safe compiling of global functions. */
     98  1.1  alnsn #ifndef SLJIT_UTIL_GLOBAL_LOCK
     99  1.1  alnsn /* Enabled by default */
    100  1.1  alnsn #define SLJIT_UTIL_GLOBAL_LOCK 1
    101  1.1  alnsn #endif
    102  1.1  alnsn 
    103  1.1  alnsn /* Implements a stack like data structure (by using mmap / VirtualAlloc). */
    104  1.1  alnsn #ifndef SLJIT_UTIL_STACK
    105  1.1  alnsn /* Enabled by default */
    106  1.1  alnsn #define SLJIT_UTIL_STACK 1
    107  1.1  alnsn #endif
    108  1.1  alnsn 
    109  1.1  alnsn /* Single threaded application. Does not require any locks. */
    110  1.1  alnsn #ifndef SLJIT_SINGLE_THREADED
    111  1.1  alnsn /* Disabled by default. */
    112  1.1  alnsn #define SLJIT_SINGLE_THREADED 0
    113  1.1  alnsn #endif
    114  1.1  alnsn 
    115  1.1  alnsn /* --------------------------------------------------------------------- */
    116  1.1  alnsn /*  Configuration                                                        */
    117  1.1  alnsn /* --------------------------------------------------------------------- */
    118  1.1  alnsn 
    119  1.1  alnsn /* If SLJIT_STD_MACROS_DEFINED is not defined, the application should
    120  1.1  alnsn    define SLJIT_MALLOC, SLJIT_FREE, SLJIT_MEMMOVE, and NULL. */
    121  1.1  alnsn #ifndef SLJIT_STD_MACROS_DEFINED
    122  1.1  alnsn /* Disabled by default. */
    123  1.1  alnsn #define SLJIT_STD_MACROS_DEFINED 0
    124  1.1  alnsn #endif
    125  1.1  alnsn 
    126  1.1  alnsn /* Executable code allocation:
    127  1.1  alnsn    If SLJIT_EXECUTABLE_ALLOCATOR is not defined, the application should
    128  1.1  alnsn    define both SLJIT_MALLOC_EXEC and SLJIT_FREE_EXEC. */
    129  1.1  alnsn #ifndef SLJIT_EXECUTABLE_ALLOCATOR
    130  1.1  alnsn /* Enabled by default. */
    131  1.1  alnsn #define SLJIT_EXECUTABLE_ALLOCATOR 1
    132  1.1  alnsn #endif
    133  1.1  alnsn 
    134  1.1  alnsn /* Debug checks (assertions, etc.). */
    135  1.1  alnsn #ifndef SLJIT_DEBUG
    136  1.1  alnsn /* Enabled by default */
    137  1.1  alnsn #define SLJIT_DEBUG 1
    138  1.1  alnsn #endif
    139  1.1  alnsn 
    140  1.1  alnsn /* Verbose operations */
    141  1.1  alnsn #ifndef SLJIT_VERBOSE
    142  1.1  alnsn /* Enabled by default */
    143  1.1  alnsn #define SLJIT_VERBOSE 1
    144  1.1  alnsn #endif
    145  1.1  alnsn 
    146  1.1  alnsn /* See the beginning of sljitConfigInternal.h */
    147  1.1  alnsn 
    148  1.1  alnsn #endif
    149