From c35ff11ae516421809e0d03c278576a70fda45c4 Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 12 Aug 2015 08:43:55 +0000 Subject: * id_table.h: introduce ID key table. [Feature #11420] This table only manage ID->VALUE table to reduce overhead of st. Some functions prefixed rb_id_table_* are provided. * id_table.c: implement rb_id_table_*. There are several algorithms to implement it. Now, there are roughly 4 types: * st * array * hash (implemented by Yura Sokolov) * mix of array and hash The macro ID_TABLE_IMPL can choose implementation. You can see detailes about them at the head of id_table.c. At the default, I choose 34 (mix of list and hash). This is not final decision. Please report your suitable parameters or your data structure. * symbol.c: introduce rb_id_serial_t and rb_id_to_serial() to represent ID by serial number. * internal.h: use id_table for method tables. * class.c, gc.c, marshal.c, vm.c, vm_method.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- internal.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'internal.h') diff --git a/internal.h b/internal.h index 45742d059d..59526c8ec7 100644 --- a/internal.h +++ b/internal.h @@ -464,7 +464,7 @@ struct rb_classext_struct { struct st_table *iv_index_tbl; struct st_table *iv_tbl; struct st_table *const_tbl; - struct st_table *callable_m_tbl; + struct rb_id_table *callable_m_tbl; rb_subclass_entry_t *subclasses; rb_subclass_entry_t **parent_subclasses; /** @@ -486,7 +486,7 @@ struct RClass { struct RBasic basic; VALUE super; rb_classext_t *ptr; - struct st_table *m_tbl; + struct rb_id_table *m_tbl; }; void rb_class_subclass_add(VALUE super, VALUE klass); @@ -511,12 +511,6 @@ RCLASS_SET_ORIGIN(VALUE klass, VALUE origin) if (klass != origin) FL_SET(origin, RICLASS_IS_ORIGIN); } -static inline void -RCLASS_M_TBL_INIT(VALUE c) -{ - RCLASS_M_TBL(c) = st_init_numtable(); -} - #undef RCLASS_SUPER static inline VALUE RCLASS_SUPER(VALUE klass) -- cgit v1.2.3