Skip to content

Commit 9f25e3f

Browse files
committed
Merge pull request mruby#2407 from take-cheeze/mrbconf_update
Update mrbconf document.
2 parents 49ecd44 + dd37c52 commit 9f25e3f

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

doc/mrbconf/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# mruby configuration macros.
22

3+
## How to use these macros.
4+
You can use mrbconfs with following ways:
5+
* Write them in `mrbconf.h`.
6+
* Using compiler flags is prefered when building a cross binaries or multiple mruby binaries
7+
since it's easier to use different mrbconf per each `MRuby::Build`.
8+
* Most flags can be enabled by just commenting in.
9+
* Pass them as compiler flags.
10+
* Make sure you pass the same flags to all compilers since some mrbconf(e.g., `MRB_GC_FIXED_ARENA`)
11+
changes `struct` layout and cause memory access error when C and other language(e.g., C++) is mixed.
12+
313
## stdio setting.
414
`ENABLE_STDIO`
515
* Will be defined automatically if `DISABLE_STDIO` isn't defined.
@@ -36,3 +46,38 @@
3646
`MRB_STACK_MAX`
3747
* Default value is `0x40000 - MRB_STACK_GROWTH`.
3848
* Raises `RuntimeError` when stack size exceeds this value.
49+
50+
## Primitive type configuration.
51+
52+
`MRB_USE_FLOAT`
53+
* When defined single precision floating point type(C type `float`) is used as `mrb_float`.
54+
* Else double precision floating point type(C type `double`) is used as `mrb_float`.
55+
56+
`MRB_INT16`
57+
* When defined `int16_t` will be defined as `mrb_int`.
58+
* Conflicts with `MRB_INT64`.
59+
60+
`MRB_INT64`
61+
* When defined `int64_t` will be defined as `mrb_int`.
62+
* Conflicts with `MRB_INT16`.
63+
* When `MRB_INT16` or `MRB_INT64` isn't defined `int`(most of the times 32-bit integer)
64+
will be defined as `mrb_int`.
65+
66+
## Garbage collector configuration.
67+
68+
`MRB_GC_STRESS`
69+
* When defined full GC is emitted per each `RBasic` allocation.
70+
* Mainly used in memory manager debugging.
71+
72+
`MRB_GC_TURN_OFF_GENERATIONAL`
73+
* When defined turns generational GC by default.
74+
75+
`MRB_GC_FIXED_ARENA`
76+
* When defined used fixed size GC arena.
77+
* Raises `RuntimeError` when this is defined and GC arena size exceeds `MRB_GC_ARENA_SIZE`.
78+
* Useful tracking unnecessary mruby object allocation.
79+
80+
`MRB_GC_ARENA_SIZE`
81+
* Default value 100.
82+
* Ignored when `MRB_GC_FIXED_ARENA` isn't defined.
83+
* Defines fixed GC arena size.

0 commit comments

Comments
 (0)