aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-17 05:35:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-17 05:35:28 +0000
commit7f77c410aa99fc6d6b5c96c1514c1fa73a020a0d (patch)
treed63f3e835ff544899b21effb8d818fdfdce90c35
parent585df42f4bbccb13f64a0f78897462dc78b541d3 (diff)
downloadruby-7f77c410aa99fc6d6b5c96c1514c1fa73a020a0d.tar.gz
vm_method.c: empty table
* vm_method.c (prepare_callable_method_entry): empty method table has no entries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--vm_method.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/vm_method.c b/vm_method.c
index 0abef8f24b..c343015778 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -806,16 +806,17 @@ prepare_callable_method_entry(VALUE defined_class, ID id, const rb_method_entry_
VM_ASSERT(RB_TYPE_P(defined_class, T_ICLASS) || RB_TYPE_P(defined_class, T_MODULE));
VM_ASSERT(me->defined_class == 0);
- if ((mtbl = RCLASS_CALLABLE_M_TBL(defined_class)) == NULL) {
- mtbl = RCLASS_EXT(defined_class)->callable_m_tbl = rb_id_table_create(0);
- }
+ mtbl = RCLASS_CALLABLE_M_TBL(defined_class);
- if (rb_id_table_lookup(mtbl, id, (VALUE *)&me)) {
+ if (mtbl && rb_id_table_lookup(mtbl, id, (VALUE *)&me)) {
RB_DEBUG_COUNTER_INC(mc_cme_complement_hit);
cme = (rb_callable_method_entry_t *)me;
VM_ASSERT(callable_method_entry_p(cme));
}
else {
+ if (!mtbl) {
+ mtbl = RCLASS_EXT(defined_class)->callable_m_tbl = rb_id_table_create(0);
+ }
cme = rb_method_entry_complement_defined_class(me, me->called_id, defined_class);
rb_id_table_insert(mtbl, id, (VALUE)cme);
VM_ASSERT(callable_method_entry_p(cme));