aboutsummaryrefslogtreecommitdiffstats
path: root/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/internal.h b/internal.h
index 43a08a6063..f1c9e94041 100644
--- a/internal.h
+++ b/internal.h
@@ -276,6 +276,11 @@ struct rb_classext_struct {
rb_alloc_func_t allocator;
};
+struct method_table_wrapper {
+ st_table *tbl;
+ size_t serial;
+};
+
/* class.c */
void rb_class_subclass_add(VALUE super, VALUE klass);
void rb_class_remove_from_super_subclasses(VALUE);
@@ -283,11 +288,22 @@ void rb_class_remove_from_super_subclasses(VALUE);
#define RCLASS_EXT(c) (RCLASS(c)->ptr)
#define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
#define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
-#define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
+#define RCLASS_M_TBL_WRAPPER(c) (RCLASS(c)->m_tbl_wrapper)
+#define RCLASS_M_TBL(c) (RCLASS_M_TBL_WRAPPER(c) ? RCLASS_M_TBL_WRAPPER(c)->tbl : 0)
#define RCLASS_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl)
#define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin)
#define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
+static inline void
+RCLASS_M_TBL_INIT(VALUE c)
+{
+ struct method_table_wrapper *wrapper;
+ wrapper = ALLOC(struct method_table_wrapper);
+ wrapper->tbl = st_init_numtable();
+ wrapper->serial = 0;
+ RCLASS_M_TBL_WRAPPER(c) = wrapper;
+}
+
#undef RCLASS_SUPER
static inline VALUE
RCLASS_SUPER(VALUE klass)