diff options
| -rw-r--r-- | doc/guides/mrbconf.md | 8 | ||||
| -rw-r--r-- | include/mrbconf.h | 15 | ||||
| -rw-r--r-- | include/mruby.h | 2 | ||||
| -rw-r--r-- | include/mruby/proc.h | 4 |
4 files changed, 10 insertions, 19 deletions
diff --git a/doc/guides/mrbconf.md b/doc/guides/mrbconf.md index 3c20b3388..4f5349e77 100644 --- a/doc/guides/mrbconf.md +++ b/doc/guides/mrbconf.md @@ -180,10 +180,10 @@ largest value of required alignment. * Ignored if `MRB_METHOD_CACHE` is not defined. * Need to be the power of 2. -`MRB_METHOD_TABLE_INLINE` -* Reduce the size of method table. -* Requires LSB of function pointers to be zero. -* For example, you might need to specify `--falign-functions=n` (where `n > 1`) for GCC. +`MRB_METHOD_T_STRUCT` +* Use C struct to represent `mrb_method_t` +* No `MRB_METHOD_T_STRUCT` requires highest 2 bits of function pointers to be zero +* Define this macro on machines that use higher bits of pointers `MRB_ENABLE_ALL_SYMBOLS` * Make it available `Symbols.all_symbols` in `mrbgems/mruby-symbol-ext` diff --git a/include/mrbconf.h b/include/mrbconf.h index f5e8858ce..c5b9afd05 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -36,10 +36,9 @@ /* size of the method cache (need to be the power of 2) */ //#define MRB_METHOD_CACHE_SIZE (1<<7) -/* 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 +/* add -DMRB_METHOD_T_STRUCT on machines that use higher bits of pointers */ +/* no MRB_METHOD_T_STRUCT requires highest 2 bits of function pointers to be zero */ +//#define MRB_METHOD_T_STRUCT /* add -DMRB_INT16 to use 16bit integer for mrb_int; conflict with MRB_INT32 and MRB_INT64 */ //#define MRB_INT16 @@ -190,10 +189,6 @@ # define MRB_METHOD_CACHE_SIZE (1<<10) # endif -# ifndef MRB_METHOD_TABLE_INLINE -# define MRB_METHOD_TABLE_INLINE -# endif - # ifndef MRB_IV_SEGMENT_SIZE # define MRB_IV_SEGMENT_SIZE 32 # endif @@ -212,10 +207,6 @@ # define MRB_METHOD_CACHE_SIZE (1<<12) # endif -# ifndef MRB_METHOD_TABLE_INLINE -# define MRB_METHOD_TABLE_INLINE -# endif - # ifndef MRB_IV_SEGMENT_SIZE # define MRB_IV_SEGMENT_SIZE 64 # endif diff --git a/include/mruby.h b/include/mruby.h index 2db11c52f..e6371564e 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -188,7 +188,7 @@ struct mrb_context { */ typedef mrb_value (*mrb_func_t)(struct mrb_state *mrb, mrb_value self); -#ifdef MRB_METHOD_TABLE_INLINE +#ifndef MRB_METHOD_T_STRUCT typedef uintptr_t mrb_method_t; #else typedef struct { diff --git a/include/mruby/proc.h b/include/mruby/proc.h index f7f4d336a..a4ca25043 100644 --- a/include/mruby/proc.h +++ b/include/mruby/proc.h @@ -99,7 +99,7 @@ MRB_API mrb_value mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx); #define MRB_METHOD_FUNC_FL 1 #define MRB_METHOD_NOARG_FL 2 -#ifdef MRB_METHOD_TABLE_INLINE +#ifndef MRB_METHOD_T_STRUCT #define MRB_METHOD_FUNC_P(m) (((uintptr_t)(m))&MRB_METHOD_FUNC_FL) #define MRB_METHOD_NOARG_P(m) (((uintptr_t)(m))&MRB_METHOD_NOARG_FL) @@ -123,7 +123,7 @@ MRB_API mrb_value mrb_proc_cfunc_env_get(mrb_state *mrb, mrb_int idx); #define MRB_METHOD_PROC(m) ((m).proc) #define MRB_METHOD_UNDEF_P(m) ((m).proc==NULL) -#endif /* MRB_METHOD_TABLE_INLINE */ +#endif /* MRB_METHOD_T_STRUCT */ #define MRB_METHOD_CFUNC_P(m) (MRB_METHOD_FUNC_P(m)?TRUE:(MRB_METHOD_PROC(m)?(MRB_PROC_CFUNC_P(MRB_METHOD_PROC(m))):FALSE)) #define MRB_METHOD_CFUNC(m) (MRB_METHOD_FUNC_P(m)?MRB_METHOD_FUNC(m):((MRB_METHOD_PROC(m)&&MRB_PROC_CFUNC_P(MRB_METHOD_PROC(m)))?MRB_PROC_CFUNC(MRB_METHOD_PROC(m)):NULL)) |
