diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-01-25 14:03:29 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-01-25 14:22:01 +0900 |
| commit | 83f2654bac329e9533c893e3759ae045e57b625a (patch) | |
| tree | 00b577fed1ed6f8c571f13a638c31860664780f5 /include/mrbconf.h | |
| parent | ec1a5af719c64d1dfd0adec1e61af28bc9eea3c8 (diff) | |
| download | mruby-83f2654bac329e9533c893e3759ae045e57b625a.tar.gz mruby-83f2654bac329e9533c893e3759ae045e57b625a.zip | |
Do not use `MRB_METHOD_TABLE_INLINE` by default; fix #3924
It was default on Linux. Abandoned for 2 reasons:
* some cross-platform compiler defines `__linux__` even on bare metal
environment (RTL8196 (MIPS big endian soc) for example).
* some compilers do not align functions pointers so that we need to
specify `-falign-functions=n` (where n>1). It's not suitable for
default configuration.
By our measurement, `mrbtest` consumes 400KB less memory. So if your
target machine is memory tight, add the following command-line options
to `GCC` (unfortunately `clang` does not support `-falign-functions`).
`-falign-functions=2 -DMRB_METHOD_TABLE_INLINE`
Diffstat (limited to 'include/mrbconf.h')
| -rw-r--r-- | include/mrbconf.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/include/mrbconf.h b/include/mrbconf.h index 96ab6b77f..cc28acfaa 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -36,12 +36,10 @@ /* size of the method cache (need to be the power of 2) */ //#define MRB_METHOD_CACHE_SIZE (1<<7) -/* add -DMRB_METHOD_TABLE_INLINE unless platform uses MSB of pointers */ +/* add -DMRB_METHOD_TABLE_INLINE to reduce the size of method table */ +/* MRB_METHOD_TABLE_INLINE requires LSB of function pointers to be zero */ +/* you might need to specify --falign-functions=n (where n>1) */ //#define MRB_METHOD_TABLE_INLINE -/* turn MRB_METHOD_TABLE_INLINE on for linux by default */ -#if !defined(MRB_METHOD_TABLE_INLINE) && defined(__linux__) -# define MRB_METHOD_TABLE_INLINE -#endif /* add -DMRB_INT16 to use 16bit integer for mrb_int; conflict with MRB_INT64 */ //#define MRB_INT16 |
