summaryrefslogtreecommitdiff
path: root/vm_method.c
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
commit3b060b22f9866c3e9a005774033905d9f58d2d54 (patch)
treed63f3e835ff544899b21effb8d818fdfdce90c35 /vm_method.c
parent639fd0874d81824c085a1d3daa14d8c142247b30 (diff)
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
Diffstat (limited to 'vm_method.c')
-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));