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