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