sljitConfig.h revision 1.9
1/*
2 *    Stack-less Just-In-Time compiler
3 *
4 *    Copyright 2009-2012 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/* --------------------------------------------------------------------- */
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_ARM_64 1 */
48/* #define SLJIT_CONFIG_PPC_32 1 */
49/* #define SLJIT_CONFIG_PPC_64 1 */
50/* #define SLJIT_CONFIG_MIPS_32 1 */
51/* #define SLJIT_CONFIG_MIPS_64 1 */
52/* #define SLJIT_CONFIG_SPARC_32 1 */
53/* #define SLJIT_CONFIG_TILEGX 1 */
54
55/* #define SLJIT_CONFIG_AUTO 1 */
56/* #define SLJIT_CONFIG_UNSUPPORTED 1 */
57
58#include <machine/sljitarch.h>
59
60#if defined(_KERNEL) && !defined(SLJIT_MALLOC)
61#define SLJIT_MALLOC(size) malloc((size), M_TEMP, M_WAITOK)
62#endif
63
64#if defined(_KERNEL) && !defined(SLJIT_FREE)
65#define SLJIT_FREE(ptr) free((ptr), M_TEMP)
66#endif
67
68#if defined(_KERNEL) && !defined(SLJIT_CACHE_FLUSH)
69#error "SLJIT_CACHE_FLUSH must be defined."
70#endif
71
72
73#ifdef _KERNEL
74
75#ifdef DIAGNOSTIC
76#define SLJIT_DEBUG 1
77#else
78#define SLJIT_DEBUG 0
79#endif
80
81#define SLJIT_ASSERT(x) KASSERT(x)
82#define SLJIT_ASSERT_STOP() \
83	panic("Should never been reached " __FILE__ ":%d\n", __LINE__)
84#endif
85
86#ifdef _KERNEL
87#define SLJIT_VERBOSE 0
88#endif
89
90#ifdef _KERNEL
91#include <sys/cdefs.h>
92#include <sys/malloc.h>
93#include <sys/param.h>
94#endif
95
96/* --------------------------------------------------------------------- */
97/*  Utilities                                                            */
98/* --------------------------------------------------------------------- */
99
100/* Useful for thread-safe compiling of global functions. */
101#ifndef SLJIT_UTIL_GLOBAL_LOCK
102/* Enabled by default */
103#define SLJIT_UTIL_GLOBAL_LOCK 1
104#endif
105
106/* Implements a stack like data structure (by using mmap / VirtualAlloc). */
107#ifndef SLJIT_UTIL_STACK
108/* Enabled by default */
109#define SLJIT_UTIL_STACK 1
110#endif
111
112/* Single threaded application. Does not require any locks. */
113#ifndef SLJIT_SINGLE_THREADED
114/* Disabled by default. */
115#define SLJIT_SINGLE_THREADED 0
116#endif
117
118/* --------------------------------------------------------------------- */
119/*  Configuration                                                        */
120/* --------------------------------------------------------------------- */
121
122/* If SLJIT_STD_MACROS_DEFINED is not defined, the application should
123   define SLJIT_MALLOC, SLJIT_FREE, SLJIT_MEMMOVE, and NULL. */
124#ifndef SLJIT_STD_MACROS_DEFINED
125/* Disabled by default. */
126#define SLJIT_STD_MACROS_DEFINED 0
127#endif
128
129/* Executable code allocation:
130   If SLJIT_EXECUTABLE_ALLOCATOR is not defined, the application should
131   define both SLJIT_MALLOC_EXEC and SLJIT_FREE_EXEC. */
132#ifndef SLJIT_EXECUTABLE_ALLOCATOR
133/* Enabled by default. */
134#define SLJIT_EXECUTABLE_ALLOCATOR 1
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#endif
159