sljitConfig.h 6.2 KB

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