| 1 | /* |
| 2 | * Stack-less Just-In-Time compiler |
| 3 | * |
| 4 | * Copyright Zoltan Herczeg (hzmester@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 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | /* |
| 35 | This file contains the basic configuration options for the SLJIT compiler |
| 36 | and their default values. These options can be overridden in the |
| 37 | sljitConfigPre.h header file when SLJIT_HAVE_CONFIG_PRE is set to a |
| 38 | non-zero value. |
| 39 | */ |
| 40 | |
| 41 | /* --------------------------------------------------------------------- */ |
| 42 | /* Architecture */ |
| 43 | /* --------------------------------------------------------------------- */ |
| 44 | |
| 45 | /* Architecture selection. */ |
| 46 | /* #define SLJIT_CONFIG_X86_32 1 */ |
| 47 | /* #define SLJIT_CONFIG_X86_64 1 */ |
| 48 | /* #define SLJIT_CONFIG_ARM_V5 1 */ |
| 49 | /* #define SLJIT_CONFIG_ARM_V7 1 */ |
| 50 | /* #define SLJIT_CONFIG_ARM_THUMB2 1 */ |
| 51 | /* #define SLJIT_CONFIG_ARM_64 1 */ |
| 52 | /* #define SLJIT_CONFIG_PPC_32 1 */ |
| 53 | /* #define SLJIT_CONFIG_PPC_64 1 */ |
| 54 | /* #define SLJIT_CONFIG_MIPS_32 1 */ |
| 55 | /* #define SLJIT_CONFIG_MIPS_64 1 */ |
| 56 | /* #define SLJIT_CONFIG_RISCV_32 1 */ |
| 57 | /* #define SLJIT_CONFIG_RISCV_64 1 */ |
| 58 | /* #define SLJIT_CONFIG_S390X 1 */ |
| 59 | |
| 60 | /* #define SLJIT_CONFIG_AUTO 1 */ |
| 61 | /* #define SLJIT_CONFIG_UNSUPPORTED 1 */ |
| 62 | |
| 63 | /* --------------------------------------------------------------------- */ |
| 64 | /* Utilities */ |
| 65 | /* --------------------------------------------------------------------- */ |
| 66 | |
| 67 | /* Implements a stack like data structure (by using mmap / VirtualAlloc */ |
| 68 | /* or a custom allocator). */ |
| 69 | #ifndef SLJIT_UTIL_STACK |
| 70 | /* Enabled by default */ |
| 71 | #define SLJIT_UTIL_STACK 1 |
| 72 | #endif |
| 73 | |
| 74 | /* Uses user provided allocator to allocate the stack (see SLJIT_UTIL_STACK) */ |
| 75 | #ifndef SLJIT_UTIL_SIMPLE_STACK_ALLOCATION |
| 76 | /* Disabled by default */ |
| 77 | #define SLJIT_UTIL_SIMPLE_STACK_ALLOCATION 0 |
| 78 | #endif |
| 79 | |
| 80 | /* Single threaded application. Does not require any locks. */ |
| 81 | #ifndef SLJIT_SINGLE_THREADED |
| 82 | /* Disabled by default. */ |
| 83 | #define SLJIT_SINGLE_THREADED 0 |
| 84 | #endif |
| 85 | |
| 86 | /* --------------------------------------------------------------------- */ |
| 87 | /* Configuration */ |
| 88 | /* --------------------------------------------------------------------- */ |
| 89 | |
| 90 | /* If SLJIT_STD_MACROS_DEFINED is not defined, the application should |
| 91 | define SLJIT_MALLOC, SLJIT_FREE, SLJIT_MEMCPY, and NULL. */ |
| 92 | #ifndef SLJIT_STD_MACROS_DEFINED |
| 93 | /* Disabled by default. */ |
| 94 | #define SLJIT_STD_MACROS_DEFINED 0 |
| 95 | #endif |
| 96 | |
| 97 | /* Executable code allocation: |
| 98 | If SLJIT_EXECUTABLE_ALLOCATOR is not defined, the application should |
| 99 | define SLJIT_MALLOC_EXEC, SLJIT_FREE_EXEC, and SLJIT_EXEC_OFFSET. */ |
| 100 | #ifndef SLJIT_EXECUTABLE_ALLOCATOR |
| 101 | /* Enabled by default. */ |
| 102 | #define SLJIT_EXECUTABLE_ALLOCATOR 1 |
| 103 | |
| 104 | /* When SLJIT_PROT_EXECUTABLE_ALLOCATOR is enabled SLJIT uses |
| 105 | an allocator which does not set writable and executable |
| 106 | permission flags at the same time. |
| 107 | Instead, it creates a shared memory segment (usually backed by a file) |
| 108 | and maps it twice, with different permissions, depending on the use |
| 109 | case. |
| 110 | The trade-off is increased use of virtual memory, incompatibility with |
| 111 | fork(), and some possible additional security risks by the use of |
| 112 | publicly accessible files for the generated code. */ |
| 113 | #ifndef SLJIT_PROT_EXECUTABLE_ALLOCATOR |
| 114 | /* Disabled by default. */ |
| 115 | #define SLJIT_PROT_EXECUTABLE_ALLOCATOR 0 |
| 116 | #endif |
| 117 | |
| 118 | /* When SLJIT_WX_EXECUTABLE_ALLOCATOR is enabled SLJIT uses an |
| 119 | allocator which does not set writable and executable permission |
| 120 | flags at the same time. |
| 121 | Instead, it creates a new independent map on each invocation and |
| 122 | switches permissions at the underlying pages as needed. |
| 123 | The trade-off is increased memory use and degraded performance. */ |
| 124 | #ifndef SLJIT_WX_EXECUTABLE_ALLOCATOR |
| 125 | /* Disabled by default. */ |
| 126 | #define SLJIT_WX_EXECUTABLE_ALLOCATOR 0 |
| 127 | #endif |
| 128 | |
| 129 | #endif /* !SLJIT_EXECUTABLE_ALLOCATOR */ |
| 130 | |
| 131 | /* Return with error when an invalid argument is passed. */ |
| 132 | #ifndef SLJIT_ARGUMENT_CHECKS |
| 133 | /* Disabled by default */ |
| 134 | #define SLJIT_ARGUMENT_CHECKS 0 |
| 135 | #endif |
| 136 | |
| 137 | /* Debug checks (assertions, etc.). */ |
| 138 | #ifndef SLJIT_DEBUG |
| 139 | /* Enabled by default */ |
| 140 | #define SLJIT_DEBUG 1 |
| 141 | #endif |
| 142 | |
| 143 | /* Verbose operations. */ |
| 144 | #ifndef SLJIT_VERBOSE |
| 145 | /* Enabled by default */ |
| 146 | #define SLJIT_VERBOSE 1 |
| 147 | #endif |
| 148 | |
| 149 | /* |
| 150 | SLJIT_IS_FPU_AVAILABLE |
| 151 | The availability of the FPU can be controlled by SLJIT_IS_FPU_AVAILABLE. |
| 152 | zero value - FPU is NOT present. |
| 153 | nonzero value - FPU is present. |
| 154 | */ |
| 155 | |
| 156 | /* For further configurations, see the beginning of sljitConfigInternal.h */ |
| 157 | |
| 158 | #ifdef __cplusplus |
| 159 | } /* extern "C" */ |
| 160 | #endif |
| 161 | |
| 162 | #endif /* SLJIT_CONFIG_H_ */ |
| 163 | |