2 ** mrbconf.h - mruby core configuration
4 ** See Copyright Notice in mruby.h
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
23 #if defined(MRB_32BIT) && defined(MRB_64BIT)
24 #error Cannot build for 32 and 64 bit architecture at the same time
27 /* configuration options: */
28 /* add -DMRB_USE_FLOAT to use float instead of double for floating point numbers */
29 //#define MRB_USE_FLOAT
31 /* exclude floating point numbers */
32 //#define MRB_WITHOUT_FLOAT
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)
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.
45 # define MRB_METHOD_T_STRUCT
49 /* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT64;
50 Default for 32-bit CPU mode. */
53 /* add -DMRB_INT64 to use 64bit integer for mrb_int; conflict with MRB_INT32;
54 Default for 64-bit CPU mode. */
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) */
63 /* Otherwise use 32bit integers */
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
76 /* represent mrb_value in boxed double; conflict with MRB_USE_FLOAT and MRB_WITHOUT_FLOAT */
77 //#define MRB_NAN_BOXING
79 /* represent mrb_value as a word (natural unit of data for the processor) */
80 //#define MRB_WORD_BOXING
82 /* string class to handle UTF-8 encoding */
83 //#define MRB_UTF8_STRING
85 /* argv max size in mrb_funcall */
86 //#define MRB_FUNCALL_ARGC_MAX 16
88 /* number of object per heap page */
89 //#define MRB_HEAP_PAGE_SIZE 1024
91 /* if __ehdr_start is available, mruby can reduce memory used by symbols */
92 //#define MRB_USE_LINK_TIME_RO_DATA_P
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
99 /* turn off generational GC by default */
100 //#define MRB_GC_TURN_OFF_GENERATIONAL
102 /* default size of khash table bucket */
103 //#define KHASH_DEFAULT_SIZE 32
105 /* allocated memory address alignment */
106 //#define POOL_ALIGNMENT 4
108 /* page size of memory pool */
109 //#define POOL_PAGE_SIZE 16000
111 /* initial minimum size for string buffer */
112 //#define MRB_STR_BUF_MIN_SIZE 128
115 //#define MRB_GC_ARENA_SIZE 100
117 /* fixed size GC arena */
118 //#define MRB_GC_FIXED_ARENA
120 /* state atexit stack size */
121 //#define MRB_FIXED_STATE_ATEXIT_STACK_SIZE 5
123 /* fixed size state atexit stack */
124 //#define MRB_FIXED_STATE_ATEXIT_STACK
126 /* -DMRB_DISABLE_XXXX to drop following features */
127 //#define MRB_DISABLE_STDIO /* use of stdio */
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 */
133 /* end of configuration */
135 /* define MRB_DISABLE_XXXX from DISABLE_XXX (for compatibility) */
137 #define MRB_DISABLE_STDIO
140 /* define MRB_ENABLE_XXXX from ENABLE_XXX (for compatibility) */
142 #define MRB_ENABLE_DEBUG_HOOK
145 #ifndef MRB_DISABLE_STDIO
158 ** mruby tuning profiles
161 /* A profile for micro controllers */
162 #if defined(MRB_CONSTRAINED_BASELINE_PROFILE)
163 # ifndef KHASH_DEFAULT_SIZE
164 # define KHASH_DEFAULT_SIZE 16
167 # ifndef MRB_STR_BUF_MIN_SIZE
168 # define MRB_STR_BUF_MIN_SIZE 32
171 # ifndef MRB_HEAP_PAGE_SIZE
172 # define MRB_HEAP_PAGE_SIZE 256
175 /* A profile for default mruby */
176 #elif defined(MRB_BASELINE_PROFILE)
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
184 # ifndef MRB_METHOD_CACHE_SIZE
185 # define MRB_METHOD_CACHE_SIZE (1<<10)
188 # ifndef MRB_IV_SEGMENT_SIZE
189 # define MRB_IV_SEGMENT_SIZE 32
192 # ifndef MRB_HEAP_PAGE_SIZE
193 # define MRB_HEAP_PAGE_SIZE 4096
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
202 # ifndef MRB_METHOD_CACHE_SIZE
203 # define MRB_METHOD_CACHE_SIZE (1<<12)
206 # ifndef MRB_IV_SEGMENT_SIZE
207 # define MRB_IV_SEGMENT_SIZE 64
210 # ifndef MRB_HEAP_PAGE_SIZE
211 # define MRB_HEAP_PAGE_SIZE 4096
215 #endif /* MRUBYCONF_H */