lib/nghttp2-1.65.0/third-party/mruby/doc/guides/mrbconf.md
You can do the build configuration in the build configuration file. The default
configuration file is build_config/default.rb.
You can specify your own configuration file by the MRUBY_CONFIG environment
variable (you can use CONFIG for shorthand for MRUBY_CONFIG). If the path
doesn't exist, build_config/${MRUBY_CONFIG}.rb is used.
Just add the configuration value to the MRuby::Build#defines attribute.
This is the same for MRuby::CrossBuild.
# build_config.rb
MRuby::Build.new do |conf|
...
conf.defines << 'MRB_GC_FIXED_ARENA'
conf.defines << 'MRB_NO_METHOD_CACHE'
...
end
NOTE
conf.defines) instead of per-compiler definitions (e.g., conf.cc.defines) unless there is a special reason not to.include/mruby/mrbconf.h file or give it directly as a compiler flag, as was the case before.MRB_NO_STDIO
<stdio.h> functions won't be used.mrb_irep load/dump from/to file.MRB_USE_DEBUG_HOOK
code_fetch_hook and/or debug_op_hook of mrb_state.OP_DEBUG.MRB_DEBUG
mrb_assert* macro will be defined with macros from <assert.h>.enable_debug method of MRuby::Build.MRB_STACK_EXTEND_DOUBLING
MRB_STACK_GROWTH.MRB_STACK_GROWTH
128.MRB_STACK_EXTEND_DOUBLING is defined.MRB_STACK_MAX
0x40000 - MRB_STACK_GROWTH.RuntimeError when stack size exceeds this value.MRB_USE_FLOAT32
float) is used as mrb_float.double) is used as mrb_float.MRB_NO_FLOAT
MRB_INT32
MRB_INT64 are not defined on 32-bit CPU mode, mrb_int will be defined as int32_t.MRB_INT64.MRB_INT64
MRB_INT32 are not defined on 64-bit CPU mode, mrb_int will be defined as int64_t.MRB_INT32.MRB_GC_STRESS
RBasic allocation.MRB_DEBUG, full GC is emitted also per each heap allocation (mrb_malloc() or etc.).
This configuration slows down mruby execution by a factor of 2 to 3 or even more.MRB_GC_TURN_OFF_GENERATIONAL
MRB_GC_FIXED_ARENA
RuntimeError when this is defined and GC arena size exceeds MRB_GC_ARENA_SIZE.MRB_GC_ARENA_SIZE
100.MRB_GC_FIXED_ARENA isn't defined.MRB_HEAP_PAGE_SIZE
1024.RBasic per each heap page.MRB_HEAP_PAGE_SIZE".
In mruby 3.1.0, the "size of management data per heap page" is 6 words, also "size per object" is 6 words.
For a 32-bit CPU, (6 * 4) + (6 * 4) * MRB_HEAP_PAGE_SIZE gives the bytes of size per heap page.
Conversely, for example, to keep the size per heap page to 4 Ki bytes,
calculate (4096 - (6 * 4)) / (6 * 4) to specify MRB_HEAP_PAGE_SIZE=169.POOL_ALIGNMENT
4.POOL_PAGE_SIZE
16000.MRB_FIXED_STATE_ATEXIT_STACK
mrb_state atexit stack.RuntimeError when mrb_state_atexit call count to same mrb_state exceeds
MRB_FIXED_STATE_ATEXIT_STACK_SIZE's value.MRB_FIXED_STATE_ATEXIT_STACK_SIZE
5.MRB_FIXED_STATE_ATEXIT_STACK isn't defined this macro is ignored.mrb_value configurationMRB_ENDIAN_BIG
MRB_NAN_BOXING.MRB_NAN_BOXING
mrb_value in boxed double.MRB_USE_FLOAT32 and MRB_NO_FLOAT.MRB_WORD_BOXING
mrb_value as a word.Float will be a mruby object with RBasic.MRB_USE_ETEXT_RO_DATA_P
etext and edata section addresses defined by the linker to detect read-only data.MRB_NO_DEFAULT_RO_DATA_P
mrb_ro_data_p() does not work for any reason.MRB_USE_CUSTOM_RO_DATA_P
MRB_USE_LINK_TIME_RO_DATA_P is not available.mrb_ro_data_p() function is implemented by the user in an arbitrary file.mrb_bool mrb_ro_data_p(const char *ptr).TRUE if ptr is in the read-only section, otherwise return FALSE.MRB_MALLOC_TRIM
MRB_UTF8_STRING
MRB_STR_LENGTH_MAX
MRB_ARY_LENGTH_MAX
MRB_FUNCALL_ARGC_MAX
16.argc) max value of mrb_funcall.ArgumentError when the argc argument is bigger then this value mrb_funcall.KHASH_DEFAULT_SIZE
32.kh_init_ ## name function.MRB_NO_METHOD_CACHE
MRB_METHOD_CACHE_SIZE
256.MRB_NO_METHOD_CACHE is defined.MRB_USE_METHOD_T_STRUCT
mrb_method_tMRB_USE_METHOD_T_STRUCT requires highest 2 bits of function pointers to be zeroMRB_USE_ALL_SYMBOLS
Symbol.all_symbols in mrbgems/mruby-symbol-extMRB_USE_VM_SWITCH_DISPATCH