Imported Upstream version 1.46.0
[platform/upstream/nghttp2.git] / third-party / mruby / include / mrbconf.h
1 /*
2 ** mrbconf.h - mruby core configuration
3 **
4 ** See Copyright Notice in mruby.h
5 */
6
7 #ifndef MRUBYCONF_H
8 #define MRUBYCONF_H
9
10 #include <limits.h>
11 #include <stdint.h>
12
13 /* architecture selection: */
14 /* specify -DMRB_32BIT or -DMRB_64BIT to override */
15 #if !defined(MRB_32BIT) && !defined(MRB_64BIT)
16 #if UINT64_MAX == SIZE_MAX
17 #define MRB_64BIT
18 #else
19 #define MRB_32BIT
20 #endif
21 #endif
22
23 #if defined(MRB_32BIT) && defined(MRB_64BIT)
24 #error Cannot build for 32 and 64 bit architecture at the same time
25 #endif
26
27 /* configuration options: */
28 /* add -DMRB_USE_FLOAT to use float instead of double for floating point numbers */
29 //#define MRB_USE_FLOAT
30
31 /* exclude floating point numbers */
32 //#define MRB_WITHOUT_FLOAT
33
34 /* add -DMRB_METHOD_CACHE to use method cache to improve performance */
35 //#define MRB_METHOD_CACHE
36 /* size of the method cache (need to be the power of 2) */
37 //#define MRB_METHOD_CACHE_SIZE (1<<7)
38
39 /* add -DMRB_METHOD_T_STRUCT on machines that use higher bits of pointers */
40 /* no MRB_METHOD_T_STRUCT requires highest 2 bits of function pointers to be zero */
41 #ifndef MRB_METHOD_T_STRUCT
42   // can't use highest 2 bits of function pointers at least on 32bit
43   // Windows and 32bit Linux.
44 # ifdef MRB_32BIT
45 #   define MRB_METHOD_T_STRUCT
46 # endif
47 #endif
48
49 /* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT64;
50    Default for 32-bit CPU mode. */
51 //#define MRB_INT32
52
53 /* add -DMRB_INT64 to use 64bit integer for mrb_int; conflict with MRB_INT32;
54    Default for 64-bit CPU mode. */
55 //#define MRB_INT64
56
57 /* if no specific integer type is chosen */
58 #if !defined(MRB_INT32) && !defined(MRB_INT64)
59 # if defined(MRB_64BIT) && !defined(MRB_NAN_BOXING)
60 /* Use 64bit integers on 64bit architecture (without MRB_NAN_BOXING) */
61 #  define MRB_INT64
62 # else
63 /* Otherwise use 32bit integers */
64 #  define MRB_INT32
65 # endif
66 #endif
67
68 /* define on big endian machines; used by MRB_NAN_BOXING, etc. */
69 #ifndef MRB_ENDIAN_BIG
70 # if (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN) || \
71      (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
72 #  define MRB_ENDIAN_BIG
73 # endif
74 #endif
75
76 /* represent mrb_value in boxed double; conflict with MRB_USE_FLOAT and MRB_WITHOUT_FLOAT */
77 //#define MRB_NAN_BOXING
78
79 /* represent mrb_value as a word (natural unit of data for the processor) */
80 //#define MRB_WORD_BOXING
81
82 /* string class to handle UTF-8 encoding */
83 //#define MRB_UTF8_STRING
84
85 /* argv max size in mrb_funcall */
86 //#define MRB_FUNCALL_ARGC_MAX 16
87
88 /* number of object per heap page */
89 //#define MRB_HEAP_PAGE_SIZE 1024
90
91 /* if __ehdr_start is available, mruby can reduce memory used by symbols */
92 //#define MRB_USE_LINK_TIME_RO_DATA_P
93
94 /* if MRB_USE_LINK_TIME_RO_DATA_P does not work,
95    you can try mrb_ro_data_p() that you have implemented yourself in any file;
96    prototype is `mrb_bool mrb_ro_data_p(const char *ptr)` */
97 //#define MRB_USE_CUSTOM_RO_DATA_P
98
99 /* turn off generational GC by default */
100 //#define MRB_GC_TURN_OFF_GENERATIONAL
101
102 /* default size of khash table bucket */
103 //#define KHASH_DEFAULT_SIZE 32
104
105 /* allocated memory address alignment */
106 //#define POOL_ALIGNMENT 4
107
108 /* page size of memory pool */
109 //#define POOL_PAGE_SIZE 16000
110
111 /* initial minimum size for string buffer */
112 //#define MRB_STR_BUF_MIN_SIZE 128
113
114 /* arena size */
115 //#define MRB_GC_ARENA_SIZE 100
116
117 /* fixed size GC arena */
118 //#define MRB_GC_FIXED_ARENA
119
120 /* state atexit stack size */
121 //#define MRB_FIXED_STATE_ATEXIT_STACK_SIZE 5
122
123 /* fixed size state atexit stack */
124 //#define MRB_FIXED_STATE_ATEXIT_STACK
125
126 /* -DMRB_DISABLE_XXXX to drop following features */
127 //#define MRB_DISABLE_STDIO /* use of stdio */
128
129 /* -DMRB_ENABLE_XXXX to enable following features */
130 //#define MRB_ENABLE_DEBUG_HOOK /* hooks for debugger */
131 //#define MRB_ENABLE_ALL_SYMBOLS /* Symbols.all_symbols */
132
133 /* end of configuration */
134
135 /* define MRB_DISABLE_XXXX from DISABLE_XXX (for compatibility) */
136 #ifdef DISABLE_STDIO
137 #define MRB_DISABLE_STDIO
138 #endif
139
140 /* define MRB_ENABLE_XXXX from ENABLE_XXX (for compatibility) */
141 #ifdef ENABLE_DEBUG
142 #define MRB_ENABLE_DEBUG_HOOK
143 #endif
144
145 #ifndef MRB_DISABLE_STDIO
146 # include <stdio.h>
147 #endif
148
149 #ifndef FALSE
150 # define FALSE 0
151 #endif
152
153 #ifndef TRUE
154 # define TRUE 1
155 #endif
156
157 /*
158 ** mruby tuning profiles
159 **/
160
161 /* A profile for micro controllers */
162 #if defined(MRB_CONSTRAINED_BASELINE_PROFILE)
163 # ifndef KHASH_DEFAULT_SIZE
164 #  define KHASH_DEFAULT_SIZE 16
165 # endif
166
167 # ifndef MRB_STR_BUF_MIN_SIZE
168 #  define MRB_STR_BUF_MIN_SIZE 32
169 # endif
170
171 # ifndef MRB_HEAP_PAGE_SIZE
172 #  define MRB_HEAP_PAGE_SIZE 256
173 # endif
174
175 /* A profile for default mruby */
176 #elif defined(MRB_BASELINE_PROFILE)
177
178 /* A profile for desktop computers or workstations; rich memory! */
179 #elif defined(MRB_MAIN_PROFILE)
180 # ifndef MRB_METHOD_CACHE
181 #  define MRB_METHOD_CACHE
182 # endif
183
184 # ifndef MRB_METHOD_CACHE_SIZE
185 #  define MRB_METHOD_CACHE_SIZE (1<<10)
186 # endif
187
188 # ifndef MRB_IV_SEGMENT_SIZE
189 #  define MRB_IV_SEGMENT_SIZE 32
190 # endif
191
192 # ifndef MRB_HEAP_PAGE_SIZE
193 #  define MRB_HEAP_PAGE_SIZE 4096
194 # endif
195
196 /* A profile for server; mruby vm is long life */
197 #elif defined(MRB_HIGH_PROFILE)
198 # ifndef MRB_METHOD_CACHE
199 #  define MRB_METHOD_CACHE
200 # endif
201
202 # ifndef MRB_METHOD_CACHE_SIZE
203 #  define MRB_METHOD_CACHE_SIZE (1<<12)
204 # endif
205
206 # ifndef MRB_IV_SEGMENT_SIZE
207 #  define MRB_IV_SEGMENT_SIZE 64
208 # endif
209
210 # ifndef MRB_HEAP_PAGE_SIZE
211 #  define MRB_HEAP_PAGE_SIZE 4096
212 # endif
213 #endif
214
215 #endif  /* MRUBYCONF_H */