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