diff options
Diffstat (limited to 'include/mruby.h')
| -rw-r--r-- | include/mruby.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/mruby.h b/include/mruby.h index 556dc41e8..cd9fca7f4 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -157,6 +157,22 @@ struct mrb_context { struct RFiber *fib; }; +#ifdef MRB_METHOD_CACHE_SIZE +# define MRB_METHOD_CACHE +#else +/* default method cache size: 128 */ +/* cache size needs to be power of 2 */ +# define MRB_METHOD_CACHE_SIZE (1<<7) +#endif + +#ifdef MRB_METHOD_CACHE +struct mrb_cache_entry { + struct RClass *c; + mrb_sym mid; + struct RProc *m; +}; +#endif + struct mrb_jmpbuf; typedef void (*mrb_atexit_func)(struct mrb_state*); @@ -197,6 +213,10 @@ typedef struct mrb_state { struct alloca_header *mems; mrb_gc gc; +#ifdef MRB_METHOD_CACHE + struct mrb_cache_entry cache[MRB_METHOD_CACHE_SIZE]; +#endif + mrb_sym symidx; struct kh_n2s *name2sym; /* symbol hash */ struct symbol_name *symtbl; /* symbol table */ |
